add workflow
2 changed files+66−0
.github/workflows/benchmark.ymladded+64−0View file
@@ -0,0 +1,64 @@
1+name: Run Benchmarks
2+
3+on:
4+ workflow_dispatch: # Manual trigger
5+ push:
6+ branches: [ main ] # Run on main branch pushes
7+
8+permissions:
9+ contents: write
10+
11+jobs:
12+ benchmark:
13+ name: Run Benchmarks
14+ runs-on: ubuntu-latest
15+
16+ steps:
17+ - uses: actions/checkout@v4
18+
19+ - name: Set up Python
20+ uses: actions/setup-python@v4
21+ with:
22+ python-version: '3.12'
23+
24+ - name: Install package and dependencies
25+ run: |
26+ python -m pip install -e zia_benchmark/
27+
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
33+
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"
39+
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
46+
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
56+
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
.gitignoreadded+2−0View file
@@ -0,0 +1,2 @@
1+benchmark_resuts
2+.benchmark_cache