-
-
Notifications
You must be signed in to change notification settings - Fork 6
84 lines (69 loc) · 2.48 KB
/
codspeed.yml
File metadata and controls
84 lines (69 loc) · 2.48 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
name: CodSpeed benchmarks
on:
push:
branches:
- "main"
pull_request:
workflow_dispatch: # allows CodSpeed to trigger backtest
permissions:
contents: read
env:
UV_FROZEN: true
UV_PYTHON: 3.14
RUST_VERSION: "1.90.0"
jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5 # required for correct CodSpeed integration
with:
python-version: ${{ env.UV_PYTHON }}
- name: Install UV.
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install rust.
id: rust-toolchain
uses: dtolnay/rust-toolchain@master
with:
components: llvm-tools
toolchain: ${{ env.RUST_VERSION }}
- name: Cache rust.
uses: Swatinem/rust-cache@v2
- name: Build wheel with profile generation.
uses: PyO3/maturin-action@v1
with:
manylinux: auto
args: --release --out pgo-wheel --interpreter ${{ env.UV_PYTHON }}
rust-toolchain: ${{ env.RUST_VERSION }}
docker-options: -e CI
env:
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata"
- name: Gather PGO data.
run: |
uv sync --group testing
uv pip install libipld --no-index --no-deps --find-links pgo-wheel --force-reinstall
uv run pytest . --benchmark-enable
- name: Prepare merged PGO data.
run: rustup run ${{ env.RUST_VERSION }} bash -c '$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata'
- name: Build PGO-optimized wheel.
uses: PyO3/maturin-action@v1
with:
manylinux: auto
args: --release --out dist --interpreter ${{ env.UV_PYTHON }}
rust-toolchain: ${{ env.RUST_VERSION }}
docker-options: -e CI
env:
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata"
- name: Find PGO built wheel.
id: pgo-wheel
run: echo "path=$(ls dist/*.whl)" | tee -a "$GITHUB_OUTPUT"
- name: Install PGO wheel.
run: uv pip install ${{ steps.pgo-wheel.outputs.path }} --force-reinstall
- name: Run CodSpeed benchmarks.
uses: CodSpeedHQ/action@v4
with:
mode: simulation
token: ${{ secrets.CODSPEED_TOKEN }}
run: uv run --group=codspeed pytest . --codspeed