Repository navigation
64 lines (55 loc) · 1.95 KB
/
Copy pathtest.yml
File metadata and controls
64 lines (55 loc) · 1.95 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
name: Tests
on: [push, pull_request]
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest # linux amd64
- ubuntu-24.04-arm # linux arm64
- windows-latest # windows amd64
- windows-11-arm # windows arm64
- macos-latest # darwin arm64
# darwin amd64 intentionally not covered here. The Intel macOS runner
# (macos-13) is deprecation-era scarce — runs queue indefinitely —
# and the shipped darwin/amd64 binary is cross-compiled from Linux by
# GoReleaser, so a native Intel CI run would test a configuration
# that isn't actually how the release is produced.
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: 'go.mod'
- name: Restore Go modules cache
uses: actions/cache@v6
with:
path: ~/go/pkg/mod
key: go-${{ runner.os }}-${{ hashFiles('go.mod') }}
restore-keys: |
go-${{ runner.os }}-
- name: Disable CGO on windows/arm64
# The windows-11-arm runner ships MinGW for x86_64 only, so any CGO build
# fails to assemble runtime/cgo's arm64 stubs. The released Windows ARM64
# binary is cross-compiled from Linux with CGO off — match that.
if: matrix.os == 'windows-11-arm'
shell: bash
run: echo "CGO_ENABLED=0" >> "$GITHUB_ENV"
- name: Download dependencies
run: go mod download
- name: Run tests
# Go's race detector is not supported on windows/arm64.
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-11-arm" ]; then
go test ./...
else
go test -race ./...
fi
- name: Build
run: go build -v ./cmd/vulncheck