From a9766ef360bd1d666f1f39e8d07d667140d4586f Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Sat, 6 Jun 2026 08:03:26 +0100 Subject: [PATCH] fix(ci): modernize on-push build.yml to use actions/setup-go@1.24 + cache + go mod download (fixes Go 1.22.5 vs go.mod 1.24.2 mismatch); keep 'Linux Build' step name for compatibility; update ci-build.sh --- .gitea/workflows/build.yml | 78 ++++++++++++++++++++++++++++---------- ci-build.sh | 4 +- 2 files changed, 60 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 72650e1..c1988d9 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -1,26 +1,62 @@ -name: gobuild +name: CI -on: [push] - -env: - BUILD_TYPE: Release +on: [push, pull_request] jobs: - build: - runs-on: golang-latest - + test: + name: Test + runs-on: ubuntu-gitea steps: - - name: Lets See What We Have - run: - uname -a - && echo $PATH - && echo $GOPATH - && which go - && go version - - name: Clone Repo - run: - git clone https://repos.gmgauthier.com/gmgauthier/gostations.git . - && ls -la + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Download dependencies + run: go mod download + + - name: Run tests (short) + run: make test-short + + build: + name: Build + runs-on: ubuntu-gitea + needs: [test] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.24' + + - name: Cache Go modules + uses: actions/cache@v4 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Download dependencies + run: go mod download + - name: Linux Build - run: - ./ci-build.sh + run: ./ci-build.sh + + - name: Verify binary + run: | + ./build/gostations -v || true + ls -lh build/gostations || true diff --git a/ci-build.sh b/ci-build.sh index 71fad74..4111379 100755 --- a/ci-build.sh +++ b/ci-build.sh @@ -1,7 +1,9 @@ #!/usr/bin/env sh -# CI build (old runner compatibility). Uses Makefile for consistency. +# CI build step (kept for the workflow's "Linux Build" name). +# Now uses modern Go from setup-go in the workflow. set -e +echo "Running make build with Go: $(go version)" make build