...
1name: testing
2
3on:
4 push:
5 branches: ['master']
6 pull_request:
7 branches: ['master']
8
9permissions:
10 contents: read
11
12jobs:
13 test:
14 strategy:
15 fail-fast: true
16 matrix:
17 os: [ubuntu-latest, macos-latest]
18 go: [
19 '1.18',
20 '1.19',
21 '1.20',
22 '1.21',
23 ]
24 include:
25 # Set the minimum Go patch version for the given Go minor
26 - go: '1.18'
27 GO_VERSION: '~1.18.0'
28 - go: '1.19'
29 GO_VERSION: '~1.19.0'
30 - go: '1.20'
31 GO_VERSION: '~1.20.0'
32 - go: '1.21'
33 GO_VERSION: '~1.21.0'
34 runs-on: ${{ matrix.os }}
35
36 steps:
37 - name: Set up Go ${{ matrix.go }}
38 uses: actions/setup-go@v3
39 with:
40 go-version: ${{ matrix.GO_VERSION }}
41 check-latest: true
42
43 - name: Print environment
44 id: vars
45 run: |
46 printf "Using Go at $(which go) (version $(go version))\n"
47 printf "\n\nGo environment:\n\n"
48 go env
49 printf "\n\nSystem environment:\n\n"
50 env
51
52 - name: Cache the build cache
53 uses: actions/cache@v3
54 with:
55 path: |
56 ~/go/pkg/mod
57 ~/.cache/go-build
58 key: build-go-${{ matrix.go }}-${{ matrix.os }}-${{ hashFiles('**/go.sum') }}
59 restore-keys: |
60 build-go-${{ matrix.go }}-${{ matrix.os }}
61
62 - name: Check out the source code
63 uses: actions/checkout@v3
64
65 - name: Run tests
66 run: GO_ARGS="-v -race -covermode=atomic -coverprofile=coverage.out" make tests
67
68 - name: Upload coverage
69 uses: codecov/codecov-action@v3
70 if: github.ref == 'refs/heads/master'
71 with:
72 token: ${{ secrets.CODECOV_TOKEN }}
73 fail_ci_if_error: true
74 verbose: true
View as plain text