Add CodSpeed performance benchmarks and CI workflow #2
Workflow file for this run
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: | |
| - main | |
| pull_request: | |
| # `workflow_dispatch` allows CodSpeed to trigger backtest | |
| # performance analysis in order to generate initial data. | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| # Cancel a stale in-progress run when a PR gets pushed to again, but let | |
| # every push to main finish, since each one records a CodSpeed baseline. | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| id-token: write # for OpenID Connect authentication with CodSpeed | |
| jobs: | |
| benchmarks: | |
| name: Run benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| pip install pytest pytest-codspeed | |
| - name: Run benchmarks | |
| uses: CodSpeedHQ/action@v5 | |
| with: | |
| mode: simulation | |
| run: pytest benchmarks/ --codspeed |