/ concept-collection / benchcompress
concept-collection / benchcompress
benchcompress / .github / workflows / benchmark.yml
75 lines · 2.2 KBBlameHistoryRaw
1name: Run Benchmarks
3# Add concurrency to cancel in-progress jobs
4concurrency:
5 group: ${{ github.workflow }}-${{ github.ref }}
6 cancel-in-progress: true
8on:
9 workflow_dispatch: # Manual trigger
10 push:
11 branches: [ main ] # Run on main branch pushes
12 paths:
13 - 'benchcompress/**' # Run only if benchmarks are updated
15permissions:
16 contents: write
18jobs:
19 benchmark:
20 name: Run Benchmarks
21 runs-on: ubuntu-latest
23 steps:
24 - uses: actions/checkout@v4
26 - name: Set up Python
27 uses: actions/setup-python@v4
28 with:
29 python-version: '3.12'
31 - name: Install package and dependencies
32 run: |
33 cd benchcompress
34 pip install -e .
36 - name: Install simple_ans from source for now
37 run: |
38 git clone https://github.com/flatironinstitute/simple_ans.git
39 cd simple_ans
40 pip install -e .
42 - name: Run benchmarks
43 env:
44 MEMOBIN_API_KEY: ${{ secrets.MEMOBIN_API_KEY }}
45 UPLOAD_TO_MEMOBIN: '1'
46 run: |
47 python scripts/run_benchmarks.py
49 - name: Upload benchmark results as artifacts
50 uses: actions/upload-artifact@v4
51 with:
52 name: benchmark-results
53 path: |
54 benchcompress/benchmark_results/results.json
56 - name: Configure Git
57 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
58 run: |
59 git config user.name "GitHub Actions Bot"
60 git config user.email "actions@github.com"
62 - name: Create fresh results branch
63 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
64 run: |
65 git checkout --orphan benchmark-results
67 - name: Commit benchmark results
68 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
69 env:
70 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71 run: |
72 # need to force add because it's in the .gitignore
73 git add -f benchmark_results/
74 git commit -m "Update benchmark results from $(date +'%Y-%m-%d %H:%M:%S') [skip ci]"
75 git push -f https://${GITHUB_TOKEN}@github.com/${{ github.repository }} benchmark-results