Add runtime tests #6
Workflow file for this run
This file contains 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
# .github/workflows/regression_tests.yml | |
name: Regression Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
regression_tests: | |
name: regression_tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
fetch-depth: 0 # This ensures we can checkout main branch too | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
architecture: 'x64' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[dev]" | |
- name: Run benchmarks on PR branch | |
run: | | |
python tests/regression_test_runner.py | |
- name: Compare to main | |
if: github.event.pull_request.base.ref == 'main' | |
run: | | |
# Check if regression test results exist in main branch | |
git checkout main | |
if [ -f 'tests/regression_test_results.json' ]; then | |
python tests/regression_test_runner.py > regression_test_report.txt | |
else | |
echo "No regression test results found in main branch" > regression_test_report.txt | |
fi | |
git checkout - | |
- name: Comment PR | |
if: github.event.pull_request.base.ref == 'main' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs'); | |
const TestReport = fs.readFileSync('regression_test_report.txt', 'utf8'); | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `## Regression Test Results\n\`\`\`\n${TestReport}\n\`\`\`` | |
}); |