smptr0911 #5
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: GitHub Pytest Runs | |
| run-name: ${{ github.actor }} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - issue-4/configuring-ci-cd-pytest | |
| paths-ignore: | |
| - 'README.md' | |
| # - '.github/workflows/pyTest_runs.yml' | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'README.md' | |
| # This workflow will run pytest on the codebase and upload the results as an artifact | |
| jobs: | |
| pytest: | |
| # lasest version of Ubuntu | |
| runs-on: ubuntu-latest | |
| steps: | |
| # This inputs a message to the console | |
| - run: echo "Running Pytest" | |
| # This checks out the code from the repository so that it can be tested 'actions/checkout@v3' | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest | |
| - name: Run tests | |
| run: | | |
| python -m pytest tests/ --junitxml=results.xml | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() # This ensures that the artifact is uploaded even if the tests fail | |
| with: | |
| name: pytest-results | |
| path: results.xml |