Repository navigation
224 lines (194 loc) · 9.16 KB
/
Copy pathbench.yml
File metadata and controls
224 lines (194 loc) · 9.16 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
on:
workflow_call:
inputs:
save-rust-cache:
required: false
type: string
default: "true"
permissions:
contents: read
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUSTUP_MAX_RETRIES: 10
UV_LOCKED: 1
jobs:
benchmarks-walltime-build:
name: "walltime build"
runs-on: depot-ubuntu-24.04-16
# uv-dev benchmarks pull requests but imports its main-branch measurements from uv.
if: ${{ github.repository == 'astral-sh/uv' || (github.repository == 'astral-sh/uv-dev' && github.ref != 'refs/heads/main') }}
timeout-minutes: 30
env:
RUSTC_BOOTSTRAP: "1"
CARGO_UNSTABLE_CHECKSUM_FRESHNESS: "true"
steps:
- name: "Checkout Branch"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install Rust toolchain"
run: rustup show
- uses: astral-sh/github-actions/rust-workspace-cache@3c9fe5db47e144ea224b57565e3ab1ab769ef41d
with:
profile: |
debug
profiling
save-if: ${{ inputs.save-rust-cache == 'true' }}
- name: "Install uv"
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
# renovate: datasource=github-release-attachments depName=astral-sh/uv
version: "0.13.6"
checksum: "f29c3e94ffabd7e6f3ba521dba169a9b7ec12100bf3257087f0f24f6123f3645"
- name: "Install requirements and prime cache"
run: |
sudo apt-get update
sudo apt-get install -y libsasl2-dev libldap2-dev libkrb5-dev
cargo run --locked --bin uv -- venv --cache-dir .cache
# Resolve benchmark fixtures without the repository's tooling build policy.
cargo run --locked --bin uv -- --config-file test/uv.toml pip compile test/requirements/jupyter.in --universal --exclude-newer 2024-08-08 --cache-dir .cache
cargo run --locked --bin uv -- --config-file test/uv.toml pip compile test/requirements/airflow.in --universal --exclude-newer 2024-08-08 --cache-dir .cache
- name: "Build benchmarks"
run: |
# cargo-codspeed resolves metadata before passing --locked to Cargo.
cargo metadata --locked --format-version 1 > /dev/null
uv run --only-dev cargo codspeed build --locked -m walltime --profile profiling -p uv-bench --bench uv --bench workspace_discovery --bench git_fetch --bench uv_pep508 --bench uv_settings
- name: "Create artifact archive"
shell: bash
run: |
mkdir -p target/codspeed-bin
cp "$(uv run --only-dev which cargo-codspeed)" target/codspeed-bin/
tar -cf - target/codspeed target/codspeed-bin target/debug/uv .cache | zstd -T0 -3 -o benchmarks-walltime.tar.zst
- name: "Upload benchmark artifacts"
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: benchmarks-walltime
path: benchmarks-walltime.tar.zst
compression-level: 0
retention-days: 1
benchmarks-walltime-run:
name: "walltime on x86_64 linux"
runs-on: codspeed-macro-x64-ryzen-9950x-ubuntu-24-04
needs: benchmarks-walltime-build
timeout-minutes: 30
permissions:
contents: read
id-token: write # for codspeed authentication
steps:
- name: "Checkout Branch"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install uv"
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
# renovate: datasource=github-release-attachments depName=astral-sh/uv
version: "0.13.6"
checksum: "f29c3e94ffabd7e6f3ba521dba169a9b7ec12100bf3257087f0f24f6123f3645"
- name: "Download benchmark artifacts"
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: benchmarks-walltime
- name: "Extract artifact archive"
shell: bash
run: zstd -dc benchmarks-walltime.tar.zst | tar -xf -
- name: "Add codspeed to PATH"
run: echo "$GITHUB_WORKSPACE/target/codspeed-bin" >> "$GITHUB_PATH"
- name: "Create venv"
run: ./target/debug/uv venv --cache-dir .cache
- name: "Retain benchmark profiles"
id: profiles
# Only public main pushes produce reusable baseline profiles.
if: ${{ github.repository == 'astral-sh/uv' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: ./target/debug/uv run --script scripts/codspeed-profiles.py start "$RUNNER_TEMP/codspeed-walltime" walltime >> "$GITHUB_OUTPUT"
- name: "Run benchmarks"
uses: CodSpeedHQ/action@373d6868929f444bc08d901fd0eb0ad52a8875ea # v5.2.1
with:
run: uv run --only-dev cargo codspeed run
mode: walltime
upload-url: ${{ steps.profiles.outputs.upload-url }}
- name: "Finish profile capture"
if: ${{ always() && steps.profiles.outcome == 'success' }}
run: ./target/debug/uv run --script scripts/codspeed-profiles.py finish "$RUNNER_TEMP/codspeed-walltime"
- name: "Upload benchmark profiles"
if: ${{ steps.profiles.outcome == 'success' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: codspeed-profiles-walltime
path: |
${{ runner.temp }}/codspeed-walltime/metadata.json
${{ runner.temp }}/codspeed-walltime/profile.tar
compression-level: 0
if-no-files-found: error
retention-days: 30
benchmarks-simulated:
name: "simulated"
runs-on: depot-ubuntu-24.04-4
# Only uv measures main; uv-dev reuses the resulting profiles.
if: ${{ github.repository == 'astral-sh/uv' || (github.repository == 'astral-sh/uv-dev' && github.ref != 'refs/heads/main') }}
timeout-minutes: 30
permissions:
contents: read
id-token: write # for codspeed authentication
env:
RUSTC_BOOTSTRAP: "1"
CARGO_UNSTABLE_CHECKSUM_FRESHNESS: "true"
steps:
- name: "Checkout Branch"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install Rust toolchain"
run: rustup show
- uses: astral-sh/github-actions/rust-workspace-cache@3c9fe5db47e144ea224b57565e3ab1ab769ef41d
with:
profile: |
debug
profiling
save-if: ${{ inputs.save-rust-cache == 'true' }}
- name: "Install uv"
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
with:
# renovate: datasource=github-release-attachments depName=astral-sh/uv
version: "0.13.6"
checksum: "f29c3e94ffabd7e6f3ba521dba169a9b7ec12100bf3257087f0f24f6123f3645"
- name: "Install requirements and prime cache"
run: |
sudo apt-get update
sudo apt-get install -y libsasl2-dev libldap2-dev libkrb5-dev
cargo run --locked --bin uv -- venv --cache-dir .cache
# Resolve benchmark fixtures without the repository's tooling build policy.
cargo run --locked --bin uv -- --config-file test/uv.toml pip compile test/requirements/jupyter.in --universal --exclude-newer 2024-08-08 --cache-dir .cache
cargo run --locked --bin uv -- --config-file test/uv.toml pip compile test/requirements/airflow.in --universal --exclude-newer 2024-08-08 --cache-dir .cache
- name: "Build benchmarks"
run: |
# cargo-codspeed resolves metadata before passing --locked to Cargo.
cargo metadata --locked --format-version 1 > /dev/null
uv run --only-dev cargo codspeed build --locked --profile profiling -p uv-bench
- name: "Retain benchmark profiles"
id: profiles
# Only public main pushes produce reusable baseline profiles.
if: ${{ github.repository == 'astral-sh/uv' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: ./target/debug/uv run --script scripts/codspeed-profiles.py start "$RUNNER_TEMP/codspeed-simulation" simulation >> "$GITHUB_OUTPUT"
- name: "Run benchmarks"
uses: CodSpeedHQ/action@373d6868929f444bc08d901fd0eb0ad52a8875ea # v5.2.1
with:
run: uv run --only-dev cargo codspeed run
mode: simulation
upload-url: ${{ steps.profiles.outputs.upload-url }}
- name: "Finish profile capture"
if: ${{ always() && steps.profiles.outcome == 'success' }}
run: ./target/debug/uv run --script scripts/codspeed-profiles.py finish "$RUNNER_TEMP/codspeed-simulation"
- name: "Upload benchmark profiles"
if: ${{ steps.profiles.outcome == 'success' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: codspeed-profiles-simulation
path: |
${{ runner.temp }}/codspeed-simulation/metadata.json
${{ runner.temp }}/codspeed-simulation/profile.tar
compression-level: 0
if-no-files-found: error
retention-days: 30