feat: add asv-codspeed package for airspeed velocity support #611
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" | |
| SHARDS: 4 | |
| jobs: | |
| pytest-benchmarks: | |
| strategy: | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| mode: ["instrumentation", "walltime"] | |
| name: "pytest ${{ matrix.mode }} benchmarks (Shard #${{ matrix.shard }})" | |
| runs-on: ${{ matrix.mode == 'instrumentation' && 'ubuntu-24.04' || 'codspeed-macro' }} | |
| 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: | | |
| 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: | |
| mode: ${{ matrix.mode }} | |
| run: uv run pytest pytest-codspeed/tests/benchmarks/ --codspeed --ignore=pytest-codspeed/tests/benchmarks/TheAlgorithms --test-group=${{ matrix.shard }} --test-group-count=${{ env.SHARDS }} | |
| token: ${{ secrets.CODSPEED_TOKEN }} | |
| asv-benchmarks: | |
| strategy: | |
| matrix: | |
| mode: ["instrumentation", "walltime"] | |
| name: "asv ${{ matrix.mode }} benchmarks" | |
| runs-on: ${{ matrix.mode == 'instrumentation' && 'ubuntu-24.04' || 'codspeed-macro' }} | |
| 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 dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install valgrind -y | |
| uv sync --dev | |
| sudo apt-get remove valgrind -y | |
| - name: Run ASV benchmarks | |
| uses: CodSpeedHQ/action@main | |
| with: | |
| mode: ${{ matrix.mode }} | |
| run: uv run asv-codspeed run asv-codspeed/tests/sample_benchmarks | |
| token: ${{ secrets.CODSPEED_TOKEN }} | |
| all-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "All CI checks passed." | |
| needs: | |
| - pytest-benchmarks | |
| - asv-benchmarks |