...
1on:
2 push:
3 pull_request:
4 types: [synchronize]
5name: Test
6jobs:
7 test:
8 strategy:
9 fail-fast: false
10 matrix:
11 go-version: [1.17.x, 1.18.x]
12 platform: [ubuntu-latest, macos-latest, windows-latest]
13 runs-on: ${{ matrix.platform }}
14 steps:
15 - name: Checkout code
16 uses: actions/checkout@v2
17 - name: Install Go
18 uses: actions/setup-go@v2
19 with:
20 go-version: ${{ matrix.go-version }}
21 - name: Fmt
22 if: matrix.platform != 'windows-latest' # :(
23 run: "diff <(gofmt -d .) <(printf '')"
24 shell: bash
25 - name: Vet
26 run: go vet ./...
27 - name: Staticcheck
28 uses: dominikh/staticcheck-action@v1
29 with:
30 install-go: false
31 cache-key: ${{ matrix.go-version }}
32 - name: Test
33 run: go test -race ./...
34 - name: Test coverage
35 run: go test -coverprofile="cover.out" ./... # quotes needed for powershell
36 - name: Send coverage
37 uses: shogo82148/actions-goveralls@v1
38 with:
39 path-to-profile: cover.out
40 flag-name: go${{ matrix.go-version }}-${{ matrix.os }}
41 parallel: true
42 # notifies that all test jobs are finished.
43 finish:
44 needs: test
45 runs-on: ubuntu-latest
46 steps:
47 - uses: shogo82148/actions-goveralls@v1
48 with:
49 parallel-finished: true
View as plain text