Repository navigation
172 lines (146 loc) · 4.8 KB
/
Copy pathtest.yml
File metadata and controls
172 lines (146 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Cancel redundant runs on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GO_VERSION: "1.26.5"
# Restrict token permissions to minimum required
permissions:
contents: read
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
# v2.12+ ships a staticcheck that understands Go 1.26 control flow.
# v2.10's staticcheck mis-analyzed `if x == nil { t.Fatal() }` guards
# under GO_VERSION 1.26.4 and emitted false-positive SA5011 warnings.
version: v2.12
# Temporary workaround: config verification fetches the remote JSON schema and
# intermittently times out in CI before lint runs. Re-enable by 2026-04-01 once
# the schema fetch is reliable again; track in this PR/branch discussion.
verify: false
# Unit, E2E, integration, and contract suites share identical setup and
# differ only in the test command, so they run as one matrix.
go-tests:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: Unit Tests
cmd: make test-race
coverage: true
- name: E2E Tests
cmd: go test -v -tags=e2e -timeout=5m ./tests/e2e/...
- name: Integration Tests
cmd: go test -v -tags=integration -timeout=10m ./tests/integration/...
- name: Contract Replay Tests
cmd: go test -v -tags=contract -timeout=5m ./tests/contract/...
steps:
- uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Run tests
run: ${{ matrix.cmd }}
- name: Upload coverage
if: matrix.coverage
uses: codecov/codecov-action@v7
with:
files: ./coverage.out
fail_ci_if_error: false
continue-on-error: true
test-dashboard:
name: Dashboard Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: '22'
- name: Run dashboard JavaScript tests
run: make test-dashboard
performance:
name: Performance Guard
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Run hot-path performance guard
# Thresholds are maintained in tests/perf/hotpath_test.go.
run: make perf-check
vulncheck:
name: Vulnerability Scan
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache: true
# Scans the dependency graph against the Go vulnerability database,
# reporting only vulnerabilities reachable from our code. The second run
# covers the swagger-tagged production build (swagger_enabled.go), which
# the default tag set excludes. The tests/* suites behind e2e/integration/
# contract tags are deliberately skipped — they aren't in the shipped binary.
- name: Run govulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@v1.3.0
govulncheck ./...
govulncheck -tags=swagger ./...
docs-validate:
name: Docs Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# To avoid possible issues related to missing libsecret binary on the runner runner
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: '22'
- name: Validate docs.json
run: npx mint validate
working-directory: docs
# Compiling the binary doesn't depend on tests passing, so this runs in
# parallel with the test jobs rather than gating behind them.
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Verify module integrity
run: make mod-check
- name: Build
run: go build -v ./cmd/gomodel