updated test.yml file #3
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: Run Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt # Install dependencies from requirements.txt | |
| pip install pytest # Ensure pytest is installed | |
| - name: Run tests | |
| run: | | |
| pytest --maxfail=1 --disable-warnings -q # Stop after 1 failed test, disable warnings, and show results quietly | |
| - name: Upload test results (if tests fail) | |
| if: failure() # This step will only run if tests fail | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: test-results | |
| path: tests/test-results.xml # Make sure you have pytest XML output configured if you want this | |