Skip to content

Commit f660894

Browse files
authored
Run CodSpeed benchmarks in parallel shards (#4597)
1 parent ff33238 commit f660894

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,16 @@ jobs:
124124
path: coverage_html_report
125125

126126
benchmarks:
127-
name: 📈 Benchmarks
127+
name: 📈 Benchmarks (${{ matrix.shard }}/4)
128128

129129
# Using this version because CodSpeed doesn't support Ubuntu 24.04 LTS yet
130130
runs-on: ubuntu-22.04
131131

132+
strategy:
133+
fail-fast: false
134+
matrix:
135+
shard: [1, 2, 3, 4]
136+
132137
permissions:
133138
contents: read
134139
id-token: write
@@ -143,13 +148,17 @@ jobs:
143148
enable-cache: true
144149
python-version: "3.14"
145150

146-
- run: uv sync
151+
- run: uv sync --locked
147152

148153
- name: Run benchmarks
149154
uses: CodSpeedHQ/action@4296e51e7041e24dadb86d1d6e8b9320d223dbe8 # v5.0.3
150155
with:
151156
mode: simulation
152-
run: uv run pytest tests/benchmarks --codspeed -p no:codeflash-benchmark
157+
run: >-
158+
uv run pytest tests/benchmarks --codspeed
159+
-p no:codeflash-benchmark
160+
--test-group=${{ matrix.shard }}
161+
--test-group-count=4
153162
154163
lint:
155164
name: ✨ Lint

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ dev = [
8383
"pytest-emoji>=0.2.0,<0.3.0",
8484
"pytest-mock>=3.10,<4.0",
8585
"pytest-snapshot>=0.9.0,<0.10.0",
86+
"pytest-test-groups>=1.2.1,<2.0.0",
8687
"pytest-xdist[psutil]>=3.1.0,<4.0.0",
8788
"python-multipart>=0.0.7",
8889
"rich>=12.5.1",

uv.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)