-
-
Notifications
You must be signed in to change notification settings - Fork 68
171 lines (153 loc) · 6.25 KB
/
Copy pathcodspeed.yml
File metadata and controls
171 lines (153 loc) · 6.25 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
name: CodSpeed
on:
push:
branches:
- "master"
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:
jobs:
benchmarks:
strategy:
fail-fast: false
matrix:
include:
# veryl-tests (parse/format/analyze) is LTO-sensitive, so keep the
# fat-LTO `bench` default.
- package: veryl-tests
build_args: ""
# The simulator's hot loop is JIT-compiled native code that LTO
# barely touches; build it lto=false (release-verylup) to skip the
# fat-LTO link that OOM-kills the 2-core runner via wasmtime+cranelift.
- package: veryl-simulator
build_args: "--profile release-verylup"
name: Run benchmarks
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: sccache
CARGO_INCREMENTAL: "0"
SCCACHE_CACHE_SIZE: "3G"
steps:
- uses: actions/checkout@v6
- name: Setup rust toolchain, cache and cargo-codspeed binary
uses: moonrepo/setup-rust@v1
with:
channel: stable
cache: false
bins: cargo-codspeed
# rust-cache caches ~/.cargo and target/ (dependency compilation) so cargo
# skips deps; sccache (content-addressed) then serves the workspace crates,
# which rust-cache alone cannot reuse across runs (cargo's mtime fingerprints
# break after checkout). The key is distinct because building under sccache
# changes every crate's fingerprint. Master saves; PRs restore read-only.
- uses: Swatinem/rust-cache@v2
continue-on-error: true
with:
shared-key: "${{ runner.os }}-codspeed-${{ matrix.package }}-sccache"
save-if: ${{ github.ref == 'refs/heads/master' }}
- uses: mozilla-actions/sccache-action@v0.0.10
with:
# stats stay in the job log via the explicit step below; keep them off
# the run-summary annotations
disable_annotations: true
- uses: actions/cache/restore@v4
continue-on-error: true
with:
path: ~/.cache/sccache
key: sccache-codspeed-${{ matrix.package }}-${{ github.sha }}
restore-keys: sccache-codspeed-${{ matrix.package }}-
- name: Build the benchmark target(s)
run: cargo codspeed build -p ${{ matrix.package }} --bench benchmark ${{ matrix.build_args }}
- name: sccache stats
if: always()
run: sccache --show-stats
- uses: actions/cache/save@v4
if: github.ref == 'refs/heads/master'
continue-on-error: true
with:
path: ~/.cache/sccache
key: sccache-codspeed-${{ matrix.package }}-${{ github.sha }}
- name: Run the benchmarks
uses: CodSpeedHQ/action@v4
with:
run: cargo codspeed run -p ${{ matrix.package }}
mode: "simulation"
token: ${{ secrets.CODSPEED_TOKEN }}
# heliodor 1-core Linux boot benchmark (CodSpeed walltime). Runs on a CodSpeed
# Macro Runner (codspeed-macro, ARM64) — walltime is not available on standard
# GitHub-hosted runners. Needs a C compiler (the simulator cc backend).
# Run locally with: cargo bench -p veryl-simulator --bench heliodor_boot
boot-benchmark:
name: Run heliodor boot benchmark (walltime)
runs-on: codspeed-macro
env:
RUSTC_WRAPPER: sccache
CARGO_INCREMENTAL: "0"
SCCACHE_CACHE_SIZE: "3G"
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup rust toolchain, cache and cargo-codspeed binary
uses: moonrepo/setup-rust@v1
with:
channel: stable
cache: false
bins: cargo-codspeed
# Same rust-cache + sccache split as the benchmarks job above (deps via
# rust-cache; workspace crates via sccache, under a distinct -sccache key).
- uses: Swatinem/rust-cache@v2
continue-on-error: true
with:
shared-key: "${{ runner.os }}-${{ runner.arch }}-codspeed-boot-sccache"
save-if: ${{ github.ref == 'refs/heads/master' }}
- uses: mozilla-actions/sccache-action@v0.0.10
with:
disable_annotations: true
- uses: actions/cache/restore@v4
continue-on-error: true
with:
path: ~/.cache/sccache
key: sccache-codspeed-boot-${{ github.sha }}
restore-keys: sccache-codspeed-boot-
# The simulator stores compiled aot_c .so files content-addressed under
# ~/.cache/veryl/aot_c; without this cache every run pays the full gcc
# compile of the emitted C (~10 min on this runner). The lookup inside
# the dir is content-addressed, so the cache key only needs to pick the
# newest snapshot: restore by prefix, save under the unique commit sha.
- uses: actions/cache/restore@v4
id: aot-cache
continue-on-error: true
with:
path: ~/.cache/veryl/aot_c
key: ${{ runner.os }}-${{ runner.arch }}-aot-c-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-aot-c-
# release-verylup (lto=false) avoids the slow fat-LTO link the `bench`
# profile forces; the JIT'd simulation loop is unaffected by LTO. Matches
# the simulator build in the benchmarks job above.
- name: Build the benchmark target
run: cargo codspeed build -p veryl-simulator --bench heliodor_boot --profile release-verylup
- name: sccache stats
if: always()
run: sccache --show-stats
- uses: actions/cache/save@v4
if: github.ref == 'refs/heads/master'
continue-on-error: true
with:
path: ~/.cache/sccache
key: sccache-codspeed-boot-${{ github.sha }}
- name: Run the benchmark
uses: CodSpeedHQ/action@v4
with:
run: cargo codspeed run -p veryl-simulator
mode: "walltime"
token: ${{ secrets.CODSPEED_TOKEN }}
# Save only on master (like rust-cache above): PR-scoped caches are
# invisible to other refs and just eat the 10GB quota.
- uses: actions/cache/save@v4
if: github.ref == 'refs/heads/master'
continue-on-error: true
with:
path: ~/.cache/veryl/aot_c
key: ${{ steps.aot-cache.outputs.cache-primary-key }}