|
| 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 ./... |
0 commit comments