Micro-optimization #20
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: Benchmarks | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| benchmark: | |
| name: Benchmarks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Set up Python 3.14 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Install dependencies | |
| run: uv sync | |
| # On PRs: run benchmarks twice (PR code vs master code) and compare | |
| - name: Run benchmarks | |
| run: | | |
| # Checkout master version of patchdiff directory | |
| git fetch origin master | |
| git checkout origin/master -- patchdiff/ | |
| # Run benchmarks with master code as baseline | |
| uv run --no-sync pytest benchmarks/benchmark.py \ | |
| --benchmark-only \ | |
| --benchmark-save=master \ | |
| --benchmark-sort=mean || true | |
| # Restore PR code | |
| git checkout HEAD -- patchdiff/ | |
| # Run benchmarks on PR code and compare | |
| uv run --no-sync pytest benchmarks/benchmark.py \ | |
| --benchmark-only \ | |
| --benchmark-compare \ | |
| --benchmark-compare-fail=mean:5% \ | |
| --benchmark-save=branch \ | |
| --benchmark-sort=mean | |
| - name: Upload benchmarks | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Benchmarks | |
| path: .benchmarks/ | |
| include-hidden-files: true |