|
1 | 1 | name: Go tests |
2 | | -on: [push, pull_request] |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + schedule: # daily at 09:42 UTC |
| 6 | + - cron: '42 9 * * *' |
| 7 | + workflow_dispatch: |
3 | 8 | permissions: |
4 | 9 | contents: read |
5 | 10 | jobs: |
6 | 11 | test: |
7 | | - name: Test |
8 | 12 | strategy: |
9 | 13 | fail-fast: false |
10 | 14 | matrix: |
11 | | - go: [1.19.x, 1.x] |
12 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
| 15 | + go: |
| 16 | + - { go-version: stable } |
| 17 | + - { go-version: oldstable } |
| 18 | + - { go-version-file: go.mod } |
| 19 | + os: |
| 20 | + - ubuntu-latest |
| 21 | + - macos-latest |
| 22 | + - windows-latest |
13 | 23 | runs-on: ${{ matrix.os }} |
14 | 24 | steps: |
15 | | - - name: Install Go ${{ matrix.go }} |
16 | | - uses: actions/setup-go@v5 |
17 | | - with: |
18 | | - go-version: ${{ matrix.go }} |
19 | | - - name: Checkout repository |
20 | | - uses: actions/checkout@v4 |
21 | | - with: |
22 | | - fetch-depth: 0 |
23 | | - - name: Run tests |
24 | | - run: go test -race ./... |
25 | | - gotip: |
26 | | - name: Test (Go tip) |
| 25 | + - uses: actions/checkout@v5 |
| 26 | + with: |
| 27 | + persist-credentials: false |
| 28 | + - uses: actions/setup-go@v6 |
| 29 | + with: |
| 30 | + go-version: ${{ matrix.go.go-version }} |
| 31 | + go-version-file: ${{ matrix.go.go-version-file }} |
| 32 | + - run: | |
| 33 | + go test -race ./... |
| 34 | + test-latest: |
| 35 | + runs-on: ubuntu-latest |
27 | 36 | strategy: |
28 | 37 | fail-fast: false |
29 | 38 | matrix: |
30 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
31 | | - runs-on: ${{ matrix.os }} |
| 39 | + go: |
| 40 | + - { go-version: stable } |
| 41 | + - { go-version: oldstable } |
| 42 | + - { go-version-file: go.mod } |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v5 |
| 45 | + with: |
| 46 | + persist-credentials: false |
| 47 | + - uses: actions/setup-go@v6 |
| 48 | + with: |
| 49 | + go-version: ${{ matrix.go.go-version }} |
| 50 | + go-version-file: ${{ matrix.go.go-version-file }} |
| 51 | + - uses: geomys/sandboxed-step@v1.2.1 |
| 52 | + with: |
| 53 | + run: | |
| 54 | + go get -u -t ./... |
| 55 | + go test -race ./... |
| 56 | + staticcheck: |
| 57 | + runs-on: ubuntu-latest |
32 | 58 | steps: |
33 | | - - name: Install bootstrap Go |
34 | | - uses: actions/setup-go@v5 |
| 59 | + - uses: actions/checkout@v5 |
| 60 | + with: |
| 61 | + persist-credentials: false |
| 62 | + - uses: actions/setup-go@v6 |
35 | 63 | with: |
36 | 64 | go-version: stable |
37 | | - - name: Install Go tip (UNIX) |
38 | | - if: runner.os != 'Windows' |
39 | | - run: | |
40 | | - git clone --filter=tree:0 https://go.googlesource.com/go $HOME/gotip |
41 | | - cd $HOME/gotip/src && ./make.bash |
42 | | - echo "$HOME/gotip/bin" >> $GITHUB_PATH |
43 | | - - name: Install Go tip (Windows) |
44 | | - if: runner.os == 'Windows' |
45 | | - run: | |
46 | | - git clone --filter=tree:0 https://go.googlesource.com/go $HOME/gotip |
47 | | - cd $HOME/gotip/src && ./make.bat |
48 | | - echo "$HOME/gotip/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
49 | | - - name: Checkout repository |
50 | | - uses: actions/checkout@v4 |
51 | | - with: |
52 | | - fetch-depth: 0 |
53 | | - - run: go version |
54 | | - - name: Run tests |
55 | | - run: go test -race ./... |
| 65 | + - uses: geomys/sandboxed-step@v1.2.1 |
| 66 | + with: |
| 67 | + run: go run honnef.co/go/tools/cmd/staticcheck@latest ./... |
| 68 | + govulncheck: |
| 69 | + runs-on: ubuntu-latest |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v5 |
| 72 | + with: |
| 73 | + persist-credentials: false |
| 74 | + - uses: actions/setup-go@v6 |
| 75 | + with: |
| 76 | + go-version: stable |
| 77 | + - uses: geomys/sandboxed-step@v1.2.1 |
| 78 | + with: |
| 79 | + run: go run golang.org/x/vuln/cmd/govulncheck@latest ./... |
0 commit comments