...
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: Checkout repository
16 uses: actions/checkout@v4
17 with:
18 fetch-depth: 0
19
20 - name: Setup go
21 uses: actions/setup-go@v5
22 with:
23 go-version-file: go.mod
24 check-latest: true
25 - name: Setup golangci-lint
26 uses: golangci/golangci-lint-action@v5
27 with:
28 args: --verbose
29 test:
30 strategy:
31 matrix:
32 os: [ubuntu-latest]
33 go: [1.18, 1.19, "1.20", 1.21, 1.22]
34 include:
35 - os: ubuntu-latest
36 go-build: ~/.cache/go-build
37 - os: macos-latest
38 go-build: ~/Library/Caches/go-build
39 name: ${{ matrix.os }} @ Go ${{ matrix.go }}
40 runs-on: ${{ matrix.os }}
41 env:
42 GO111MODULE: on
43 GOPROXY: https://proxy.golang.org
44 steps:
45 - name: Set up Go ${{ matrix.go }}
46 uses: actions/setup-go@v5
47 with:
48 go-version: ${{ matrix.go }}
49
50 - name: Checkout Code
51 uses: actions/checkout@v4
52 with:
53 ref: ${{ github.ref }}
54
55 - uses: actions/cache@v4
56 with:
57 path: |
58 ${{ matrix.go-build }}
59 ~/go/pkg/mod
60 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
61 restore-keys: |
62 ${{ runner.os }}-go-
63 - name: Run Tests
64 run: |
65 go test -v -covermode=atomic -coverprofile=coverage.out
66
67 - name: Upload coverage to Codecov
68 uses: codecov/codecov-action@v4
69 with:
70 flags: ${{ matrix.os }},go-${{ matrix.go }}
View as plain text