From ef8b80cd052aa5d30aba8aadcd89557062e77de1 Mon Sep 17 00:00:00 2001 From: nicodes Date: Sat, 1 Aug 2026 19:23:30 -0600 Subject: [PATCH] Standardize CI on the org shape `go test ./...` was written out in both ci.yml and release.yml. It is .github/actions/test now, called by both -- a small duplication, but the same kind that lets the release-side copy be trimmed for speed until it no longer matches what people trust on a pull request. Build runs before Test, the job is named ci rather than cli, third-party actions are pinned by SHA, and both jobs are bounded. NOT fixed here, and noted in ci.yml: the two workflows still BUILD differently. CI runs scripts/cli_build.sh; release.yml cross-compiles inline with its own loop. Only the CI path runs on a pull request, so a break in the release cross-compile still surfaces first at release time. Unifying them means deciding which build is the real one and deserves its own pull request. Verified locally: vet and tests pass. Co-Authored-By: Claude Opus 5 (1M context) --- .github/actions/test/action.yml | 23 +++++++++++++++++++++++ .github/workflows/ci.yml | 23 +++++++++++++++++------ .github/workflows/release.yml | 11 +++++++---- 3 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 .github/actions/test/action.yml diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml new file mode 100644 index 0000000..35633b5 --- /dev/null +++ b/.github/actions/test/action.yml @@ -0,0 +1,23 @@ +name: Test +description: > + Is this commit good. Nothing is built for release here and nothing is + published; a failure means the code is wrong, not that the pipeline is. + + A composite action rather than a reusable workflow so it runs in the caller's + job, under the caller's name -- CI / Test, Release / Test -- rather than as a + nested "caller / callee" check. + + ONE definition, called by CI and by Release both. They each carried their own + `go test ./...` before, which is a small duplication but the same kind that + lets the release-side copy be trimmed for speed until it no longer matches + what people trust on a pull request. + + Assumes Go is already set up; the caller does that, because the toolchain + version is a property of the job rather than of this step. + +runs: + using: composite + steps: + - name: Go tests + shell: bash + run: go test ./... diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f47b994..3006d8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,19 +7,30 @@ on: - main jobs: - cli: + ci: runs-on: ubuntu-latest + # Bounded, so a step that hangs fails here rather than sitting until the + # runner's own timeout hours later. + timeout-minutes: 20 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: go-version-file: go.mod - - name: Test CLI - run: go test ./... - + # Built first: a compile error should fail before a test suite reaches the + # same conclusion more slowly. + # + # NOTE: this builds through scripts/cli_build.sh, and release.yml + # cross-compiles inline with its own loop. Two build paths, and only this + # one runs on a pull request -- so a break in the release cross-compile + # still surfaces first at release time. Unifying them is a real change and + # deserves its own pull request; this one only stops the TEST drifting. - name: Build CLI run: ./scripts/cli_build.sh + + - name: Test + uses: ./.github/actions/test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e14e41..a55ef82 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,14 +20,17 @@ concurrency: release-${{ github.repository }} jobs: release: runs-on: ubuntu-latest + # Bounded, so a step that hangs fails here rather than sitting until the + # runner's own timeout hours later. + timeout-minutes: 20 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: go-version-file: go.mod @@ -63,8 +66,8 @@ jobs: echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "tag=$TAG" >> "$GITHUB_OUTPUT" - - name: Test CLI - run: go test ./... + - name: Test + uses: ./.github/actions/test - name: Build release artifacts env: