Skip to content

Commit 56b98ef

Browse files
art049codex
andcommitted
ci: add import-time benchmarks
Add a dedicated CodSpeed CLI config for import-time measurements and run it in walltime and simulation CI jobs. Co-Authored-By: OpenAI <noreply@openai.com>
1 parent b2d12d8 commit 56b98ef

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/codspeed.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,33 @@ jobs:
4343
mode: ${{ matrix.mode }}
4444
run: uv run pytest tests/benchmarks/ --codspeed --test-group=${{ matrix.shard }} --test-group-count=${{ env.SHARDS }}
4545

46+
import-benchmarks:
47+
strategy:
48+
matrix:
49+
mode: ["simulation", "walltime"]
50+
51+
name: "Run import-time benchmarks (${{ matrix.mode }})"
52+
runs-on: ${{ matrix.mode == 'walltime' && 'codspeed-macro' || 'ubuntu-24.04' }}
53+
steps:
54+
- uses: actions/checkout@v5
55+
with:
56+
submodules: "recursive"
57+
- uses: astral-sh/setup-uv@v7
58+
- uses: actions/setup-python@v6
59+
with:
60+
python-version: ${{ env.PYTHON_VERSION }}
61+
- name: Install local version of pytest-codspeed
62+
run: uv sync --dev
63+
- name: Run import-time benchmarks
64+
uses: CodSpeedHQ/action@main
65+
with:
66+
mode: ${{ matrix.mode }}
67+
config: codspeed-import-time.yml
68+
4669
all-checks:
4770
runs-on: ubuntu-latest
4871
steps:
4972
- run: echo "All CI checks passed."
5073
needs:
5174
- benchmarks
75+
- import-benchmarks

codspeed-import-time.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
$schema: https://raw.githubusercontent.com/CodSpeedHQ/codspeed/refs/heads/main/schemas/codspeed.schema.json
2+
3+
options:
4+
warmup-time: 0s
5+
min-rounds: 30
6+
max-rounds: 100
7+
8+
benchmarks:
9+
- name: python startup
10+
exec: .venv/bin/python -c "pass"
11+
12+
- name: import pytest
13+
exec: .venv/bin/python -c "import pytest"
14+
15+
- name: import pluggy
16+
exec: .venv/bin/python -c "import pluggy"
17+
18+
- name: import rich
19+
exec: .venv/bin/python -c "import rich"
20+
21+
- name: import pytest_codspeed
22+
exec: .venv/bin/python -c "import pytest_codspeed"
23+
24+
- name: import pytest_codspeed.plugin
25+
exec: .venv/bin/python -c "import pytest_codspeed.plugin"

0 commit comments

Comments
 (0)