Repository navigation
60 lines (59 loc) · 2.14 KB
/
Copy pathtest.yml
File metadata and controls
60 lines (59 loc) · 2.14 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
60
name: Tests
on: [push, pull_request]
jobs:
test:
strategy:
# One platform failing must not cancel the others. With the default
# (fail-fast: true) a flake on the first runner to go red hides every
# other platform's result, which is exactly when the cross-platform
# matrix is most worth having.
fail-fast: false
matrix:
# Current stable Go on every platform: recent macOS dyld rejects
# binaries built by pre-1.22 toolchains (missing LC_UUID), so the
# EOL go.mod minimum can't run there. One Linux job stays on the
# go.mod minimum to keep validating it.
include:
- os: ubuntu-latest # Linux x86_64
go: 'stable'
- os: ubuntu-latest # Linux x86_64, go.mod minimum version
go: '1.21'
- os: ubuntu-24.04-arm # Linux ARM64
go: 'stable'
- os: macos-latest # macOS ARM64
go: 'stable'
- os: windows-latest # Windows x86_64
go: 'stable'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- run: go test -race ./... -timeout=120s
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
# Pinned minor (unlike the test matrix's 'stable') so gofmt output
# can't change under us — a new Go's gofmt would otherwise break
# lint nondeterministically, like the 1.19 doc-comment reformat.
go-version: '1.24.x'
- run: go vet ./...
- name: gofmt
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "gofmt required for:" && echo "$unformatted"
exit 1
fi
- name: staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@v0.7.0
staticcheck ./...
- name: gosec
run: |
go install github.com/securego/gosec/v2/cmd/gosec@v2.27.1
gosec -exclude=G104,G112,G114,G115,G204,G304,G504,G702,G703 ./...