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 python -m pip install -e zia_benchmark/
28 - name: Run benchmarks
29 env:
30 MEMOBIN_API_KEY: ${{ secrets.MEMOBIN_API_KEY }}
31 run: |
32 python zia_benchmark/src/zia_benchmark/run_benchmarks.py
34 - name: Configure Git
35 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
36 run: |
37 git config user.name "GitHub Actions Bot"
38 git config user.email "actions@github.com"
40 - name: Create fresh results branch
41 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
42 run: |
43 git checkout --orphan benchmark-results
44 git rm -rf .
45 mkdir -p benchmark_results
47 - name: Move benchmark files
48 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
49 run: |
50 if [ -f benchmark_results/results.json ]; then
51 mv benchmark_results/results.json benchmark_results/
52 else
53 echo "No benchmark results found"
54 exit 1
55 fi
57 - name: Commit benchmark results
58 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
59 env:
60 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61 run: |
62 git add benchmark_results/
63 git commit -m "Update benchmark results from $(date +'%Y-%m-%d %H:%M:%S') [skip ci]"
64 git push -f https://${GITHUB_TOKEN}@github.com/${{ github.repository }} benchmark-results