chore: update pre-commit hooks #118
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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| - devel | |
| jobs: | |
| check_should_run: | |
| name: Check if benchmarks should run | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should-run: ${{ steps.check.outputs.should-run }} | |
| steps: | |
| - name: Check conditions | |
| id: check | |
| run: | | |
| # Always run on push to main | |
| if [ "${{ github.event_name }}" == "push" ]; then | |
| echo "should-run=true" >> "$GITHUB_OUTPUT" | |
| # For pull requests, only run if the PR has the "benchmark" label | |
| elif [ "${{ github.event_name }}" == "pull_request" ]; then | |
| if [ "${{ contains(github.event.pull_request.labels.*.name, 'benchmark') }}" == "true" ]; then | |
| echo "should-run=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "should-run=false" >> "$GITHUB_OUTPUT" | |
| echo "Skipping because PR does not have 'benchmark' label" | |
| fi | |
| else | |
| echo "should-run=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| benchmarks: | |
| name: "Run the benchmarks" | |
| runs-on: ubuntu-latest | |
| needs: check_should_run | |
| if: | |
| ${{ needs.check_should_run.outputs.should-run == 'true' && | |
| github.event.pull_request.draft == false }} | |
| env: | |
| # Run tests against a tagged EXP version, unless this is the devel branch or a PR into devel, in which case test against EXP devel | |
| EXP_REF: ${{ (github.ref == 'refs/heads/devel' || (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'devel')) && 'devel' || 'v7.9.1' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Setup Linux GSL | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install gsl-bin libgsl0-dev build-essential | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.0" | |
| - name: Install GSL | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install gsl-bin libgsl0-dev build-essential | |
| - name: Clone EXP | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: EXP-code/EXP | |
| submodules: recursive | |
| ref: ${{ env.EXP_REF }} | |
| path: EXP | |
| # TODO: this always clones main, which is the latest release. Do we want to | |
| # also add a benchmark against devel? | |
| - name: Install EXP dependencies | |
| run: | | |
| sudo apt-get install -y libeigen3-dev libfftw3-dev libopenmpi-dev libomp-dev libhdf5-dev | |
| - name: Build EXP | |
| uses: ./.github/actions/build-exp | |
| with: | |
| build-type: Release | |
| - name: Install package and dependencies | |
| run: | | |
| uv pip install --system -ve .[test] | |
| - name: Run the benchmarks | |
| uses: CodSpeedHQ/action@v4 | |
| env: | |
| OMP_NUM_THREADS: 1 | |
| with: | |
| mode: instrumentation | |
| run: uv run pytest tests/benchmarks -n auto --codspeed --durations=0 -v | |
| token: ${{ secrets.CODSPEED_TOKEN }} |