feat: add package model foundation with env-root discovery #162
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: Benchmark | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| benchmark: | |
| runs-on: ubuntu-latest | |
| env: | |
| UV_CACHE_DIR: ${{ github.workspace }}/.uv-cache | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| - name: Cache uv dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.UV_CACHE_DIR }} | |
| key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-uv- | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run benchmarks | |
| run: | | |
| mkdir -p tmp | |
| uv run pytest tests/benchmarks/ \ | |
| --benchmark-enable --benchmark-only \ | |
| --benchmark-json=tmp/benchmark-results.json -v | |
| - name: Check for benchmark data branch | |
| id: check-bench-branch | |
| run: | | |
| if git ls-remote --exit-code origin gh-benchmarks >/dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create benchmark data branch | |
| if: steps.check-bench-branch.outputs.exists != 'true' && github.event_name == 'push' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git switch --orphan gh-benchmarks | |
| git commit --allow-empty -m "Initialize benchmark data branch" | |
| git push origin gh-benchmarks | |
| git checkout ${{ github.sha }} | |
| - name: Store benchmark results | |
| if: github.event_name == 'push' || steps.check-bench-branch.outputs.exists == 'true' | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| tool: 'pytest' | |
| output-file-path: tmp/benchmark-results.json | |
| gh-pages-branch: gh-benchmarks | |
| benchmark-data-dir-path: dev/bench | |
| auto-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| comment-on-alert: true | |
| comment-always: ${{ github.event_name == 'pull_request' }} | |
| alert-threshold: '110%' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload benchmark results | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: benchmark-results | |
| path: tmp/benchmark-results.json | |
| retention-days: 90 |