Update cve-scanning-python.yml #29
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 Unit Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| name: Run Tests with pytest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Needed for setuptools_scm to determine version from git tags | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools setuptools_scm wheel pytest pytest-cov pytest-mock | |
| pip install .[dev] | |
| - name: Run tests with coverage and generate reports | |
| run: | | |
| pytest --cov=rune.runtime --cov-report=term-missing --cov-report=xml:coverage.xml --junitxml=test-results.xml | |
| #- name: Debug - List files after pytest | |
| # run: | | |
| # pwd | |
| # ls -la | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: coverage.xml | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: pytest-results | |
| path: test-results.xml | |
| - name: Publish Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: always() # Run even if tests fail | |
| with: | |
| files: test-results.xml | |
| # disabled for now as codecov appears not to be working with xml reports | |
| #- name: Upload coverage to Codecov | |
| # uses: codecov/codecov-action@v4 | |
| # with: | |
| # files: coverage.xml | |
| # fail_ci_if_error: true | |
| # verbose: true |