Repository navigation
119 lines (113 loc) · 4.12 KB
/
Copy pathci.yml
File metadata and controls
119 lines (113 loc) · 4.12 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
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
# Build, vet, race-test, and enforce 100% coverage. The `ast` package is
# excluded from the gate: it holds only statement-free interface witnesses
# (empty marker methods), which the cover tool cannot attribute.
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.27.3'
- run: go version
- run: go vet ./...
- run: go build ./...
- name: Test + 100% coverage gate
shell: bash
run: |
COVERPKG=$(go list ./... | grep -v /ast | paste -sd, -)
go test -race -coverpkg="$COVERPKG" -coverprofile=cover.out ./...
go tool cover -func=cover.out | tail -n 25
"$GITHUB_WORKSPACE/.github/coverage-gate.sh" cover.out
# The parser is architecture-independent Go; the org still validates it on all
# six supported 64-bit targets. amd64/arm64 run natively, the rest under qemu.
arch-native:
name: arch ${{ matrix.label }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, label: amd64 }
- { os: ubuntu-24.04-arm, label: arm64 }
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.27.3'
- run: go env GOARCH && go test ./...
arch-qemu:
name: arch ${{ matrix.goarch }} (qemu)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { goarch: riscv64, qemu: qemu-riscv64-static }
- { goarch: loong64, qemu: qemu-loongarch64-static }
- { goarch: ppc64le, qemu: qemu-ppc64le-static }
- { goarch: s390x, qemu: qemu-s390x-static }
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.27.3'
# ⛔ `qemu-user-static` is a VIRTUAL package on Ubuntu 26.04, which
# `ubuntu-latest` became on 2026-10-19, and apt refuses to choose between its
# two providers:
#
# E: Package 'qemu-user-static' has no installation candidate
#
# ⚠ Installing a provider is NOT the fix: `qemu-user-binfmt` registers binfmt
# handlers, it does not ship the `qemu-<arch>-static` binaries this lane
# invokes. `qemu-user` ships the dynamic `qemu-<arch>`, which is all that
# `go test -exec` needs, so both are installed and BOTH NAMES are accepted
# below. go-tex/engine#645 has the full account.
- name: install qemu user-mode emulators
timeout-minutes: 10
run: sudo apt-get update && sudo apt-get install -y qemu-user qemu-user-binfmt
- name: Test under qemu (${{ matrix.goarch }})
run: |
base="${{ matrix.qemu }}"
q=""
for cand in "$base" "${base%-static}"; do
command -v "$cand" >/dev/null 2>&1 && q="$cand" && break
done
# ⛔ A missing emulator FAILS this lane. A lane that reports success for
# an architecture it never ran is the one outcome this matrix exists to
# rule out.
if [ -z "$q" ]; then
echo "::error::no qemu user emulator for ${{ matrix.goarch }} (looked for $base and ${base%-static})"
exit 1
fi
# Printed on purpose: without it, "ran under emulation" and "skipped" are
# indistinguishable from a green tick.
echo "running ${{ matrix.goarch }} under $q"
GOARCH=${{ matrix.goarch }} go test -exec="$q" ./...
wasm:
name: wasm (${{ matrix.goos }}/wasm)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
goos: [js, wasip1]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: '1.27.3'
- name: Build ${{ matrix.goos }}/wasm
run: GOOS=${{ matrix.goos }} GOARCH=wasm go build ./...