Repository navigation
450 lines (431 loc) · 19.3 KB
/
Copy pathci.yml
File metadata and controls
450 lines (431 loc) · 19.3 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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
name: CI
# Automatic checks start once the repository is public.
on:
workflow_dispatch:
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
KACHE_KEY_ENV_VARS: CARGO_MANIFEST_DIR
jobs:
changes:
name: Classify changes
if: github.event_name == 'workflow_dispatch' || !github.event.repository.private
runs-on: ubuntu-26.04
permissions:
contents: read
pull-requests: read
outputs:
application: ${{ steps.scope.outputs.application }}
packages: ${{ steps.scope.outputs.packages }}
configuration: ${{ steps.scope.outputs.configuration }}
release_inputs: ${{ steps.paths.outputs.release_inputs }}
tag: ${{ steps.scope.outputs.tag }}
homebrew: ${{ steps.paths.outputs.homebrew }}
locale: ${{ steps.paths.outputs.locale }}
packages_repository: ${{ steps.paths.outputs.packages_repository }}
binstall: ${{ steps.paths.outputs.binstall }}
browser: ${{ steps.paths.outputs.browser }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 2
- name: Select affected checks
id: scope
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
if [ -n "$BASE_SHA" ]; then
git cat-file -e "$BASE_SHA^{commit}" || git fetch --no-tags --depth=1 origin "$BASE_SHA"
fi
bash .github/scripts/ci-scope.sh "$BASE_SHA" | tee "$GITHUB_OUTPUT"
version=$(sed -n 's/^version = "\([^"]*\)"$/\1/p' Cargo.toml | head -1)
echo "tag=v$version" >> "$GITHUB_OUTPUT"
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4
id: paths
with:
filters: |
browser:
- 'docs/**'
- 'ARCHITECTURE.md'
- 'GLOSSARY.md'
- 'TESTING.md'
- 'site/**'
- 'scripts/demo/**'
- 'scripts/build_site.sh'
- 'scripts/build_site.py'
- 'scripts/test_build_site.py'
- 'scripts/check_public_references.py'
- 'scripts/test_check_public_references.py'
- 'scripts/benchmark_chart.py'
- 'scripts/test_landing_page.mjs'
- 'scripts/test_docs.mjs'
- 'package.json'
- 'package-lock.json'
- 'wrangler.jsonc'
- '.github/workflows/ci.yml'
- '.github/workflows/docs.yml'
release_inputs:
- 'release/**'
- '.github/workflows/macos*.yml'
- '.github/workflows/windows*.yml'
- '.github/workflows/linux-release.yml'
- '.github/workflows/release.yml'
homebrew:
- '.github/workflows/homebrew.yml'
- 'packaging/homebrew/**'
binstall:
- '.github/workflows/cargo-binstall.yml'
locale:
- '.github/workflows/locale-reference.yml'
- 'tools/icu-exemplars/**'
- 'data/locales/collation-candidates.json'
- 'deny.toml'
packages_repository:
- '.github/workflows/package-repository*.yml'
- 'release/package-repository.sh'
- 'release/macos-archive.sh'
- 'packaging/linux-source-test.rs'
- 'packaging/fedora/**'
- 'release/publish-package-repository.sh'
- 'release/package-publication-fixtures.sh'
- 'release/test-package-publication.sh'
- 'release/test-package-repository.sh'
- 'release/check-installed.sh'
- 'crates/cli/tests/release_installation.rs'
- 'release/publication-test-server/**'
- 'packaging/conda-forge/**'
# Missing filter output runs the checks.
check:
name: Format and lint
needs: changes
if: >-
!cancelled() &&
(github.event_name == 'workflow_dispatch' ||
(!github.event.repository.private &&
(needs.changes.outputs.application != 'false' || needs.changes.outputs.packages != '' || needs.changes.outputs.configuration == 'true')))
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Check workflow selection
if: needs.changes.outputs.configuration == 'true'
run: |
bash -n .github/scripts/*.sh
bash .github/scripts/test-ci-scope.sh
- uses: dtolnay/rust-toolchain@df2a88e9fe4098bad09cb42c3dec7187f15861fc # master
if: needs.changes.outputs.configuration == 'true' || needs.changes.outputs.application != 'false' || needs.changes.outputs.packages != ''
with:
toolchain: stable
components: rustfmt, clippy
- uses: kunobi-ninja/kache-action@ad7317540dcdd71c904f7a60a87b620a0c0e67ed # v1
if: needs.changes.outputs.configuration == 'true' || needs.changes.outputs.application != 'false' || needs.changes.outputs.packages != ''
with:
version: v2.1.1
cache-key-prefix: kache-${{ github.job }}
cache-executables: true
pr-comment: false
- uses: taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 # v2
if: needs.changes.outputs.configuration == 'true' || needs.changes.outputs.application != 'false'
with:
tool: git-cliff@2.14.2
- name: Check release tooling
if: needs.changes.outputs.configuration == 'true' || needs.changes.outputs.application != 'false'
run: |
bash -n release/prepare-linux.sh release/build.sh release/train-pgo.sh release/check-crate-packages.sh release/publish-crates.sh release/changelog.sh
cargo fmt --manifest-path release/publication-test-server/Cargo.toml --check
cargo clippy --locked --manifest-path release/publication-test-server/Cargo.toml --target-dir target --bin fastmash-pgo-train --test pgo_training --test release_delivery --test ci_workflow -- -D warnings
cargo test --locked --manifest-path release/publication-test-server/Cargo.toml --target-dir target --test pgo_training --test release_delivery --test ci_workflow
- run: cargo fmt --all --check
if: needs.changes.outputs.application != 'false' || needs.changes.outputs.packages != ''
- name: Lint affected packages
if: needs.changes.outputs.application != 'false' || needs.changes.outputs.packages != ''
env:
APPLICATION: ${{ needs.changes.outputs.application }}
PACKAGES: ${{ needs.changes.outputs.packages }}
run: |
if [ "$APPLICATION" != false ]; then
cargo clippy --workspace --all-targets --locked -- -D warnings
else
for package in $PACKAGES; do
cargo clippy -p "$package" --all-targets --locked -- -D warnings
done
fi
test:
name: Test
needs: changes
if: >-
!cancelled() &&
(github.event_name == 'workflow_dispatch' ||
(!github.event.repository.private &&
(needs.changes.outputs.application != 'false' || needs.changes.outputs.packages != '')))
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@df2a88e9fe4098bad09cb42c3dec7187f15861fc # master
with:
toolchain: stable
targets: x86_64-unknown-linux-musl
- uses: kunobi-ninja/kache-action@ad7317540dcdd71c904f7a60a87b620a0c0e67ed # v1
with:
version: v2.1.1
cache-key-prefix: kache-${{ github.job }}
cache-executables: true
pr-comment: false
- name: Prepare installed verification tools
if: needs.changes.outputs.application != 'false' || contains(format(' {0} ', needs.changes.outputs.packages), ' fastmash ')
run: cargo build --locked --manifest-path release/publication-test-server/Cargo.toml --target-dir target --bins
- name: Test affected packages
env:
APPLICATION: ${{ needs.changes.outputs.application }}
PACKAGES: ${{ needs.changes.outputs.packages }}
run: |
if [ "$APPLICATION" != false ]; then
cargo test --release --workspace --locked
cargo build --release --workspace --locked
else
for package in $PACKAGES; do
if [ "$package" = fastmash ]; then
cargo build --release -p fastmash --locked
fi
cargo test --release -p "$package" --locked
done
fi
- name: Test static Linux target
if: needs.changes.outputs.application != 'false'
run: |
cargo test --release --workspace --locked --target x86_64-unknown-linux-musl
cargo build --release --workspace --locked --target x86_64-unknown-linux-musl
cargo clippy -p fastmash --all-targets --locked --target x86_64-unknown-linux-musl -- -D warnings
# Exercise the static delivery target with both corpus transports.
- name: Regression corpus
if: needs.changes.outputs.application != 'false'
run: |
version=$(sed -n 's/^version = "\([^"]*\)"$/\1/p' Cargo.toml | head -n 1)
target/release/fastmash-corpus --binary target/x86_64-unknown-linux-musl/release/fastmash --expected-version "$version" --keep-going --evidence-dir "$RUNNER_TEMP/corpus/pipe"
target/release/fastmash-corpus --binary target/x86_64-unknown-linux-musl/release/fastmash --expected-version "$version" --stdin-file --keep-going --evidence-dir "$RUNNER_TEMP/corpus/file"
- name: Retain corpus evidence
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: corpus-linux
retention-days: 7
path: ${{ runner.temp }}/corpus/
if-no-files-found: ignore
windows-backend:
name: Windows unit and driver checks
timeout-minutes: 30
needs: changes
if: >-
!cancelled() &&
(github.event_name == 'workflow_dispatch' ||
(!github.event.repository.private &&
(needs.changes.outputs.application != 'false' || needs.changes.outputs.configuration == 'true' ||
contains(format(' {0} ', needs.changes.outputs.packages), ' fastmash-corpus-driver '))))
runs-on: windows-2025
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@df2a88e9fe4098bad09cb42c3dec7187f15861fc # master
with:
toolchain: stable
components: clippy
- uses: kunobi-ninja/kache-action@ad7317540dcdd71c904f7a60a87b620a0c0e67ed # v1
with:
version: v2.1.1
cache-key-prefix: kache-${{ github.job }}
cache-executables: true
pr-comment: false
- run: cargo clippy -p fastmash --bin fastmash --test windows_backend --test windows_console -p fastmash-corpus-driver --bins --test windows_driver --test windows_powershell --locked -- -D warnings
- run: cargo build --release -p fastmash-corpus-driver --bins --locked
- run: cargo test --release -p fastmash --bin fastmash --locked
- run: cargo test --release -p fastmash-corpus-driver --lib --test windows_driver --locked
windows-archive:
needs: [changes, windows-backend]
if: >-
!cancelled() && needs.windows-backend.result == 'success'
uses: ./.github/workflows/windows.yml
permissions:
contents: read
attestations: read
with:
release-archive: true
profiling:
name: Static profiling on ${{ matrix.os }}
needs: changes
if: >-
!cancelled() &&
(github.event_name == 'workflow_dispatch' ||
(!github.event.repository.private && needs.changes.outputs.application != 'false'))
strategy:
fail-fast: false
matrix:
os: [ubuntu-26.04, macos-15, macos-26]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@df2a88e9fe4098bad09cb42c3dec7187f15861fc # master
with:
toolchain: stable
components: clippy
- uses: kunobi-ninja/kache-action@ad7317540dcdd71c904f7a60a87b620a0c0e67ed # v1
with:
version: v2.1.1
cache-key-prefix: kache-${{ github.job }}
cache-executables: true
pr-comment: false
- run: cargo clippy -p fastmash --all-targets --features hotpath-alloc --locked -- -D warnings
- run: cargo test --profile profiling -p fastmash --features hotpath-alloc --test profiling --locked
- run: cargo build --profile profiling -p fastmash --features hotpath-alloc --bin fastmash --example profile-jobs --locked
- name: Capture static Representative jobs
shell: bash
run: target/profiling/examples/profile-jobs "$RUNNER_TEMP/fastmash-profiling"
- run: cargo check -p fastmash --all-targets --all-features --locked
- name: Prepare CPU sampling on the disposable Linux runner
if: runner.os == 'Linux'
shell: bash
run: |
curl -fsSL --proto '=https' -o "$RUNNER_TEMP/samply.tar.xz" https://github.com/mstange/samply/releases/download/samply-v0.13.1/samply-x86_64-unknown-linux-gnu.tar.xz
printf '61875daad67888798690dea3cb2748279df6ac299c5c6a857d67eed7642473d9 %s\n' "$RUNNER_TEMP/samply.tar.xz" | sha256sum -c -
tar -xJf "$RUNNER_TEMP/samply.tar.xz" -C "$RUNNER_TEMP"
echo "$RUNNER_TEMP/samply-x86_64-unknown-linux-gnu" >> "$GITHUB_PATH"
cargo install hotpath --version 0.32.0 --bin hotpath-samply --no-default-features --locked
sudo sysctl -w kernel.perf_event_paranoid=-1 kernel.yama.ptrace_scope=0 kernel.kptr_restrict=0
- name: Capture attributed CPU samples
if: runner.os == 'Linux'
shell: bash
run: |
cargo build --profile profiling -p fastmash --features hotpath-cpu --bin fastmash --example profile-jobs --locked
setsid -w target/profiling/examples/profile-jobs "$RUNNER_TEMP/fastmash-cpu" decimal
jq -e '.functions_cpu.attributed_samples > 0' "$RUNNER_TEMP/fastmash-cpu/decimal.json"
- name: Capture instruction counts
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update -q
sudo apt-get install -qy --no-install-recommends valgrind
cargo build --profile profiling -p fastmash --features hotpath-callgrind --bin fastmash --locked
capture="$RUNNER_TEMP/fastmash-callgrind"
mkdir "$capture"
printf '1\n2\n3\n' > "$capture/input"
HOTPATH_METRICS_SERVER_OFF=1 HOTPATH_OUTPUT_PATH="$capture/report.json" \
HOTPATH_CALLGRIND_OUT_FILE="$capture/callgrind.%p" \
valgrind --tool=callgrind --callgrind-out-file="$capture/callgrind.%p" \
target/profiling/fastmash sum 1 < "$capture/input" > "$capture/stdout"
printf '6\n' | cmp - "$capture/stdout"
jq -e '.functions_icount.tool | startswith("callgrind-")' "$capture/report.json"
jq -e '.functions_icount.data | any(.total | tonumber > 0)' "$capture/report.json"
jq -e '.functions_timing == null' "$capture/report.json"
- name: Retain diagnostic reports
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: profiling-${{ matrix.os }}
retention-days: 7
path: |
${{ runner.temp }}/fastmash-profiling/*.json
${{ runner.temp }}/fastmash-profiling/*.command
${{ runner.temp }}/fastmash-profiling/*.status
${{ runner.temp }}/fastmash-profiling/identity.txt
${{ runner.temp }}/fastmash-cpu/*.json
${{ runner.temp }}/fastmash-cpu/*.command
${{ runner.temp }}/fastmash-cpu/*.status
${{ runner.temp }}/fastmash-callgrind/
${{ runner.temp }}/fastmash-cpu/identity.txt
/tmp/hotpath/**/hp.json.gz
licenses:
name: Dependency licenses and advisories
needs: changes
if: >-
!cancelled() &&
(github.event_name == 'workflow_dispatch' ||
(!github.event.repository.private &&
(needs.changes.outputs.application != 'false' || needs.changes.outputs.packages != '')))
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Licence texts in the product package
run: |
cmp LICENSE-MIT crates/cli/LICENSE-MIT
cmp LICENSE-APACHE crates/cli/LICENSE-APACHE
- uses: EmbarkStudios/cargo-deny-action@70f81531115945ba6eb6b941ec9d39d063438eb9 # v2
native:
name: Native macOS
needs: changes
if: >-
github.event_name == 'workflow_dispatch' ||
(!github.event.repository.private &&
(needs.changes.outputs.application != 'false' ||
(needs.changes.outputs.configuration == 'true' && needs.changes.outputs.release_inputs != 'false')))
uses: ./.github/workflows/macos.yml
permissions:
contents: read
attestations: read
release-linux:
name: Linux release artifacts
needs: changes
if: >-
!github.event.repository.private &&
needs.changes.outputs.configuration == 'true' &&
needs.changes.outputs.release_inputs != 'false'
uses: ./.github/workflows/linux-release.yml
with:
tag: ${{ needs.changes.outputs.tag }}
documentation:
needs: changes
uses: ./.github/workflows/docs.yml
with:
browser: ${{ github.event_name == 'workflow_dispatch' || needs.changes.outputs.browser != 'false' }}
homebrew:
needs: changes
if: >-
!cancelled() && (github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.homebrew != 'false')
uses: ./.github/workflows/homebrew.yml
locale:
needs: changes
if: >-
!cancelled() && (github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.locale != 'false')
uses: ./.github/workflows/locale-reference.yml
packages-repository:
needs: changes
if: >-
!cancelled() && (github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.packages_repository != 'false')
uses: ./.github/workflows/package-repository-checks.yml
binstall:
needs: changes
if: >-
!cancelled() && (github.event_name == 'workflow_dispatch' ||
needs.changes.outputs.binstall != 'false')
uses: ./.github/workflows/cargo-binstall.yml
with:
version: ''
permissions:
contents: read
attestations: read
ci:
name: CI
needs: [changes, check, test, windows-backend, windows-archive, profiling, licenses, native, release-linux, documentation, homebrew, locale, packages-repository, binstall]
if: always()
runs-on: ubuntu-26.04
steps:
- name: Require passing checks
env:
RESULTS: ${{ join(needs.*.result, ' ') }}
CHANGES_RESULT: ${{ needs.changes.result }}
DOCUMENTATION_RESULT: ${{ needs.documentation.result }}
run: |
test "$CHANGES_RESULT" = success
test "$DOCUMENTATION_RESULT" = success
test -n "$RESULTS"
for result in $RESULTS; do
case "$result" in
success|skipped) ;;
*) echo "A check finished with: $result"; exit 1 ;;
esac
done