...
1name: Run Tests
2
3on:
4 push:
5 branches:
6 - master
7 pull_request:
8 branches:
9 - master
10
11permissions:
12 contents: read
13
14jobs:
15 lint:
16 runs-on: ubuntu-latest
17 steps:
18 - name: Setup go
19 uses: actions/setup-go@v4
20 with:
21 go-version: '^1.18'
22 - name: Checkout repository
23 uses: actions/checkout@v3
24 - name: Setup golangci-lint
25 uses: golangci/golangci-lint-action@v3.4.0
26 with:
27 version: v1.52.2
28 args: --verbose
29 test:
30 needs: lint
31 strategy:
32 matrix:
33 os: [ubuntu-latest, macos-latest]
34 go: ['1.18', '1.19', '1.20']
35 test-tags: ['', '-tags nomsgpack', '-tags "sonic avx"', '-tags go_json']
36 include:
37 - os: ubuntu-latest
38 go-build: ~/.cache/go-build
39 - os: macos-latest
40 go-build: ~/Library/Caches/go-build
41 name: ${{ matrix.os }} @ Go ${{ matrix.go }} ${{ matrix.test-tags }}
42 runs-on: ${{ matrix.os }}
43 env:
44 GO111MODULE: on
45 TESTTAGS: ${{ matrix.test-tags }}
46 GOPROXY: https://proxy.golang.org
47 steps:
48 - name: Set up Go ${{ matrix.go }}
49 uses: actions/setup-go@v4
50 with:
51 go-version: ${{ matrix.go }}
52
53 - name: Checkout Code
54 uses: actions/checkout@v3
55 with:
56 ref: ${{ github.ref }}
57
58 - uses: actions/cache@v3
59 with:
60 path: |
61 ${{ matrix.go-build }}
62 ~/go/pkg/mod
63 key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
64 restore-keys: |
65 ${{ runner.os }}-go-
66
67 - name: Run Tests
68 run: make test
69
70 - name: Upload coverage to Codecov
71 uses: codecov/codecov-action@v3
72 with:
73 flags: ${{ matrix.os }},go-${{ matrix.go }},${{ matrix.test-tags }}
74
75 - name: Format
76 if: matrix.go-version == '1.20.x'
77 run: diff -u <(echo -n) <(gofmt -d .)
View as plain text