-
Notifications
You must be signed in to change notification settings - Fork 252
73 lines (58 loc) · 2.12 KB
/
codspeed.yml
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
name: codspeed
on:
push:
branches:
- main
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:
jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/cache@v4
id: cache-py
name: cache python
with:
path: ${{ env.pythonLocation }}
key: >
py-v2
${{ env.pythonLocation }}
${{ hashFiles('tests/requirements.txt') }}
${{ hashFiles('pyproject.toml') }}
- run: pip install -r tests/requirements.txt
if: steps.cache-py.outputs.cache-hit != 'true'
- run: pip uninstall pytest-speed -y
if: steps.cache-py.outputs.cache-hit != 'true'
- run: pip install pytest-benchmark==4.0.0
if: steps.cache-py.outputs.cache-hit != 'true'
- name: install rust stable
id: rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools
- name: cache rust
uses: Swatinem/rust-cache@v2
- name: Compile pydantic-core for profiling
run: make build-profiling
env:
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata"
- name: Gather pgo data
run: pytest tests/benchmarks
- name: Prepare merged pgo data
run: rustup run stable 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: Compile pydantic-core for benchmarking
run: make build-profiling
env:
CONST_RANDOM_SEED: 0 # Fix the compile time RNG seed
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata"
- name: Run CodSpeed benchmarks
uses: CodSpeedHQ/action@v3
with:
run: pytest tests/benchmarks/ --codspeed