diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 000000000..f0e8a674b --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,42 @@ +name: Run performance benchmark +on: + pull_request: + types: + - labeled + - synchronize + workflow_dispatch: + +permissions: + contents: write + deployments: write + +jobs: + benchmark: + if: contains(github.event.label.name, 'benchmark') || github.event_name == 'workflow_dispatch' + name: Run pytest-benchmark with pixi + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup pixi environment + uses: prefix-dev/setup-pixi@v0.8.1 + with: + pixi-version: v0.29.0 + cache: true + auth-host: prefix.dev + auth-token: ${{ secrets.PREFIX_DEV_TOKEN }} + + - name: Run benchmark + run: pixi run benchmark + + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + name: Python Benchmark with pytest-benchmark + tool: 'pytest' + output-file-path: tests/output.json + github-token: ${{ secrets.GITHUB_TOKEN }} + auto-push: true + alert-threshold: '200%' + comment-on-alert: true + fail-on-alert: true