Merge pull request #684 from abrcrmb/feat/grpc-serving-tensorflow #52
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: Performance Regression Checks | |
| on: | |
| pull_request: | |
| branches: [ main, develop ] | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| performance-benchmarks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for baseline comparison | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: pip | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-benchmark pytest-regressions | |
| - name: Run benchmarks (issue #559) | |
| run: | | |
| pytest tests/performance/test_benchmarks.py \ | |
| --benchmark-only \ | |
| --benchmark-json=benchmark_results.json \ | |
| --benchmark-autosave \ | |
| --benchmark-save-data | |
| - name: Store baseline on main branch | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| run: | | |
| mkdir -p benchmarks | |
| cp benchmark_results.json benchmarks/baseline.json | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add benchmarks/baseline.json | |
| git commit -m "Update performance baseline [skip ci]" || true | |
| git push | |
| - name: Compare against baseline | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| python scripts/compare_benchmarks.py \ | |
| --current benchmark_results.json \ | |
| --baseline benchmarks/baseline.json \ | |
| --threshold-warning 0.10 \ | |
| --threshold-fail 0.20 \ | |
| --output comparison_report.md | |
| - name: Comment on PR with results | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const report = fs.readFileSync('comparison_report.md', 'utf8'); | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: report | |
| }); | |
| - name: Fail on significant regression | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| python scripts/compare_benchmarks.py \ | |
| --current benchmark_results.json \ | |
| --baseline benchmarks/baseline.json \ | |
| --threshold-warning 0.10 \ | |
| --threshold-fail 0.20 \ | |
| --fail-on-regression | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-results | |
| path: | | |
| benchmark_results.json | |
| comparison_report.md | |
| retention-days: 30 |