Add runtime tests #1
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
name: Regression Tests | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
Regression-Test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # This ensures we can checkout main branch too | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run regression tests 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 | |
uses: peter-evans/create-or-update-comment@v2 | |
if: github.event.pull_request.base.ref == 'main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
## Regression Test Results | |
``` | |
$(cat regression_test_report.txt) | |
``` | |
- name: Save regression test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: regression-test-results | |
path: tests/regression_test_results.json |