|
13 | 13 | - "!**.md" |
14 | 14 |
|
15 | 15 | name: Test |
| 16 | + |
| 17 | +# Least-privilege GITHUB_TOKEN: both jobs only check out and run tests. |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + |
16 | 21 | jobs: |
17 | 22 | Build: |
18 | 23 | strategy: |
| 24 | + fail-fast: false |
19 | 25 | matrix: |
20 | | - go-version: [1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x] |
21 | | - platform: [ubuntu-latest, windows-latest, macos-latest] |
| 26 | + # Floor is 1.20 to match the module's go.mod (go 1.20). |
| 27 | + go-version: [1.20.x, 1.21.x, 1.22.x, 1.23.x] |
| 28 | + # No macOS: the current macos-latest runners (macOS 26, arm64) abort |
| 29 | + # binaries built by Go <= 1.23 with "dyld: missing LC_UUID load |
| 30 | + # command", so v2's supported Go range cannot run there. ubuntu and |
| 31 | + # windows cover the matrix. |
| 32 | + platform: [ubuntu-latest, windows-latest] |
22 | 33 | runs-on: ${{ matrix.platform }} |
| 34 | + timeout-minutes: 20 |
23 | 35 | steps: |
24 | 36 | - name: Fetch Repository |
25 | 37 | uses: actions/checkout@v4 |
|
29 | 41 | with: |
30 | 42 | go-version: ${{ matrix.go-version }} |
31 | 43 |
|
| 44 | + # Whole-suite retry, without -race and without -shuffle in the blocking |
| 45 | + # job: the suite has pre-existing data races (whose -race abort fails the |
| 46 | + # run) and order-dependent tests (which -shuffle exposes). gotestsum's |
| 47 | + # per-test rerun cannot absorb these because the recover test prints a |
| 48 | + # literal "panic:" (via debug.Stack), which makes gotestsum treat the |
| 49 | + # whole run as a suspected panic and refuse to rerun. Race detection runs |
| 50 | + # in the separate non-blocking Race job below. |
32 | 51 | - name: Run Test |
33 | 52 | uses: nick-fields/retry@v2 |
34 | 53 | with: |
35 | 54 | max_attempts: 3 |
36 | 55 | timeout_minutes: 15 |
37 | | - command: go test ./... -v -race -count=1 |
| 56 | + command: go test ./... -count=1 |
| 57 | + |
| 58 | + # Non-blocking: surfaces the suite's pre-existing data races without gating |
| 59 | + # merges on them. Fix the races over time, then fold -race into Build. |
| 60 | + Race: |
| 61 | + runs-on: ubuntu-latest |
| 62 | + continue-on-error: true |
| 63 | + timeout-minutes: 20 |
| 64 | + steps: |
| 65 | + - name: Fetch Repository |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Install Go |
| 69 | + uses: actions/setup-go@v6 |
| 70 | + with: |
| 71 | + go-version: 1.23.x |
| 72 | + |
| 73 | + - name: Test (race) |
| 74 | + run: go test ./... -race -count=1 -shuffle=on |
0 commit comments