Benchmark #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Benchmark | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * 0' # Every Sunday at midnight | |
| jobs: | |
| benchmark: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: write | |
| deployments: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Python dependencies | |
| run: pip install gitpython semver coloredlogs | |
| - name: Run benchmark | |
| run: python -m benchmark run | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-results | |
| path: benchmark/results/benchmark.json | |
| - name: Commit benchmark results to repo | |
| run: | | |
| cp benchmark/results/benchmark.json docs/public/data/benchmark.json | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add docs/public/data/benchmark.json | |
| git diff --cached --quiet || git commit -m "chore: update benchmark results" | |
| git push | |
| # Deploy site with fresh benchmark data | |
| # (GITHUB_TOKEN commits don't trigger other workflows, so we deploy here directly) | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Install site dependencies | |
| working-directory: docs | |
| run: npm ci | |
| - name: Build site | |
| working-directory: docs | |
| run: npm run build | |
| - name: Deploy to Cloudflare Pages | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| command: pages deploy docs/dist --project-name=githacker --branch=main --commit-dirty=true | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |