| 1 | on: [push, pull_request] |
| 2 | name: Test |
| 3 | jobs: |
| 4 | test: |
| 5 | strategy: |
| 6 | matrix: |
| 7 | go-version: [1.18.x, 1.x] |
| 8 | os: [ubuntu-latest] |
| 9 | arch: ["", "386"] |
| 10 | fail-fast: false |
| 11 | runs-on: ${{ matrix.os }} |
| 12 | steps: |
| 13 | - name: Install Go |
| 14 | uses: actions/setup-go@v4 |
| 15 | with: |
| 16 | go-version: ${{ matrix.go-version }} |
| 17 | - name: Checkout code |
| 18 | uses: actions/checkout@v4 |
| 19 | - name: Check formatting |
| 20 | run: diff -u <(echo -n) <(gofmt -d .) |
| 21 | if: runner.os != 'Windows' |
| 22 | - name: Run go vet |
| 23 | env: |
| 24 | GOARCH: ${{ matrix.arch }} |
| 25 | run: go vet ./... |
| 26 | - name: Run staticcheck |
| 27 | uses: dominikh/[email protected] |
| 28 | with: |
| 29 | version: "2023.1.6" |
| 30 | install-go: false |
| 31 | cache-key: ${{ matrix.go-version }} |
| 32 | if: ${{ matrix.go-version == '1.x' }} |
| 33 | - name: Run tests |
| 34 | env: |
| 35 | GOARCH: ${{ matrix.arch }} |
| 36 | run: go test -vet=off ./... |