/ concept-collection / benchcompress
Sign in
concept-collection / benchcompress
benchcompress / .github / workflows / benchmark.yml
65 lines · 1.9 KBBlameHistoryRaw
1name: Run Benchmarks
3on:
4 workflow_dispatch: # Manual trigger
5 push:
6 branches: [ main ] # Run on main branch pushes
8permissions:
9 contents: write
11jobs:
12 benchmark:
13 name: Run Benchmarks
14 runs-on: ubuntu-latest
16 steps:
17 - uses: actions/checkout@v4
19 - name: Set up Python
20 uses: actions/setup-python@v4
21 with:
22 python-version: '3.12'
24 - name: Install package and dependencies
25 run: |
26 cd zia_benchmark
27 pip install -e .
29 - name: Run benchmarks
30 env:
31 MEMOBIN_API_KEY: ${{ secrets.MEMOBIN_API_KEY }}
32 run: |
33 python zia_benchmark/src/zia_benchmark/run_benchmarks.py
35 - name: Configure Git
36 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
37 run: |
38 git config user.name "GitHub Actions Bot"
39 git config user.email "actions@github.com"
41 - name: Create fresh results branch
42 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
43 run: |
44 git checkout --orphan benchmark-results
45 git rm -rf .
46 mkdir -p benchmark_results
48 - name: Move benchmark files
49 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
50 run: |
51 if [ -f benchmark_results/results.json ]; then
52 mv benchmark_results/results.json benchmark_results/
53 else
54 echo "No benchmark results found"
55 exit 1
56 fi
58 - name: Commit benchmark results
59 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
60 env:
61 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62 run: |
63 git add benchmark_results/
64 git commit -m "Update benchmark results from $(date +'%Y-%m-%d %H:%M:%S') [skip ci]"
65 git push -f https://${GITHUB_TOKEN}@github.com/${{ github.repository }} benchmark-results
moveopenescclose