-
Notifications
You must be signed in to change notification settings - Fork 250
59 lines (59 loc) · 1.96 KB
/
test.yml
File metadata and controls
59 lines (59 loc) · 1.96 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Test
on:
push:
branches:
- master
- release/**
pull_request:
permissions:
contents: read
defaults:
run:
shell: bash
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Module Mode
runs-on: ${{ matrix.os }}-latest
env:
GO111MODULE: "on"
GOFLAGS: "-mod=readonly"
# The race detector adds considerable runtime overhead. To save time on
# pull requests, only run this step for a single job in the matrix. For
# all other workflow triggers (e.g., pushes to a release branch) run
# this step for the whole matrix.
RUN_RACE_TESTS: ${{ github.event_name != 'pull_request' || (matrix.go == '1.26' && matrix.os == 'ubuntu') }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: ${{ matrix.go }}
cache-dependency-path: '**/go.sum'
- name: Tidy
run: make mod-tidy
if: ${{ matrix.go == '1.26' }}
- name: Build
run: make build
- name: Vet
run: make vet
- name: Test${{ env.RUN_RACE_TESTS == 'true' && ' (with race detection)' || '' }}
run: |
if [ "${{ matrix.os }}" = "ubuntu" ] && [ "${{ matrix.go }}" = "1.26" ]; then
${{ env.RUN_RACE_TESTS == 'true' && 'make test-race-coverage' || 'make test-coverage' }}
else
${{ env.RUN_RACE_TESTS == 'true' && 'make test-race' || 'make test' }}
fi
- name: Upload coverage to Codecov
if: ${{ matrix.os == 'ubuntu' && matrix.go == '1.26' }}
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # pin@v6.0.0
with:
directory: .coverage
token: ${{ secrets.CODECOV_TOKEN }}
timeout-minutes: 15
strategy:
matrix:
go: ["1.26", "1.25"]
os: [ubuntu, windows, macos]
fail-fast: false