From 8aad227374dbe1098d1959f6e1b84d4e770d0ccb Mon Sep 17 00:00:00 2001 From: JoseThen Date: Wed, 18 Feb 2026 21:33:20 -0500 Subject: [PATCH 1/2] fix: code quality fixes and release automation for v0.8.0 - Fix typo: Lantency -> Latency in CheckupResults struct and all usages - Replace deprecated ioutil.ReadFile with os.ReadFile - Enable darwin arm64 builds in makefile, bump version to 0.8.0 - Update prs.yml to use modern action versions (checkout@v4, setup-go@v5, setup-python@v5, pre-commit@v3) - Fix README asset path from ./assets/gopher.png to ./Images/gopher.png - Add release.yml: cross-compiles all platforms on version tag push and publishes GitHub Release with all binaries --- .github/workflows/prs.yml | 14 +++--- .github/workflows/release.yml | 87 +++++++++++++++++++++++++++++++++++ README.md | 2 +- makefile | 5 +- utils/ReadExam.go | 4 +- utils/checkup.go | 4 +- utils/styledOutput.go | 2 +- 7 files changed, 102 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/prs.yml b/.github/workflows/prs.yml index 93cd901..d66dac0 100644 --- a/.github/workflows/prs.yml +++ b/.github/workflows/prs.yml @@ -8,27 +8,27 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 - name: Run Pre-Commit - uses: pre-commit/action@v2.0.3 + uses: pre-commit/action@v3.0.1 build: name: Build runs-on: ubuntu-latest needs: pre-commit steps: - - name: Set up Go 1.23.1 - uses: actions/setup-go@v2 + - name: Set up Go 1.23 + uses: actions/setup-go@v5 with: - go-version: 1.23.1 + go-version: 1.23 id: go - name: Check out code into the Go module directory - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Build Binary run: go build -v . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..48d3d80 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,87 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + name: Build and Release + runs-on: ubuntu-latest + strategy: + matrix: + include: + - goos: linux + goarch: amd64 + suffix: linux-amd64 + - goos: linux + goarch: arm64 + suffix: linux-arm64 + - goos: linux + goarch: arm + suffix: linux-arm + - goos: linux + goarch: "386" + suffix: linux-386 + - goos: darwin + goarch: amd64 + suffix: darwin-amd64 + - goos: darwin + goarch: arm64 + suffix: darwin-arm64 + - goos: windows + goarch: amd64 + suffix: windows-amd64.exe + - goos: windows + goarch: "386" + suffix: windows-386.exe + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.23 + + - name: Build binary + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + run: | + go build -v \ + -ldflags="-s -w -X main.version=${{ github.ref_name }}" \ + -o checkup-${{ github.ref_name }}-${{ matrix.suffix }} \ + main.go + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: checkup-${{ github.ref_name }}-${{ matrix.suffix }} + path: checkup-${{ github.ref_name }}-${{ matrix.suffix }} + + publish: + name: Publish GitHub Release + runs-on: ubuntu-latest + needs: release + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: dist/ + merge-multiple: true + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + name: ${{ github.ref_name }} + generate_release_notes: true + files: dist/* diff --git a/README.md b/README.md index 5d84bad..963a0f5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- +

--- diff --git a/makefile b/makefile index 6dfd63e..6f44502 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,6 @@ .PHONY: build run compile build-linux build-windows build-darwin test -VERSION ?= 0.7.0 +VERSION ?= 0.8.0 NAME ?= "checkup" test: @@ -15,8 +15,7 @@ run: build-darwin: echo "Compiling for Darwin" GOOS=darwin GOARCH=amd64 go build -o release/$(NAME)-v${VERSION}-darwin-amd64 main.go - # GOOS=darwin GOARCH=arm go build -v -o release/$(NAME)-v${VERSION}-darwin-arm main.go - # GOOS=darwin GOARCH=arm64 go build -o release/$(NAME)-v${VERSION}-darwin-arm64 main.go + GOOS=darwin GOARCH=arm64 go build -o release/$(NAME)-v${VERSION}-darwin-arm64 main.go build-windows: echo "Compiling for Windows" diff --git a/utils/ReadExam.go b/utils/ReadExam.go index 4456918..887cbcc 100644 --- a/utils/ReadExam.go +++ b/utils/ReadExam.go @@ -3,7 +3,7 @@ package utils import ( "encoding/json" "fmt" - "io/ioutil" + "os" "path/filepath" "strings" @@ -23,7 +23,7 @@ type ExamFile struct { // ReadExam ... Help read a given file and set to a struct func ReadExam(file string) ExamFile { var exam ExamFile - examFile, err := ioutil.ReadFile(file) + examFile, err := os.ReadFile(file) ErrorCheck(err) extension := filepath.Ext(strings.TrimSpace(file)) err = fmt.Errorf("wrong Extension: %v", extension) diff --git a/utils/checkup.go b/utils/checkup.go index 18f249b..08fdf26 100644 --- a/utils/checkup.go +++ b/utils/checkup.go @@ -20,7 +20,7 @@ type CheckupResults struct { Endpoint string Code int Result int - Lantency time.Duration + Latency time.Duration Pass bool } @@ -50,7 +50,7 @@ func Checkup(healthForm CheckupRequest) CheckupResults { Endpoint: healthForm.Endpoint, Code: healthForm.Code, Result: resp.StatusCode, - Lantency: end, + Latency: end, Pass: resp.StatusCode == healthForm.Code, } diff --git a/utils/styledOutput.go b/utils/styledOutput.go index 1cb38a2..9d14222 100644 --- a/utils/styledOutput.go +++ b/utils/styledOutput.go @@ -52,7 +52,7 @@ func Show(checkups []CheckupResults) *table.Table { checkups[count].Endpoint, strconv.Itoa(checkups[count].Code), strconv.Itoa(checkups[count].Result), - strconv.FormatInt(checkups[count].Lantency.Milliseconds(), 10), + strconv.FormatInt(checkups[count].Latency.Milliseconds(), 10), strconv.FormatBool(checkups[count].Pass), ) } From 79319c56e41327a8ace523767e9d5ece2df61084 Mon Sep 17 00:00:00 2001 From: JoseThen <38862945+JoseThen@users.noreply.github.com> Date: Wed, 18 Feb 2026 21:48:48 -0500 Subject: [PATCH 2/2] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 963a0f5..5d84bad 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- +

---