|
| 1 | +name: Run benchmarks main |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +jobs: |
| 9 | + run_benchmarks: |
| 10 | + name: Run benchmarks |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout main branch |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + ref: main |
| 17 | + |
| 18 | + - name: Setup python |
| 19 | + uses: actions/setup-python@v5 |
| 20 | + with: |
| 21 | + python-version: '3.9' |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: make install |
| 25 | + |
| 26 | + - name: Run benchmarks |
| 27 | + run: pytest --benchmark-only --benchmark-json benchmarks.json |
| 28 | + |
| 29 | + - name: Upload artifact - benchmarks JSON |
| 30 | + uses: actions/upload-artifact@v4 |
| 31 | + with: |
| 32 | + name: benchmarks_json |
| 33 | + path: benchmarks.json |
| 34 | + # Short retention. Only needed short term to share with the `extract_benchmarks` job. |
| 35 | + retention-days: 1 |
| 36 | + |
| 37 | + extract_benchmarks: |
| 38 | + name: Extract benchmarks |
| 39 | + runs-on: ubuntu-latest |
| 40 | + needs: [ run_benchmarks ] |
| 41 | + steps: |
| 42 | + - name: Checkout benchmarks-data branch |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + ref: benchmarks-data |
| 46 | + |
| 47 | + - name: Install uv |
| 48 | + uses: astral-sh/setup-uv@v5 |
| 49 | + |
| 50 | + - name: Download artifact - benchmarks JSON |
| 51 | + uses: actions/download-artifact@v4 |
| 52 | + with: |
| 53 | + name: benchmarks_json |
| 54 | + |
| 55 | + - name: Extract benchmarks |
| 56 | + run: | |
| 57 | + uv run scripts/extract_benchmarks.py \ |
| 58 | + -i benchmarks.json \ |
| 59 | + -o "uncollected/$(uuidgen).csv" \ |
| 60 | + -t ubuntu-latest |
| 61 | +
|
| 62 | + - name: Remove benchmarks JSON |
| 63 | + run: rm benchmarks.json |
| 64 | + |
| 65 | + - name: Add and commit benchmarks data |
| 66 | + run: | |
| 67 | + git config user.name github-actions |
| 68 | + git config user.email [email protected] |
| 69 | + |
| 70 | + git add --all |
| 71 | + git commit -m "Add uncollected benchmarks" |
| 72 | +
|
| 73 | + # Retry below incase another workflow pushed to the benchmarks-data branch since we checked it out. |
| 74 | + # Unlikely but technically possible... |
| 75 | + # There won't be a merge conflict since we used a UUID as the file name. |
| 76 | + scripts/push_with_retry.sh 5 |
0 commit comments