-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (73 loc) · 2.1 KB
/
test.yml
File metadata and controls
84 lines (73 loc) · 2.1 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
73
74
75
76
77
78
79
80
81
82
83
84
# CI for go-sdk
#
# Action pinning strategy:
# - First-party `actions/*` actions are pinned to a major version tag
# (e.g. `@v4`). GitHub maintains these and rotates the tag forward
# within the major version for security fixes.
# - Third-party actions (none currently used) MUST be pinned to a full
# commit SHA with a `# vX.Y.Z` trailing comment.
#
# Go version matrix is derived from the `go` directive in go.mod
# (floor) and the latest stable release published by the Go team.
name: test
on:
push:
branches: [main]
paths-ignore:
- "**.md"
- "docs/**"
- "LICENSE"
- ".gitignore"
- ".editorconfig"
pull_request:
branches: [main]
paths-ignore:
- "**.md"
- "docs/**"
- "LICENSE"
- ".gitignore"
- ".editorconfig"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
test:
name: test (go ${{ matrix.go }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Floor: `go` directive from go.mod (1.25.x). Ceiling: latest stable.
go: ["1.25.x", "stable"]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
cache: true
- name: Download modules
run: go mod download
- name: go vet
run: go vet ./...
- name: gofmt drift check
run: gofmt -l . | tee /dev/stderr | (! read -r)
- name: Build
run: go build ./...
- name: Test (race)
run: go test -v -race ./... 2>&1 | tee test-output.txt
shell: bash
- name: Upload test output on failure
if: failure() && hashFiles('test-output.txt') != ''
uses: actions/upload-artifact@v7
with:
name: test-output-go-${{ matrix.go }}
path: test-output.txt
retention-days: 7
if-no-files-found: ignore