@@ -13,80 +13,34 @@ permissions:
1313
1414jobs :
1515 # Build and test
16+ # Gating test legs: ubuntu + macos. Runs through the shared workflow, which
17+ # provisions the Node toolchain the generated-client runtime tests need.
1618 test :
17- name : Test on ${{ matrix.os }}
18- runs-on : ${{ matrix.os }}
19- timeout-minutes : 15
20- strategy :
21- fail-fast : false
22- matrix :
23- os : [ubuntu-latest, macos-latest, windows-latest]
24- steps :
25- - name : Checkout code
26- uses : actions/checkout@v4
27- with :
28- sparse-checkout : |
29- /*
30- !docs/
31- sparse-checkout-cone-mode : false
32-
33- - name : Set up Go
34- uses : actions/setup-go@v5
35- with :
36- go-version-file : go.mod
37- check-latest : true
38- cache-dependency-path : |
39- **/go.sum
40-
41- - name : Download dependencies
42- run : go mod download
43-
44- - name : Verify dependencies
45- run : go mod verify
46-
47- - name : Check go.mod tidiness
48- if : matrix.os != 'windows-latest'
49- run : |
50- go mod tidy
51- git diff --exit-code go.mod go.sum || (echo "❌ go.mod or go.sum needs tidying" && exit 1)
52-
53- - name : Build
54- run : go build -v ./...
55-
56- - name : Set up Node
57- uses : actions/setup-node@v4
58- with :
59- node-version : ' 20'
60-
61- - name : Install TypeScript and esbuild
62- # esbuild is required by the generated-client runtime tests, which
63- # bundle an emitted client and execute it under Node. Without it the
64- # harness falls back to `npx esbuild`, which cannot auto-install
65- # non-interactively in CI ("npx canceled due to missing packages and
66- # no YES option") -- those tests then fail rather than skip, and the
67- # execution coverage they provide is exactly the coverage that catches
68- # runtime/type mismatches the tsc gate cannot see.
69- run : npm install -g typescript@5.8.2 esbuild@0.28.1
70-
71- - name : Run tests
72- shell : bash
73- run : |
74- PKGS=$(go list ./... | grep -v '/bk/')
75- go test -v -short -race -timeout=10m -coverprofile=coverage.out $PKGS
76-
77- - name : Upload coverage reports to Codecov
78- uses : codecov/codecov-action@v5
79- with :
80- token : ${{ secrets.CODECOV_TOKEN }}
81- files : coverage.out
82-
83- - name : Upload coverage
84- if : matrix.os == 'ubuntu-latest'
85- uses : actions/upload-artifact@v4
86- with :
87- name : coverage-report
88- path : coverage.out
89- retention-days : 7
19+ uses : xraph/workflows/.github/workflows/go-ci.yml@v1
20+ with :
21+ go-versions : ' ["1.26"]'
22+ os : ' ["ubuntu-latest","macos-latest"]'
23+ only-test : true
24+ node-version : ' 20'
25+ npm-global-packages : ' typescript@5.8.2 esbuild@0.28.1'
26+ # `make test` sweeps every module in the repo; CI deliberately tests only
27+ # the root module and leaves the rest to build-all-modules.
28+ prefer-makefile : false
29+ secrets :
30+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
31+
32+ # Windows is optional and must never block a merge - ci-summary deliberately
33+ # leaves this out of its gate, matching the pre-migration policy.
34+ test-windows :
35+ uses : xraph/workflows/.github/workflows/go-ci.yml@v1
36+ with :
37+ go-versions : ' ["1.26"]'
38+ os : ' ["windows-latest"]'
39+ only-test : true
40+ node-version : ' 20'
41+ npm-global-packages : ' typescript@5.8.2 esbuild@0.28.1'
42+ prefer-makefile : false
43+ coverage : false
9044
9145 # Build and vet ALL submodules (extensions, examples, cmd)
9246 build-all-modules :
@@ -206,8 +160,9 @@ jobs:
206160 args : --timeout=5m --exclude-dirs=bk
207161 continue-on-error : true
208162
163+ # bk/ no longer exists, so the old `grep -v '/bk/'` filter was a no-op.
209164 - name : Run go vet
210- run : go vet $(go list ./... | grep -v '/bk/')
165+ run : go vet ./...
211166
212167 # Security scanning
213168 security :
@@ -300,41 +255,50 @@ jobs:
300255 ci-summary :
301256 name : CI Summary
302257 runs-on : ubuntu-latest
303- needs : [test, build-all-modules, lint, security, build-cli]
258+ needs : [test, test-windows, build-all-modules, lint, security, build-cli]
304259 if : always()
305260 steps :
306261 - name : Generate summary
262+ env :
263+ TEST_RESULT : ${{ needs.test.result }}
264+ WINDOWS_RESULT : ${{ needs.test-windows.result }}
265+ MODULES_RESULT : ${{ needs.build-all-modules.result }}
266+ LINT_RESULT : ${{ needs.lint.result }}
267+ SECURITY_RESULT : ${{ needs.security.result }}
268+ CLI_RESULT : ${{ needs.build-cli.result }}
307269 run : |
308- cat >> $GITHUB_STEP_SUMMARY << EOF
309- # CI Results Summary
310-
311- ## Job Status
312- - **Test**: ${{ needs.test.result }} (Windows optional)
313- - **Build All Modules**: ${{ needs.build-all-modules.result }}
314- - **Lint**: ${{ needs.lint.result }}
315- - **Security**: ${{ needs.security.result }}
316- - **Build CLI**: ${{ needs.build-cli.result }}
317-
318- ## Details
319- - **Commit**: ${{ github.sha }}
320- - **Branch**: ${{ github.ref_name }}
321- - **Triggered by**: ${{ github.event_name }}
322- - **Run number**: ${{ github.run_number }}
323-
324- > **Note**: Windows tests are optional and failures won't block CI
325-
326- EOF
327-
328- # Allow Windows test failures
329- if [ "${{ needs.build-all-modules.result }}" != "success" ] || \
330- [ "${{ needs.lint.result }}" != "success" ] || \
331- [ "${{ needs.security.result }}" != "success" ] || \
332- [ "${{ needs.build-cli.result }}" != "success" ]; then
333- echo "❌ **CI Failed** - Please check the logs above" >> $GITHUB_STEP_SUMMARY
270+ set -uo pipefail
271+ {
272+ echo "# CI Results Summary"
273+ echo
274+ echo "| Job | Result |"
275+ echo "|---|---|"
276+ echo "| Test (ubuntu, macos) | ${TEST_RESULT} |"
277+ echo "| Test (windows, optional) | ${WINDOWS_RESULT} |"
278+ echo "| Build All Modules | ${MODULES_RESULT} |"
279+ echo "| Lint | ${LINT_RESULT} |"
280+ echo "| Security | ${SECURITY_RESULT} |"
281+ echo "| Build CLI | ${CLI_RESULT} |"
282+ } >> "$GITHUB_STEP_SUMMARY"
283+
284+ # Windows is explicitly optional and is NOT part of the gate.
285+ failed=0
286+ for entry in "test:${TEST_RESULT}" "build-all-modules:${MODULES_RESULT}" \
287+ "lint:${LINT_RESULT}" "security:${SECURITY_RESULT}" \
288+ "build-cli:${CLI_RESULT}"; do
289+ name="${entry%%:*}"; status="${entry##*:}"
290+ if [ "$status" != "success" ]; then
291+ echo "::error::Required CI job '$name' did not succeed (result: $status)"
292+ failed=1
293+ fi
294+ done
295+
296+ if [ "$failed" -ne 0 ]; then
297+ echo "**CI failed** - see the job logs above." >> "$GITHUB_STEP_SUMMARY"
334298 exit 1
335- elif [ "${{ needs.test.result }}" != "success" ]; then
336- echo "⚠️ **Tests have issues (Windows may be failing)** - Please review logs" >> $GITHUB_STEP_SUMMARY
299+ fi
300+ if [ "$WINDOWS_RESULT" != "success" ]; then
301+ echo "**Passed**, with optional Windows tests failing." >> "$GITHUB_STEP_SUMMARY"
337302 else
338- echo "✅ **All CI checks passed**" >> $GITHUB_STEP_SUMMARY
303+ echo "**All CI checks passed**" >> " $GITHUB_STEP_SUMMARY"
339304 fi
340-
0 commit comments