-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (37 loc) · 1.09 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Test
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
env:
# Upload coverage only for this go version.
LATEST_GO_VERSION: "1.21"
jobs:
test:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
go: ["1.18", "1.19", "1.20", "1.21"]
name: ${{ matrix.os }} & Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Test
shell: bash
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic $(go list ./... | grep -v /examples)
- name: Upload coverage
if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: "coverage.out"
force-coverage-parser: "go"