cruft: update template #579
This file contains 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: Benchmark | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: "1" | |
PY_COLORS: "1" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: {} | |
jobs: | |
benchmark: | |
runs-on: ubuntu-latest | |
env: | |
PYTEST_BENCHMARK_STORAGE: file://${{ github.workspace }}/.benchmarks | |
steps: | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.base.sha }} | |
fetch-depth: 0 | |
path: base | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
path: pr | |
- name: Upgrade pip and nox | |
run: python -m pip install --upgrade pip nox | |
- name: Benchmark on base branch | |
working-directory: base | |
run: nox -s bench -- --benchmark-save=base | |
- name: Benchmark on pull request | |
working-directory: pr | |
run: > | |
nox -s bench -- | |
--benchmark-save=${GITHUB_SHA::7} | |
--benchmark-compare=0001 | |
--benchmark-compare-fail=mean:10% | |
- run: pip install pytest-benchmark | |
- name: Compare benchmark | |
if: always() | |
run: pytest-benchmark compare --group-by name |