-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (124 loc) · 5.21 KB
/
Copy pathci.yml
File metadata and controls
129 lines (124 loc) · 5.21 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# Full test suite on the three platforms consumers actually use, across the
# two most recent Go releases so a regression on either line surfaces.
test:
name: test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['1.25.x', '1.26.x']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
with:
go-version: ${{ matrix.go }}
- name: go test ./...
run: go test -count=1 -timeout 5m ./...
# Race-detector pass — linux/amd64 only; the compression logic is
# platform-independent Go.
race:
name: race
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: go test -race
run: go test -race -count=1 -timeout 10m ./...
# Static analysis on az's own code (the root package + ./cmd/az). The vendored
# internal/ codecs (pierrec/lz4, klauspost/compress) are upstream forks and are
# excluded — matches .golangci.yml and the justfile lint recipes.
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
with:
# Lint tools are dev tools and track the newest Go line: the pinned
# gopls/modernize requires Go >= 1.26 to build. setup-go pins
# GOTOOLCHAIN=local, so it cannot fetch a newer toolchain on demand
# the way a developer's default GOTOOLCHAIN=auto would — the job has
# to start on 1.26. az itself still builds and tests on 1.25 (go.mod)
# and the test matrix proves it.
go-version: '1.26.x'
- name: go vet
# vet runs over the whole module (it's clean on the vendored internal/
# trees); the stricter linters below stay scoped to az's own code.
run: go vet ./...
- name: gofmt -d
run: |
out=$(gofmt -d $(find . -name '*.go' -not -path './.*/*' -not -path './internal/*'))
if [ -n "$out" ]; then echo "$out"; exit 1; fi
# Tool versions below are pinned to the same ones the justfile runs, so a
# green `just lint` locally means a green lint job here. Bump both together.
- name: staticcheck
# `go run` a pinned version rather than the staticcheck action, which
# still runs on the deprecated Node.js 20 runtime.
run: go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 . ./azhttp/... ./cmd/... ./examples/...
- name: golangci-lint
# v9 of the action defaults to golangci-lint v2.x, which the config
# (version: "2") is written against; pin a v2 release explicitly so a
# future action revision can't silently downgrade us to v1.
uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2
args: --timeout 5m
- name: gopls modernize
# Surfaces Go-version-bump idioms (min/max, range-over-int, WaitGroup.Go,
# …); scoped to az's own packages. Exits non-zero when it finds any —
# the previous version of this step piped the output through `grep -v`
# and `|| true`, which swallowed both findings and tool failures.
run: go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.23.0 . ./azhttp/... ./cmd/... ./examples/...
- name: go.mod tidy
run: |
cp go.mod go.mod.bak
go mod tidy
cmp -s go.mod go.mod.bak || { echo "go.mod not tidy — run: just tidy"; exit 1; }
- name: no external dependencies
# az is dependency-free by design (the codecs are vendored under
# internal/); a stray `go get` must not slip past review.
run: |
extra=$(go list -m all | grep -v '^github.com/go-again/az$' || true)
if [ -n "$extra" ]; then echo "unexpected dependencies:"; echo "$extra"; exit 1; fi
# Cross-build every GOOS/GOARCH we claim to support (compile-only) so a
# platform-specific break in the vendored asm fallbacks surfaces without
# needing the test runtime there. Pure Go, so CGO is off.
build_all_targets:
name: build (${{ matrix.goos }}/${{ matrix.goarch }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { goos: darwin, goarch: amd64 }
- { goos: darwin, goarch: arm64 }
- { goos: freebsd, goarch: amd64 }
- { goos: freebsd, goarch: arm64 }
- { goos: linux, goarch: 386 }
- { goos: linux, goarch: amd64 }
- { goos: linux, goarch: arm }
- { goos: linux, goarch: arm64 }
- { goos: linux, goarch: loong64 }
- { goos: linux, goarch: ppc64le }
- { goos: linux, goarch: riscv64 }
- { goos: linux, goarch: s390x }
- { goos: windows, goarch: 386 }
- { goos: windows, goarch: amd64 }
- { goos: windows, goarch: arm64 }
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/setup
- name: cross build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: '0'
run: go build ./...