@@ -21,16 +21,13 @@ jobs:
2121 - uses : actions/checkout@v4
2222 - uses : actions/setup-python@v5
2323 with :
24- python-version : ${{ env.UV_PYTHON}}
24+ python-version : ${{ env.UV_PYTHON }}
2525
2626 - name : Install UV.
2727 uses : astral-sh/setup-uv@v6
2828 with :
2929 enable-cache : true
3030
31- - name : Install python dependencies.
32- run : uv sync --group testing
33-
3431 - name : Install rust.
3532 id : rust-toolchain
3633 uses : dtolnay/rust-toolchain@1.76.0
@@ -40,23 +37,44 @@ jobs:
4037 - name : Cache rust.
4138 uses : Swatinem/rust-cache@v2
4239
43- - name : Compile.
44- run : uv pip install -v -e .
40+ - name : Build wheel with profile generation.
41+ uses : PyO3/maturin-action@v1
42+ with :
43+ manylinux : auto
44+ args : --release --out pgo-wheel --interpreter ${{ env.UV_PYTHON }}
45+ rust-toolchain : 1.76.0
46+ docker-options : -e CI
4547 env :
4648 RUSTFLAGS : " -Cprofile-generate=${{ github.workspace }}/profdata"
4749
4850 - name : Gather PGO data.
49- run : uv run pytest . --benchmark-enable
51+ run : |
52+ uv sync --group testing
53+ uv pip install libipld --no-index --no-deps --find-links pgo-wheel --force-reinstall
54+
55+ uv run pytest . --benchmark-enable
5056
5157 - name : Prepare merged PGO data.
5258 run : rustup run 1.76.0 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'
5359
54- - name : Compile with profile.
55- run : uv pip install -v -e .
60+ - name : Build PGO-optimized wheel.
61+ uses : PyO3/maturin-action@v1
62+ with :
63+ manylinux : auto
64+ args : --release --out dist --interpreter ${{ env.UV_PYTHON }}
65+ rust-toolchain : 1.76.0
66+ docker-options : -e CI
5667 env :
5768 RUSTFLAGS : " -Cprofile-use=${{ github.workspace }}/merged.profdata"
5869
59- - name : Run benchmarks.
70+ - name : Find built wheel.
71+ id : find_wheel
72+ run : echo "path=$(ls dist/*.whl)" | tee -a "$GITHUB_OUTPUT"
73+
74+ - name : Install PGO wheel.
75+ run : uv pip install ${{ steps.pgo-wheel.outputs.wheel }} --force-reinstall
76+
77+ - name : Run CodSpeed benchmarks.
6078 uses : CodSpeedHQ/action@v3
6179 with :
6280 token : ${{ secrets.CODSPEED_TOKEN }}
0 commit comments