ci: add import-time benchmarks #737
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CodSpeed | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| workflow_dispatch: | |
| env: | |
| PYTHON_VERSION: "3.14.3" | |
| SHARDS: 4 | |
| permissions: | |
| contents: read # required for actions/checkout | |
| id-token: write # required for OIDC authentication with CodSpeed | |
| jobs: | |
| benchmarks: | |
| strategy: | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| mode: ["simulation", "walltime", "memory"] | |
| name: "Run ${{ matrix.mode }} benchmarks (Shard #${{ matrix.shard }})" | |
| runs-on: ${{ matrix.mode == 'walltime' && 'codspeed-macro' || 'ubuntu-24.04' }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: "recursive" | |
| - uses: astral-sh/setup-uv@v7 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install local version of pytest-codspeed | |
| run: uv sync --dev | |
| - name: Run benchmarks | |
| uses: CodSpeedHQ/action@main | |
| with: | |
| mode: ${{ matrix.mode }} | |
| run: uv run pytest tests/benchmarks/ --codspeed --test-group=${{ matrix.shard }} --test-group-count=${{ env.SHARDS }} | |
| import-benchmarks: | |
| strategy: | |
| matrix: | |
| mode: ["simulation", "walltime"] | |
| name: "Run import-time benchmarks (${{ matrix.mode }})" | |
| runs-on: ${{ matrix.mode == 'walltime' && 'codspeed-macro' || 'ubuntu-24.04' }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: "recursive" | |
| - uses: astral-sh/setup-uv@v7 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install local version of pytest-codspeed | |
| run: uv sync --dev | |
| - name: Run import-time benchmarks | |
| uses: CodSpeedHQ/action@main | |
| with: | |
| mode: ${{ matrix.mode }} | |
| config: codspeed-import-time.yml | |
| all-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "All CI checks passed." | |
| needs: | |
| - benchmarks | |
| - import-benchmarks |