Repository navigation
357 lines (338 loc) · 17.5 KB
/
Copy pathci.yml
File metadata and controls
357 lines (338 loc) · 17.5 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
name: CI
on:
# Three tiers. Every change reaches dev through the merge queue and master
# through a release pull request:
# • PR -> dev : CHEAP (Linux gcc debug + the suite, Linux gcc release
# + library builds, the docs). It gates entry to the
# queue; the queue re-tests the combination.
# • merge group : QUEUE, on the queue's speculative branch (dev + the
# pull requests ahead + this one): CHEAP plus macOS
# debug, clang-current, gcc-12, tsan, a short
# fuzz-smoke and the advisory static-analysis. Built for wall time: one macOS job,
# every build on all cores.
# • PR -> master : RELEASE, everything: QUEUE plus macOS release,
# ndebug, the full-length fuzz-smoke and test-full:
# the gate before anything ships.
# The nightly workflow also runs ndebug and macOS release on dev.
# No push triggers here: a post-merge `push` run would only re-test what
# the queue validated. The one exception is macOS debug, which also runs
# on every push to dev (macos-dev.yml), since hosted macOS capacity can
# leave the queue's macOS leg without a runner.
pull_request:
branches: [master, dev]
merge_group:
types: [checks_requested]
# A new push to a PR supersedes its older run, so cancel that run instead of
# letting it hold runners (macOS slots especially). Keyed per PR; any other
# event gets a group of its own (ref + sha) and never cancels, so a commit
# that lands on a branch is not left untested. A merge group's ref is its
# own temporary branch (gh-readonly-queue/dev/pr-N-<sha>), so each group runs
# alone and the queue, not this block, cancels a group it abandons.
# Do not re-run a superseded run by hand: it rejoins this PR's group and
# cancels the head's run, whose ci-success then fails until it is re-run.
concurrency:
group: ci-${{ github.event.pull_request.number || format('{0}-{1}', github.ref, github.sha) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# Test tiers. A PR into dev and a merge group onto dev run `make test`: the
# dev-loop suite (DEBUG checks, no sanitizers, no equivalence pass or stress
# soak, all tests in parallel). A release PR into master runs `make
# test-full`: every test under ASan+UBSan -- the gate before anything ships.
#
# Which jobs run (each job's `if:` spells its condition, the env context is
# not available there):
# every event build-and-test (its matrix grows per tier), docs
# QUEUE and RELEASE clang-current, gcc-12, tsan, fuzz-smoke and the
# advisory static-analysis:
# github.event_name == 'merge_group' || github.base_ref == 'master'
# RELEASE only ndebug: github.base_ref == 'master'
env:
TEST_TIER: ${{ (github.base_ref == 'master' || github.event.merge_group.base_ref == 'refs/heads/master') && 'test-full' || 'test' }}
# Every build on the runner's cores (4 on Linux, 3 on macOS; one more job
# than cores keeps them busy across link steps). The suite already runs
# one worker per core (TEST_JOBS in the Makefile).
MAKEFLAGS: -j4
jobs:
# The Linux legs on every event; macOS debug on QUEUE and RELEASE (one
# macOS job per merge-group build: the hosted macOS concurrency is small);
# macOS release on RELEASE only. The matrix is chosen per event
# (fromJSON), so the job name and the steps stay the same. The queue's leg
# names are listed in .github/ci-success.sh (QUEUE_LEGS); change both
# together, or the macOS tolerance stops applying.
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(github.base_ref == 'master' && '[{"os":"ubuntu-latest","target":"debug","compiler":"gcc"},{"os":"ubuntu-latest","target":"release","compiler":"gcc"},{"os":"macos-latest","target":"debug","compiler":"clang"},{"os":"macos-latest","target":"release","compiler":"clang"}]' || (github.event_name == 'merge_group' && '[{"os":"ubuntu-latest","target":"debug","compiler":"gcc"},{"os":"ubuntu-latest","target":"release","compiler":"gcc"},{"os":"macos-latest","target":"debug","compiler":"clang"}]' || '[{"os":"ubuntu-latest","target":"debug","compiler":"gcc"},{"os":"ubuntu-latest","target":"release","compiler":"gcc"}]')) }}
steps:
- uses: actions/checkout@v4
# A comma-decimal locale, so the tests that read and print floats under
# it (format/locale/independent, format/json/locale) run, not SKIP.
- name: Install a comma-decimal locale
if: runner.os == 'Linux' && matrix.target == 'debug'
run: sudo locale-gen de_DE.UTF-8
- name: Build (${{ matrix.target }})
run: make ${{ matrix.target }} CC=${{ matrix.compiler }}
# The embedding archive has its own .lib.o flags: binary-only builds
# do not exercise codec strict-FP overrides in that profile.
- name: Build static library
if: matrix.target == 'release' && matrix.compiler == 'gcc'
run: make lib CC=${{ matrix.compiler }}
# The shared library is what a run-time host loads. Linking an example
# against it and running that proves the symbols are exported and the
# runtime starts from a library, which no other leg exercises.
- name: Build shared library and run an example against it
if: matrix.target == 'release'
run: |
make shared CC=${{ matrix.compiler }}
${{ matrix.compiler }} -O2 -Iinclude -Isrc examples/analytics.c -L. -lrayforce -lm -lpthread -Wl,-rpath,"$PWD" -o analytics-shared
./analytics-shared
# Debug legs execute the suite (tier: see TEST_TIER above); release legs
# verify optimized artifacts. Runtime tests under release FP flags use
# the separate `make test-release` profile, not the debug suite below.
- name: Test (${{ env.TEST_TIER }})
if: matrix.target == 'debug'
run: make ${{ env.TEST_TIER }} CC=${{ matrix.compiler }}
# A test that failed in a parallel worker leaves the list of tests that
# worker ran (`--replay FILE` reruns them in that order in one process).
- name: Upload test replay files
if: failure() && matrix.target == 'debug'
uses: actions/upload-artifact@v4
with:
name: test-replay-${{ matrix.os }}-${{ matrix.compiler }}
path: /tmp/rayforce_replay.*
if-no-files-found: ignore
# The default Ubuntu compiler is gcc. Exercise the suite with a recent
# upstream Clang as well, so new -Werror diagnostics reach CI before users
# of rolling-release toolchains encounter them.
clang-current:
if: github.event_name == 'merge_group' || github.base_ref == 'master'
runs-on: ubuntu-latest
env:
RAY_MARCH: x86-64
steps:
- uses: actions/checkout@v4
- name: Test release-note source boundaries (offline)
run: PYTHONDONTWRITEBYTECODE=1 python3 .github/test_release_notes.py -v
# The version is set in the action, which the release and nightly
# builds use too: one place to bump.
- name: Install the current Clang
uses: ./.github/actions/setup-clang-current
- name: Install a comma-decimal locale
run: sudo locale-gen de_DE.UTF-8
- name: Test with the current Clang (${{ env.TEST_TIER }})
run: make ${{ env.TEST_TIER }} CC="$CLANG_CURRENT"
- name: Upload test replay files
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-replay-clang-current
path: /tmp/rayforce_replay.*
if-no-files-found: ignore
# Build with gcc 12, the Debian 12 compiler. Its flow analysis raises
# -Werror false positives that the gcc and clang on the legs above do not
# (#1531: maybe-uninitialized, stringop-overflow), so a change can be green
# there and still not build with it. Build only: the suite runs above.
# Pinned to ubuntu-24.04, whose archive ships gcc-12; a later ubuntu-latest
# may not.
gcc-12:
if: github.event_name == 'merge_group' || github.base_ref == 'master'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# ubuntu-24.04's image ships gcc-12; install it only if it is gone.
- name: Install gcc 12 (if the image lacks it)
run: command -v gcc-12 || { sudo apt-get update && sudo apt-get install -y gcc-12; }
- name: Build release with gcc 12
run: make release CC=gcc-12
- name: Build shared library with gcc 12
run: make shared CC=gcc-12
# The suite with every assert() compiled out (-DNDEBUG). Our own builds keep
# asserts on, but CMake Release, distro packagers and `zig cc` define NDEBUG;
# work placed inside an assert then silently vanishes (#652: an NDEBUG build
# registered no builtins). This leg keeps the code correct either way.
# A whole sanitized suite: release PRs (into master) and the nightly only;
# not in the merge queue (about 29 min, it would set the queue's pace).
ndebug:
if: github.base_ref == 'master'
runs-on: ubuntu-latest
env:
# This leg tests assert removal, not hosted-CPU ISA autodetection.
# Match clang-current/fuzz: keep -Werror without native AVX10 conflicts.
RAY_MARCH: x86-64
steps:
- uses: actions/checkout@v4
- name: Install a comma-decimal locale
run: sudo locale-gen de_DE.UTF-8
- name: Test with NDEBUG
run: make test-ndebug
# Coverage-guided fuzz smoke pass over the untrusted-input decoders
# (parser, numeric scanners, wire-frame decoder) and the nested-select
# differential fuzzer. A healthy corpus finds nothing new in a minute, so
# any crash here is a genuine regression. Linux + clang only (the fuzzing
# runtime is not bundled on the macOS system toolchain).
# Most of this leg was the instrumented build, run serially (about 6 of
# its 12 minutes); it now builds on all cores, and the three smoke
# targets run side by side. In the merge queue each target fuzzes 20 s
# (FUZZ_SECS), from the cached corpus and the committed seeds, without
# the frame seeding that needs a debug server build, and the cache is
# only restored (a merge group's cache would be scoped to its throwaway
# ref). Release PRs keep 60 s per target, the seeding and the cache
# update; the nightly fuzzes each target for 15 minutes.
fuzz-smoke:
if: github.event_name == 'merge_group' || github.base_ref == 'master'
runs-on: ubuntu-latest
env:
# Hosted runner `-march=native` can expose transient CPU features that
# clang promotes to -Werror diagnostics; fuzzing does not need native ISA.
RAY_MARCH: x86-64
FUZZ_SECS: ${{ github.event_name == 'merge_group' && '20' || '60' }}
steps:
- uses: actions/checkout@v4
- name: Cache fuzz corpus
if: github.event_name != 'merge_group'
uses: actions/cache@v4
with:
path: fuzz/corpus
key: fuzz-corpus-${{ github.run_id }}
restore-keys: fuzz-corpus-
- name: Restore the fuzz corpus (merge queue)
if: github.event_name == 'merge_group'
uses: actions/cache/restore@v4
with:
path: fuzz/corpus
key: fuzz-corpus-${{ github.run_id }}
restore-keys: fuzz-corpus-
- name: Seed corpora
run: scripts/fuzz-seed-parse.sh
- name: Seed wire-frame corpora from a real server
if: github.event_name != 'merge_group'
run: |
make debug # fuzz-seed-frames.sh drives a real server
scripts/fuzz-seed-frames.sh || true
- name: Fuzz smoke (${{ env.FUZZ_SECS }} s per target, side by side)
run: make fuzz-parse fuzz-numparse fuzz-de FUZZ_RUNTIME="$FUZZ_SECS"
- name: Nested select differential fuzz (serial and parallel)
run: |
# Start each mode from committed seeds. Replaying the growing cache
# can exhaust the short run before it reaches any mutations.
corpus_root=$(mktemp -d "$RUNNER_TEMP/select-merge.XXXXXX")
make fuzz-select_merge FUZZ_RUNTIME="$FUZZ_SECS" FUZZ_CORPUS_ROOT="$corpus_root/serial"
RAY_FUZZ_CORES=4 make fuzz-select_merge FUZZ_RUNTIME="$FUZZ_SECS" FUZZ_CORPUS_ROOT="$corpus_root/parallel"
- name: Upload crash artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-crashes
path: |
crash-*
leak-*
timeout-*
oom-*
if-no-files-found: ignore
# ThreadSanitizer over the concurrency-sensitive suites (the lock-free
# pool/heap paths and the parallel operators). ASan and TSan are mutually
# exclusive, so this is a separate build flavour. TSAN_CORES=4 gives the
# work-stealing ring real contention to race against. Linux + clang only.
tsan:
if: github.event_name == 'merge_group' || github.base_ref == 'master'
runs-on: ubuntu-latest
env:
# Keep Clang off transient hosted-runner ISA features that become
# -Werror diagnostics before the TSan suites can run.
RAY_MARCH: x86-64
steps:
- uses: actions/checkout@v4
- name: TSan concurrency suites
run: |
for f in pool heap parallel stress store/parted_concurrent_mounts; do
echo "::group::tsan -f $f"
make tsan-test TSAN_FILTER=$f || exit 1
echo "::endgroup::"
done
# Static analysis — ADVISORY (continue-on-error): the correctness-only
# check sets currently surface only false positives (GNU computed-goto
# label addresses, caller-guaranteed non-null params, defensive
# redundant-null-check heuristics), so this reports without gating.
# cppcheck runs whole-tree here over one pinned configuration (see
# CPPCHECK_DEFS in the Makefile); the heavier clang-tidy pass
# (`make tidy`) runs locally and in the nightly workflow. Flip to a
# blocking gate once the baseline is annotated clean. The timeout keeps a
# regression in analysis time from holding a runner for hours.
# QUEUE and RELEASE: advisory (not in ci-success), about 2 min and in
# parallel, so it does not lengthen a merge-group build, and a new finding
# is seen when the change lands.
static-analysis:
if: github.event_name == 'merge_group' || github.base_ref == 'master'
runs-on: ubuntu-latest
continue-on-error: true
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install cppcheck
run: sudo apt-get update && sudo apt-get install -y cppcheck
- name: cppcheck
run: make cppcheck
# The docs build as the site builds it (pages.yml), strict, and the
# builtin reference check: about 25 s, so in the cheap tier.
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install MkDocs
run: pip install -r .github/requirements-docs.txt
- name: mkdocs build --strict
run: mkdocs build --strict
- name: Every builtin is in the reference
run: make docs-check
# Single stable check to require in branch protection and in the merge
# queue, instead of the brittle matrix names. It is reported on the pull
# request AND on the merge group (the queue waits for a required check on
# both), and its verdict depends on the tier:
# • build-and-test and docs must succeed on every tier;
# • clang-current, gcc-12, tsan, fuzz-smoke must succeed on QUEUE and
# RELEASE and be SKIPPED on CHEAP;
# • ndebug must succeed on RELEASE and be SKIPPED otherwise.
# A job skipped where its tier runs it fails the check: a job that should
# have run did not. `if: always()` makes this job run even when a needed
# job fails, and the explicit check fails it -- without that a failed need
# would SKIP this job, and a skipped required check counts as passed,
# silently opening the gate. static-analysis is advisory and not in
# `needs`. One tolerance, merge queue only: a macOS debug leg GitHub never
# gave a runner (see .github/ci-success.sh).
ci-success:
needs: [build-and-test, docs, clang-current, gcc-12, ndebug, fuzz-smoke, tsan]
if: always()
runs-on: ubuntu-latest
# actions: read for this run's jobs and checks: read for the macOS leg's
# check-run annotations (the one tolerance below); nothing else.
permissions:
actions: read
checks: read
contents: read
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: .github/ci-success.sh
sparse-checkout-cone-mode: false
# The verdict is .github/ci-success.sh, so it can be run and tested
# outside a workflow. In the merge queue only, it tolerates a macOS
# debug leg GitHub never gave a runner in any attempt of the run
# (cancelled after three acquisition attempts, about 15 minutes, with
# no step run and GitHub's not-acquired annotation); that leg runs on
# the push to dev (macos-dev.yml). Every other result fails as before.
- name: Verify the jobs this tier requires passed
env:
GH_TOKEN: ${{ github.token }}
TIER: ${{ github.event_name == 'merge_group' && 'queue' || (github.base_ref == 'master' && 'release' || 'cheap') }}
R_build_and_test: ${{ needs.build-and-test.result }}
R_docs: ${{ needs.docs.result }}
R_clang_current: ${{ needs.clang-current.result }}
R_gcc_12: ${{ needs.gcc-12.result }}
R_ndebug: ${{ needs.ndebug.result }}
R_fuzz_smoke: ${{ needs.fuzz-smoke.result }}
R_tsan: ${{ needs.tsan.result }}
run: bash .github/ci-success.sh