|
| 1 | +name: benchmarks |
| 2 | + |
| 3 | +on: |
| 4 | + # Run action on certain pull request events |
| 5 | + pull_request: |
| 6 | + types: [opened, synchronize, reopened, ready_for_review] |
| 7 | + |
| 8 | + # Nightly job on default (main) branch |
| 9 | + schedule: |
| 10 | + - cron: '0 0 * * *' |
| 11 | + |
| 12 | + # Whenever certain branches are pushed |
| 13 | + push: |
| 14 | + branches: [main] |
| 15 | + |
| 16 | + # On demand from github.com for testing |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +# Ensures that only one workflow runs at a time for this branch |
| 20 | +concurrency: |
| 21 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + pixi_run_benchmarks: |
| 26 | + env: |
| 27 | + SCCACHE_DIR: ${{ github.workspace }}/.sccache |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + # TODO: Re-enable when we do not have self-hosted runners in the public repo |
| 31 | + # matrix: |
| 32 | + # ubuntu_version: [22.04, 24.04] |
| 33 | + |
| 34 | + runs-on: self-hosted #ubuntu-${{ matrix.ubuntu_version }} |
| 35 | + steps: |
| 36 | + - name: Check out repository |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + submodules: true |
| 40 | + # Cache build directories and sccache |
| 41 | + - name: Cache build directories and sccache |
| 42 | + uses: actions/cache@v4 |
| 43 | + with: |
| 44 | + path: | |
| 45 | + ${{ env.SCCACHE_DIR }} |
| 46 | + key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} |
| 47 | + restore-keys: | |
| 48 | + ${{ runner.os }}-build-${{ github.sha }} |
| 49 | + ${{ runner.os }}-build |
| 50 | + - uses: prefix-dev/setup-pixi@v0.8.14 |
| 51 | + with: |
| 52 | + cache: true |
| 53 | + cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }} |
| 54 | + frozen: true |
| 55 | + manifest-path: pixi.toml |
| 56 | + # TODO: Remove this when we do not have self-hosted runners in the public repo |
| 57 | + pixi-bin-path: ~/actions-runner/.pixi/bin/pixi |
| 58 | + - name: Build and test |
| 59 | + run: | |
| 60 | + pixi run install_all |
| 61 | + - name: Run python benchmarks |
| 62 | + run: pytest benchmarks/ --benchmark-json pytest_benchmarks.json |
| 63 | + - name: Store benchmark results |
| 64 | + uses: benchmark-action/github-action-benchmark@v1 |
| 65 | + with: |
| 66 | + name: Python Benchmark with pytest-benchmark |
| 67 | + tool: 'pytest' |
| 68 | + output-file-path: pytest_benchmarks.json |
| 69 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + auto-push: true |
| 71 | + alert-threshold: '125%' |
| 72 | + comment-on-alert: true |
| 73 | + fail-on-alert: true |
0 commit comments