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