benchmark CI #3
This file contains 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: Run Benchmarks | |
on: | |
workflow_dispatch: # Manual trigger | |
push: | |
branches: [ main ] # Run on main branch pushes | |
jobs: | |
benchmark: | |
name: Run Benchmarks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install package and test dependencies | |
run: | | |
python -m pip install pytest numpy | |
python -m pip install -e . | |
- name: Run tests | |
run: python -m pytest tests/ | |
- name: Install benchmark dependencies | |
run: | | |
python -m pip install matplotlib zstandard | |
- name: Run benchmark | |
run: | | |
python devel/benchmark.py | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Create and switch to benchmark branch | |
run: | | |
# Create a new orphan branch (no history) | |
git checkout --orphan benchmark-new | |
# Reset the working tree and clear the index | |
git reset --hard | |
# Only add and commit the benchmark files we want | |
git add benchmark_output/benchmark.json benchmark_output/benchmark.png | |
git commit -m "Update benchmark results" | |
- name: Force push to benchmark branch | |
run: | | |
git push origin HEAD:benchmark --force |