Nightly Regression Tests #7
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: Nightly Regression Tests | |
on: | |
schedule: | |
- cron: '0 3 * * *' # Runs every day at 3:00 AM UTC | |
workflow_dispatch: # Allows manual trigger | |
jobs: | |
nightly-tests: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
# Step 3: Cache pip dependencies | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
# Step 4: Install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
# Step 5: Run regression tests with pytest and generate reports | |
- name: Run regression tests | |
run: | | |
pytest --disable-warnings --maxfail=5 --junitxml=results.xml --tb=short | |
continue-on-error: true # Ensures workflow proceeds to the next steps even if tests fail | |
# Step 6: Upload test results as artifacts | |
- name: Upload Test Results | |
if: always() # Ensures this step runs even if tests fail | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: results.xml | |
# Step 7: Display summary message on failure | |
- name: Display Test Summary | |
if: failure() | |
run: | | |
echo "Nightly regression tests completed with issues. Review the test-results artifact for details." |