Skip to content

Commit 5cef0ad

Browse files
authored
Merge pull request #9 from gosuda/ci/go-verification
ci: run Go regression and security gates on Linux and macOS
2 parents 81dc93b + 96c11fc commit 5cef0ad

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Go verification
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: go-verification-${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
tests:
18+
name: Race and integration (${{ matrix.os }})
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os: [ubuntu-latest, macos-latest]
23+
runs-on: ${{ matrix.os }}
24+
timeout-minutes: 15
25+
steps:
26+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27+
with:
28+
persist-credentials: false
29+
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
30+
with:
31+
go-version-file: go.mod
32+
cache: false # Zero dependencies: no go.sum to key a cache.
33+
- name: Unit and race tests
34+
run: go test -race -shuffle=on -count=1 ./...
35+
- name: Loopback integration and race tests
36+
run: go test -race -tags integration -shuffle=on -count=1 ./...
37+
- name: NTS-KE parser fuzz smoke
38+
run: go test ./nts -run '^$' -fuzz '^FuzzReadServerResponse$' -fuzztime=5s -parallel=2
39+
40+
quality:
41+
name: Static checks and vulnerabilities
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 20
44+
steps:
45+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
46+
with:
47+
fetch-depth: 0
48+
persist-credentials: false
49+
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
50+
with:
51+
go-version-file: go.mod
52+
cache: false
53+
- name: Formatting and module hygiene
54+
shell: bash
55+
run: |
56+
files=$(gofmt -l .)
57+
if [[ -n "$files" ]]; then
58+
printf '%s\n' "$files"
59+
exit 1
60+
fi
61+
go mod tidy
62+
git diff --exit-code
63+
test -z "$(git status --porcelain)"
64+
- name: Vet both build profiles
65+
run: |
66+
go vet ./...
67+
go vet -tags integration ./...
68+
- name: Baseline-aware lint
69+
# Frozen pre-fix main baseline: three pre-existing ineffectual assignments
70+
# in clock/public.go and internal/siv/aes_gcm_siv.go are not introduced here.
71+
run: go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.2 run --no-config --default=none --enable=govet --enable=ineffassign --build-tags=integration --new-from-rev=5b4826e5c712e77f947d73e69f24b940ac3ad4f9 ./...
72+
- name: Reachable vulnerability scan
73+
run: go run golang.org/x/vuln/cmd/govulncheck@v1.7.0 -tags integration ./...

docs/verification.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Verification gates
2+
3+
The Go verification workflow runs on pull requests, pushes to `main`, and manual dispatch. It uses read-only repository permissions, commit-pinned actions, and no persisted checkout credentials.
4+
5+
## Executed checks
6+
7+
- Linux and macOS: regular and `integration` profiles with race detection and shuffled test order.
8+
- Both platforms: a five-second NTS-KE parser fuzz smoke test. This is bounded smoke coverage, not exhaustive fuzzing.
9+
- Linux: gofmt, `go mod tidy` with clean-tree verification, vet in both profiles, reachable vulnerability scanning, and baseline-aware govet/ineffassign lint.
10+
11+
Go is read from `go.mod`. Tool versions are pinned in the workflow; update them deliberately. Module caching is disabled because this zero-dependency repository does not contain `go.sum`.
12+
13+
## Lint baseline
14+
15+
Lint reports new findings relative to `5b4826e5c712e77f947d73e69f24b940ac3ad4f9`, the pre-fix `main` revision. Three pre-existing ineffectual assignments (one in `clock/public.go`, two in `internal/siv/aes_gcm_siv.go`) reproduce on that exact revision. The baseline is frozen rather than moved forward on each PR, so subsequently introduced findings remain visible. This gate does not claim those older warnings have been fixed, and is not a full linter suite.
16+
17+
## Limits and merge order
18+
19+
The integration tests use loopback TLS/UDP peers and simulated clocks, not public NTP/NTS servers or actual VM/suspend events. Passing tests do not prove hardware clock guarantees. Vulnerability results depend on the database available when the job runs.
20+
21+
This workflow PR is stacked on the assurance/NTS fixes in PR #7 because it invokes the new `FuzzReadServerResponse` target. Merge #7 first, then retarget this PR to `main`. No branch-protection changes are included; maintainers may require these checks separately.

0 commit comments

Comments
 (0)