Skip to content

docs: add an example on measuring import times #394

docs: add an example on measuring import times

docs: add an example on measuring import times #394

Workflow file for this run

name: CodSpeed
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
env:
PYTHON_VERSION: "3.12"
SHARDS: 4
jobs:
benchmarks-instrumentation:
strategy:
matrix:
shard: [0, 1, 2, 3]
mode: ["instrumentation", "walltime"]
name: Run ${{ matrix.mode }} benchmarks (Shard ${{ matrix.shard + 1 }} of ${{ env.SHARDS }})

Check failure on line 20 in .github/workflows/codspeed.yml

View workflow run for this annotation

GitHub Actions / CodSpeed

Invalid workflow file

The workflow is not valid. .github/workflows/codspeed.yml (Line: 20, Col: 11): Unexpected symbol: '+'. Located at position 14 within expression: matrix.shard + 1
runs-on: ${{ matrix.mode == 'instrumentation' && 'ubuntu-24.04' || 'codspeed-macro' }}
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install required-version defined in uv.toml
uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install local version of pytest-codspeed
run: |
sudo apt-get update
sudo apt-get install valgrind -y
uv sync --dev
sudo apt-get remove valgrind -y
- name: Run benchmarks
uses: CodSpeedHQ/action@main
with:
run: pytest tests/benchmarks/ --codspeed --test-group=${{ matrix.shard }} --test-group-count=${{ env.SHARDS }}
token: ${{ secrets.CODSPEED_TOKEN }}