Skip to content

Commit 68cd937

Browse files
ci: add vuln scanning + module verify, and streamline the test workflow (#409)
* ci: add govulncheck scan and module integrity verification Add a vulncheck job that runs govulncheck against the dependency graph, reporting only vulnerabilities reachable from our code, and a `go mod verify` step in the build job to catch tampering of the restored module cache before builds trust it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ci: collapse go test jobs into a matrix and un-gate build The unit, e2e, integration, and contract jobs shared identical checkout/setup-go/cache boilerplate and differed only in the test command, so they now run as a single matrix job. Check names are preserved (Unit Tests, E2E Tests, Integration Tests, Contract Replay Tests) so required status checks keep matching. The build job no longer waits on the test jobs — compiling the binary doesn't depend on tests passing, so it now runs in parallel and shortens the critical path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ci: harden vulncheck job (timeout + swagger-tag scan) Address review feedback on the vulncheck job: - Add timeout-minutes: 10 so a hung govulncheck can't run to the 360-minute default. - Add a second govulncheck run with -tags=swagger to cover the swagger-tagged production build (swagger_enabled.go), which the default tag set excludes. The tests/* suites behind e2e/integration/ contract tags are intentionally not scanned — they aren't shipped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * ci: pin govulncheck to v1.3.0 Replace @latest with an explicit version so the vulnerability gate is reproducible and doesn't drift with upstream releases. v1.3.0 is the current latest; bump intentionally when updating. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 58eb867 commit 68cd937

1 file changed

Lines changed: 43 additions & 44 deletions

File tree

.github/workflows/test.yml

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,24 @@ jobs:
3737
# the schema fetch is reliable again; track in this PR/branch discussion.
3838
verify: false
3939

40-
test-unit:
41-
name: Unit Tests
40+
# Unit, E2E, integration, and contract suites share identical setup and
41+
# differ only in the test command, so they run as one matrix.
42+
go-tests:
43+
name: ${{ matrix.name }}
4244
runs-on: ubuntu-latest
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
include:
49+
- name: Unit Tests
50+
cmd: make test-race
51+
coverage: true
52+
- name: E2E Tests
53+
cmd: go test -v -tags=e2e -timeout=5m ./tests/e2e/...
54+
- name: Integration Tests
55+
cmd: go test -v -tags=integration -timeout=10m ./tests/integration/...
56+
- name: Contract Replay Tests
57+
cmd: go test -v -tags=contract -timeout=5m ./tests/contract/...
4358
steps:
4459
- uses: actions/checkout@v6
4560

@@ -49,10 +64,11 @@ jobs:
4964
go-version: ${{ env.GO_VERSION }}
5065
cache: true
5166

52-
- name: Run unit tests
53-
run: make test-race
67+
- name: Run tests
68+
run: ${{ matrix.cmd }}
5469

5570
- name: Upload coverage
71+
if: matrix.coverage
5672
uses: codecov/codecov-action@v7
5773
with:
5874
files: ./coverage.out
@@ -73,38 +89,8 @@ jobs:
7389
- name: Run dashboard JavaScript tests
7490
run: make test-dashboard
7591

76-
test-e2e:
77-
name: E2E Tests
78-
runs-on: ubuntu-latest
79-
steps:
80-
- uses: actions/checkout@v6
81-
82-
- name: Set up Go
83-
uses: actions/setup-go@v6
84-
with:
85-
go-version: ${{ env.GO_VERSION }}
86-
cache: true
87-
88-
- name: Run E2E tests
89-
run: go test -v -tags=e2e -timeout=5m ./tests/e2e/...
90-
91-
integration:
92-
name: Integration Tests
93-
runs-on: ubuntu-latest
94-
steps:
95-
- uses: actions/checkout@v6
96-
97-
- name: Set up Go
98-
uses: actions/setup-go@v6
99-
with:
100-
go-version: ${{ env.GO_VERSION }}
101-
cache: true
102-
103-
- name: Run integration tests
104-
run: go test -v -tags=integration -timeout=10m ./tests/integration/...
105-
106-
test-contract:
107-
name: Contract Replay Tests
92+
performance:
93+
name: Performance Guard
10894
runs-on: ubuntu-latest
10995
steps:
11096
- uses: actions/checkout@v6
@@ -115,12 +101,14 @@ jobs:
115101
go-version: ${{ env.GO_VERSION }}
116102
cache: true
117103

118-
- name: Run contract replay tests
119-
run: go test -v -tags=contract -timeout=5m ./tests/contract/...
104+
- name: Run hot-path performance guard
105+
# Thresholds are maintained in tests/perf/hotpath_test.go.
106+
run: make perf-check
120107

121-
performance:
122-
name: Performance Guard
108+
vulncheck:
109+
name: Vulnerability Scan
123110
runs-on: ubuntu-latest
111+
timeout-minutes: 10
124112
steps:
125113
- uses: actions/checkout@v6
126114

@@ -130,9 +118,16 @@ jobs:
130118
go-version: ${{ env.GO_VERSION }}
131119
cache: true
132120

133-
- name: Run hot-path performance guard
134-
# Thresholds are maintained in tests/perf/hotpath_test.go.
135-
run: make perf-check
121+
# Scans the dependency graph against the Go vulnerability database,
122+
# reporting only vulnerabilities reachable from our code. The second run
123+
# covers the swagger-tagged production build (swagger_enabled.go), which
124+
# the default tag set excludes. The tests/* suites behind e2e/integration/
125+
# contract tags are deliberately skipped — they aren't in the shipped binary.
126+
- name: Run govulncheck
127+
run: |
128+
go install golang.org/x/vuln/cmd/govulncheck@v1.3.0
129+
govulncheck ./...
130+
govulncheck -tags=swagger ./...
136131
137132
docs-validate:
138133
name: Docs Validation
@@ -153,10 +148,11 @@ jobs:
153148
run: npx mint validate
154149
working-directory: docs
155150

151+
# Compiling the binary doesn't depend on tests passing, so this runs in
152+
# parallel with the test jobs rather than gating behind them.
156153
build:
157154
name: Build
158155
runs-on: ubuntu-latest
159-
needs: [lint, test-unit, test-dashboard, test-e2e, integration, test-contract, performance]
160156
steps:
161157
- uses: actions/checkout@v6
162158

@@ -166,5 +162,8 @@ jobs:
166162
go-version: ${{ env.GO_VERSION }}
167163
cache: true
168164

165+
- name: Verify module integrity
166+
run: go mod verify
167+
169168
- name: Build
170169
run: go build -v ./cmd/gomodel

0 commit comments

Comments
 (0)