Merge pull request #31 from BennyFranciscus/update-blitz-framework #22
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: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'frameworks/**' | |
| workflow_dispatch: | |
| inputs: | |
| framework: | |
| description: 'Framework to benchmark (leave empty for all)' | |
| required: false | |
| default: '' | |
| profile: | |
| description: 'Profile to run (e.g. baseline, baseline-h2, leave empty for all)' | |
| required: false | |
| default: '' | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: benchmark | |
| cancel-in-progress: false | |
| jobs: | |
| benchmark: | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Detect modified frameworks | |
| id: detect | |
| run: | | |
| if [ -n "${{ inputs.framework }}" ]; then | |
| echo "list=${{ inputs.framework }}" >> "$GITHUB_OUTPUT" | |
| else | |
| list=$(git diff --name-only HEAD~1 HEAD \ | |
| | grep '^frameworks/' \ | |
| | cut -d'/' -f2 \ | |
| | sort -u \ | |
| | tr '\n' ' ') | |
| echo "list=$list" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Run benchmarks | |
| if: steps.detect.outputs.list != '' | |
| run: | | |
| for fw in ${{ steps.detect.outputs.list }}; do | |
| echo ">>> Benchmarking: $fw" | |
| ./scripts/benchmark.sh --save "$fw" ${{ inputs.profile }} || echo "WARN: $fw benchmark failed" | |
| done | |
| - name: Commit and push results | |
| if: steps.detect.outputs.list != '' | |
| run: | | |
| git config user.name "HttpArena Bot" | |
| git config user.email "bot@httparena" | |
| git add site/data/ site/static/logs/ 2>/dev/null || true | |
| if ! git diff --cached --quiet; then | |
| git commit -m "benchmark: update results for ${{ steps.detect.outputs.list }}" | |
| git push | |
| fi |