...
1name: Run Tests
2
3on:
4 push:
5 branches:
6 - master
7 pull_request:
8 branches:
9 - master
10
11jobs:
12 lint:
13 runs-on: ubuntu-latest
14 steps:
15 - name: Setup go
16 uses: actions/setup-go@v3
17 with:
18 go-version: '^1.16'
19 - name: Checkout repository
20 uses: actions/checkout@v3
21 - name: Setup golangci-lint
22 uses: golangci/golangci-lint-action@v3
23 with:
24 version: v1.45.0
25 args: --verbose
26 test:
27 strategy:
28 matrix:
29 os: [ubuntu-latest]
30 go: [1.14, 1.15, 1.16, 1.17, 1.18]
31 include:
32 - os: ubuntu-latest
33 go-build: ~/.cache/go-build
34 - os: macos-latest
35 go-build: ~/Library/Caches/go-build
36 name: ${{ matrix.os }} @ Go ${{ matrix.go }}
37 runs-on: ${{ matrix.os }}
38 env:
39 GO111MODULE: on
40 GOPROXY: https://proxy.golang.org
41 steps:
42 - name: Set up Go ${{ matrix.go }}
43 uses: actions/setup-go@v3
44 with:
45 go-version: ${{ matrix.go }}
46
47 - name: Checkout Code
48 uses: actions/checkout@v3
49 with:
50 ref: ${{ github.ref }}
51
52 - uses: actions/cache@v3
53 with:
54 path: |
55 ${{ matrix.go-build }}
56 ~/go/pkg/mod
57 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
58 restore-keys: |
59 ${{ runner.os }}-go-
60 - name: Run Tests
61 run: |
62 go test -v -covermode=atomic -coverprofile=coverage.out
63
64 - name: Upload coverage to Codecov
65 uses: codecov/codecov-action@v3
66 with:
67 flags: ${{ matrix.os }},go-${{ matrix.go }}
View as plain text