|
| 1 | +name: Coverage |
| 2 | + |
| 3 | +on: [push, pull_request, workflow_dispatch] |
| 4 | + |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | + |
| 8 | +jobs: |
| 9 | + test-under-coverage: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + name: ${{ matrix.name }} |
| 12 | + strategy: |
| 13 | + fail-fast: false
10000
td> |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - name: "Coverage (Sphinx ~=5)" # jQuery deprecated |
| 17 | + sphinx: "sphinx>=5.0.0a0,<6" |
| 18 | + - name: "Coverage (Sphinx >=6)" # jQuery removed |
| 19 | + sphinx: "sphinx>=6.0.0a0" |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v3 |
| 23 | + - name: Set up Python 3 |
| 24 | + uses: actions/setup-python@v4 |
| 25 | + with: |
| 26 | + python-version: "3" |
| 27 | + cache: pip |
| 28 | + cache-dependency-path: .github/workflows/coverage.yml |
| 29 | + - name: Update pip |
| 30 | + run: python -m pip install -U pip |
| 31 | + - name: Install dependencies |
| 32 | + run: python -m pip install -U pytest coverage[toml] "${{ matrix.sphinx }}" |
| 33 | + - name: Install sphinxcontrib-jquery |
| 34 | + run: python -m pip install . |
| 35 | + - name: Run pytest |
| 36 | + run: coverage run --parallel -m pytest -vv |
| 37 | + - name: Upload coverage data |
| 38 | + uses: actions/upload-artifact@v3 |
| 39 | + with: |
| 40 | + name: coverage-reports |
| 41 | + path: .coverage.* |
| 42 | + if-no-files-found: ignore |
| 43 | + |
| 44 | + coverage: |
| 45 | + name: Report coverage |
| 46 | + runs-on: ubuntu-latest |
| 47 | + needs: test-under-coverage |
| 48 | + |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v3 |
| 51 | + - name: Set up Python 3 |
| 52 | + uses: actions/setup-python@v4 |
| 53 | + with: |
| 54 | + python-version: "3" |
| 55 | + cache: pip |
| 56 | + cache-dependency-path: .github/workflows/coverage.yml |
| 57 | + - name: Update pip |
| 58 | + run: python -m pip install -U pip |
| 59 | + - name: Install coverage |
| 60 | + run: python -m pip install -U coverage[toml] |
| 61 | + - uses: actions/download-artifact@v3 |
| 62 | + with: |
| 63 | + name: coverage-reports |
| 64 | + - name: Combine coverage; fail if not 100% |
| 65 | + run: | |
| 66 | + python -m coverage combine |
| 67 | + python -m coverage html --skip-covered --skip-empty |
| 68 | + python -m coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY |
| 69 | + python -m coverage report --fail-under=100 |
| 70 | + - name: Upload the HTML coverage report on failure |
| 71 | + if: failure() |
| 72 | + uses: actions/upload-artifact@v3 |
| 73 | + with: |
| 74 | + name: html-report |
| 75 | + path: htmlcov |
0 commit comments