-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (63 loc) · 2.19 KB
/
Copy pathgo-test.yml
File metadata and controls
72 lines (63 loc) · 2.19 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
61
62
63
64
65
66
67
68
69
70
71
72
name: Go Tests
on:
pull_request:
branches: [main, master, develop]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- '.github/workflows/go-test.yml'
push:
branches: [main, master]
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- '.github/workflows/go-test.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: ${{ matrix.os }} / Go ${{ matrix.go-version }}
strategy:
# Don't cancel the rest when one platform fails — we want full
# cross-platform coverage on every run.
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [''] # use .go-version file
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: '.go-version'
- name: Cache Go modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Go vet
run: go vet ./...
- name: Build
run: go build ./...
- name: Test (with race detector)
# -race only works on amd64/arm64 platforms Go supports — all three
# runners qualify. Race detector roughly halves throughput but
# catches concurrency bugs we can't catch otherwise.
#
# tests/integration/ is excluded from CI: the Windows-only files in
# there have multiple pre-existing bugs (strings.Repeat with
# negative count panics on the long-path test, architecture cross-
# build assumptions, error-message assertions that don't match
# actual binary output). Tracked separately from production-code
# quality. Run them locally on Windows when working on those tests.
run: go test -race -count=1 $(go list ./... | grep -v /tests/integration)
shell: bash