...
1name: CI
2on: [push, pull_request]
3
4jobs:
5 build:
6 runs-on: ubuntu-latest
7 strategy:
8 matrix:
9 go: [ '1.19', '1.18' ]
10 name: Go ${{ matrix.go }} test
11 steps:
12 - name: Checkout repository
13 uses: actions/checkout@v3
14 - name: Cache Go modules
15 uses: actions/cache@v3
16 with:
17 path: |
18 ~/go/pkg/mod
19 ~/.cache/go-build
20 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
21 restore-keys: |
22 ${{ runner.os }}-go-
23 - name: Install Go stable version
24 uses: actions/setup-go@v3
25 with:
26 go-version: ${{ matrix.go }}
27 check-latest: true
28 - name: Test
29 run: go test -v -race ./...
30 - name: Upload code coverage to codecov
31 if: matrix.go == '1.19'
32 uses: codecov/codecov-action@v3
33 with:
34 file: ./coverage.out
35
View as plain text