Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ on:
description: Run `go run . schema | json.tool` contract check
type: boolean
default: true
vuln-check:
description: >-
Run govulncheck against the module's known-vuln database. Escape hatch
for the rare case of an un-patchable transitive vuln; keep it on.
type: boolean
default: true

permissions:
contents: read
Expand All @@ -31,6 +37,17 @@ jobs:
with:
go-version: ${{ inputs.go-version }}
check-latest: true
- name: gofmt (must be clean)
# The house Go gate starts with `fmt`; CI fails on any non-gofmt'd file
# rather than silently reformatting it.
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "::error::these files are not gofmt-clean:"; echo "$unformatted"
exit 1
fi
- name: vet
run: go vet ./...
- name: lint
# Build golangci-lint with the repo's Go toolchain: prebuilt releases are
# built with an older Go and reject newer go.mod language versions.
Expand All @@ -40,6 +57,13 @@ jobs:
"$(go env GOPATH)/bin/golangci-lint" run
- name: test
run: go test -race -cover ./...
- name: govulncheck (known-vuln dependency + call-graph scan)
# Completes the documented house gate (fmt+vet+lint+test-race+govulncheck).
# Queries the live Go vuln DB; the pinned binary only fixes the analyzer.
if: ${{ inputs.vuln-check }}
run: |
go install golang.org/x/vuln/cmd/govulncheck@v1.1.4
"$(go env GOPATH)/bin/govulncheck" ./...
- name: schema contract (must emit valid JSON)
if: ${{ inputs.schema-check }}
run: go run . schema | python3 -m json.tool > /dev/null
Expand Down