Repository navigation
275 lines (246 loc) · 9.2 KB
/
Copy pathci.yml
File metadata and controls
275 lines (246 loc) · 9.2 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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel in progress runs if a new one is queued everywhere but on pushes and workflow dispatch events
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
components: rustfmt, clippy
- uses: j178/prek-action@bdca6f102f98e2b4c7029491a53dfd366469e33d # v2.0.4
with:
extra-args: --all-files
- name: Check config schema is up to date
if: matrix.os == 'ubuntu-latest'
run: cargo run --bin generate_config_schema && git diff --exit-code schemas/codspeed.schema.json
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: true
submodules: true
- uses: ./.github/actions/install-rust
- uses: ./.github/actions/install-bpf-deps
- run: cargo test --all --exclude memtrack --exclude exec-harness
executor-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- uses: taiki-e/install-action@e0eafa9a0d485c37f97c0f7beb930a58a2facbac # v2
with:
tool: just
# No cache for now here, but we could cache either docker volumes or mounted host directories to cache build artifacts
- run: just test-integ
# Runs against an unreleased valgrind-codspeed branch, tag or full commit SHA
# env:
# CODSPEED_VALGRIND_REF: my-valgrind-branch
exec-harness-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- uses: ./.github/actions/install-rust
- name: Run tests
run: cargo test -p exec-harness
basic-run-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- uses: ./.github/actions/install-rust
- name: Run tests
run: cargo run -- exec -m simulation,walltime,memory --warmup-time 0s --max-rounds 5 -- sleep 1
macos-basic-run-test:
runs-on: macos-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- uses: ./.github/actions/install-rust
- name: Install exec-harness
run: |
cargo install --path crates/exec-harness --locked
- name: Run tests
env:
# Profiling system commands (e.g. `ls`) with samply is not yet supported on MacOS
CODSPEED_PROFILER_ENABLED: "false"
run: cargo run -- exec -m walltime --skip-upload --warmup-time 0s --max-rounds 5 -- ls -la
bpf-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
[
ubuntu-22.04,
ubuntu-24.04,
ubuntu-24.04-arm,
ubuntu-26.04,
ubuntu-26.04-arm,
]
# Each memtrack integration test binary runs its cases serially
# (eBPF tracker can't overlap with itself in one process), so we
# shard at the test-binary level to parallelize across jobs.
test:
[
c_tests,
cpp_tests,
rust_tests,
spawn_tests,
dlopen_tests,
rss_tests,
stack_tests,
interpreter_tests,
]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: true
submodules: true
- uses: ./.github/actions/install-rust
with:
cache-key: ${{ matrix.os }}-${{ matrix.test }}
- uses: ./.github/actions/install-bpf-deps
- name: Install additional allocators
run: sudo apt-get install -y libmimalloc-dev libjemalloc-dev
# The perf trampoline needs Python 3.12+.
- name: Install Python with perf trampoline support
if: matrix.test == 'interpreter_tests'
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Run tests
env:
RUST_LOG: debug
# Ubuntu 26.04 ships sudo-rs, which ignores `-E`; pass the env the
# rustup shims and the test gate need through `env` instead.
run: |
sudo env \
"HOME=$HOME" \
"PATH=$PATH" \
"CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}" \
"RUSTUP_HOME=${RUSTUP_HOME:-$HOME/.rustup}" \
"CARGO_INCREMENTAL=$CARGO_INCREMENTAL" \
"RUST_LOG=$RUST_LOG" \
"GITHUB_ACTIONS=$GITHUB_ACTIONS" \
$(which cargo) test --lib --test ${{ matrix.test }} -- --test-threads 1 --nocapture
working-directory: crates/memtrack
# Since we ran the tests with sudo, the build artifacts will have root ownership
- name: Clean up
run: sudo chown -R $USER:$USER . ~/.cargo
benchmarks:
runs-on: ${{ matrix.mode == 'walltime' && 'codspeed-macro' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
mode: [simulation, walltime, memory]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- uses: ./.github/actions/install-rust
- name: Install cargo codspeed
uses: taiki-e/install-action@e0eafa9a0d485c37f97c0f7beb930a58a2facbac # v2
with:
tool: cargo-codspeed
- name: Build benchmarks
run: cargo codspeed build -p runner-shared -m ${{ matrix.mode }}
- name: Run benchmarks
uses: CodSpeedHQ/action@3194d9a39c4d46684cb44bf7207fc56626aad8fd # v4
with:
mode: ${{ matrix.mode }}
run: cargo codspeed run -p runner-shared
memtrack-benchmarks:
runs-on: codspeed-macro
strategy:
fail-fast: false
matrix:
# Both physical variants of a workload live in the same file, so they
# are measured back to back.
workload: [dd, tar]
env:
CODSPEED_REV: ${{ github.event.pull_request.head.sha || github.sha }}
CARGO_TARGET_DIR: ${{ github.workspace }}/target
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true
- uses: ./.github/actions/install-rust
- uses: ./.github/actions/install-bpf-deps
- name: Install memtrack
uses: baptiste0928/cargo-install@8195d4f734a149db85385bb4102b42efcd373759 # v3.5.0
with:
crate: memtrack
git: https://github.com/CodSpeedHQ/codspeed
commit: ${{ env.CODSPEED_REV }}
- name: Install codspeed-runner
uses: baptiste0928/cargo-install@8195d4f734a149db85385bb4102b42efcd373759 # v3.5.0
with:
crate: codspeed-runner
git: https://github.com/CodSpeedHQ/codspeed
commit: ${{ env.CODSPEED_REV }}
# The CodSpeed action reinstalls the runner into CARGO_INSTALL_ROOT; pointing
# it at the cached install root makes cargo see the same revision as already
# installed and skip the rebuild.
- name: Reuse the cached runner install
run: echo "CARGO_INSTALL_ROOT=$HOME/.cargo-install/codspeed-runner" >> "$GITHUB_ENV"
- name: Verify installed binaries
run: |
which codspeed codspeed-memtrack
codspeed --version
codspeed-memtrack --version
# The benchmarked command is memtrack itself, which needs file capabilities
# to load its eBPF programs even though the runner measures walltime.
- name: Grant memtrack file capabilities
run: codspeed setup --mode memory
# The write benchmarks overwrite these files every round; creating them
# inside a measured round would time one-off disk allocation.
- name: Pre-create benchmark archives
run: |
mkdir -p /tmp/codspeed-memtrack-bench
tar -cf /tmp/memtrack-bench.tar /usr/bin
dd if=/dev/zero of=/tmp/memtrack-bench-dd.bin bs=1M count=64 2> /dev/null
- name: Run memtrack walltime benchmarks (${{ matrix.workload }})
uses: CodSpeedHQ/action@3194d9a39c4d46684cb44bf7207fc56626aad8fd # v4
with:
config: crates/memtrack/benchmarks/${{ matrix.workload }}.yml
mode: walltime
runner-version: rev:${{ env.CODSPEED_REV }}
skip-hash-check-warning: true
check:
runs-on: ubuntu-latest
if: always()
needs:
- lint
- tests
- executor-tests
- exec-harness-tests
- basic-run-test
- macos-basic-run-test
- bpf-tests
- benchmarks
- memtrack-benchmarks
steps:
- uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJson( needs ) }}