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 scripts/run_benchmarks.py
35 - name: Upload benchmark results as artifacts
36 uses: actions/upload-artifact@v4
37 with:
38 name: benchmark-results
39 path: |
40 zia_benchmark/benchmark_results/results.json
42 - name: Configure Git
43 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
44 run: |
45 git config user.name "GitHub Actions Bot"
46 git config user.email "actions@github.com"
48 - name: Create fresh results branch
49 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
50 run: |
51 git checkout --orphan benchmark-results
53 - name: Commit benchmark results
54 if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
55 env:
56 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57 run: |
58 git add benchmark_results/
59 git commit -m "Update benchmark results from $(date +'%Y-%m-%d %H:%M:%S') [skip ci]"
60 git push -f https://${GITHUB_TOKEN}@github.com/${{ github.repository }} benchmark-results