Repository navigation
171 lines (157 loc) · 6.09 KB
/
Copy pathcodspeed-microbench.yml
File metadata and controls
171 lines (157 loc) · 6.09 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 microbenchmarks
permissions:
contents: read
id-token: write
on:
push:
branches: [main]
paths:
- "Cargo.lock"
- "Cargo.toml"
- "crates/**/Cargo.toml"
- "!crates/corpus/Cargo.toml"
- "!crates/fuzz-harness/Cargo.toml"
- "!crates/fuzz-types/Cargo.toml"
- "!crates/invariants/Cargo.toml"
- "!crates/nitro-attestation/fuzz/Cargo.toml"
- "crates/primitives/**"
- "crates/alloy/**"
- "crates/precompiles/**"
- "crates/evm/**"
pull_request:
paths:
- "Cargo.lock"
- "Cargo.toml"
- "crates/**/Cargo.toml"
- "!crates/corpus/Cargo.toml"
- "!crates/fuzz-harness/Cargo.toml"
- "!crates/fuzz-types/Cargo.toml"
- "!crates/invariants/Cargo.toml"
- "!crates/nitro-attestation/fuzz/Cargo.toml"
- "crates/primitives/**"
- "crates/alloy/**"
- "crates/precompiles/**"
- "crates/evm/**"
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:
inputs:
packages:
description: "Cargo package(s) containing benchmark targets, separated by spaces"
required: true
default: "tempo-evm"
type: string
benchmarks:
description: "Cargo bench target(s), separated by spaces; leave empty for every bench in the package(s)"
required: false
default: "tip20_execution dex_execution"
type: string
filters:
description: "Optional benchmark name filter passed to cargo codspeed run"
required: false
default: ""
type: string
measurement_modes:
description: "CodSpeed measurement mode(s), separated by commas"
required: true
default: "simulation"
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Allow Aegis to finish its 90-second Socket lookup before Cargo times out.
CARGO_HTTP_TIMEOUT: "180"
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
RUSTC_WRAPPER: "sccache"
jobs:
codspeed:
permissions:
contents: read
id-token: write
name: CodSpeed microbenchmarks
runs-on: depot-ubuntu-latest-4
timeout-minutes: 60
steps:
- name: Secure runner
uses: tempoxyz/gh-actions/actions/secure-runner@35019557465e3c38ee3468be171771fd73577584 # 2026-10-20T06-22-38Z-35019557
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: tempoxyz/gh-actions/vendor/dtolnay/rust-toolchain@35019557465e3c38ee3468be171771fd73577584 # 2026-10-20T06-22-38Z-35019557
- uses: tempoxyz/gh-actions/actions/setup-mold@35019557465e3c38ee3468be171771fd73577584 # 2026-10-20T06-22-38Z-35019557
- uses: tempoxyz/gh-actions/vendor/mozilla-actions/sccache-action@35019557465e3c38ee3468be171771fd73577584 # 2026-10-20T06-22-38Z-35019557
- name: Install cargo-codspeed
run: |
cargo install cargo-codspeed \
--git https://github.com/CodSpeedHQ/codspeed-rust \
--rev 0c6ccae11dc48654fd83c8dd77d231e386ebd9bd \
--locked
- name: Resolve cargo codspeed arguments
id: args
env:
INPUT_PACKAGES: ${{ inputs.packages || 'tempo-evm' }}
INPUT_BENCHMARKS: ${{ inputs.benchmarks || 'tip20_execution dex_execution' }}
INPUT_FILTERS: ${{ inputs.filters }}
INPUT_MEASUREMENT_MODES: ${{ inputs.measurement_modes || 'simulation' }}
run: |
set -euo pipefail
split_words() {
local value="$1"
value="${value//,/ }"
read -r -a words <<< "$value"
printf '%s\n' "${words[@]}"
}
cargo_args=()
while IFS= read -r package; do
[ -n "$package" ] && cargo_args+=("-p" "$package")
done < <(split_words "$INPUT_PACKAGES")
while IFS= read -r benchmark; do
[ -n "$benchmark" ] && cargo_args+=("--bench" "$benchmark")
done < <(split_words "$INPUT_BENCHMARKS")
# tempo-precompiles benchmarks require the test-utils feature;
# --features is only valid for `cargo codspeed build`, not `run`.
feature_args=()
while IFS= read -r package; do
if [ "$package" = "tempo-precompiles" ]; then
feature_args+=("--features" "tempo-precompiles/test-utils")
break
fi
done < <(split_words "$INPUT_PACKAGES")
build_args=("${cargo_args[@]}" "${feature_args[@]}")
while IFS= read -r mode; do
[ -n "$mode" ] && build_args+=("-m" "$mode")
done < <(split_words "$INPUT_MEASUREMENT_MODES")
run_args=("${cargo_args[@]}")
while IFS= read -r filter; do
[ -n "$filter" ] && run_args+=("$filter")
done < <(split_words "$INPUT_FILTERS")
{
printf 'build_args<<EOF\n'
printf '%q ' "${build_args[@]}"
printf '\nEOF\n'
printf 'run_args<<EOF\n'
printf '%q ' "${run_args[@]}"
printf '\nEOF\n'
printf 'measurement_modes<<EOF\n'
printf '%s' "$INPUT_MEASUREMENT_MODES"
printf '\nEOF\n'
} >> "$GITHUB_OUTPUT"
printf 'cargo codspeed build '
printf '%q ' "${build_args[@]}"
printf '\n'
printf 'cargo codspeed run '
printf '%q ' "${run_args[@]}"
printf '\n'
- name: Build benchmark target(s)
env:
BUILD_ARGS: ${{ steps.args.outputs.build_args }}
run: |
# shellcheck disable=SC2086 # BUILD_ARGS must word-split into multiple cargo args
cargo codspeed build $BUILD_ARGS
- name: Run benchmark target(s)
uses: tempoxyz/gh-actions/vendor/CodSpeedHQ/action@35019557465e3c38ee3468be171771fd73577584 # 2026-10-20T06-22-38Z-35019557
with:
mode: ${{ steps.args.outputs.measurement_modes }}
run: cargo codspeed run ${{ steps.args.outputs.run_args }}