|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - "stable/**" |
| 8 | + |
| 9 | + pull_request: |
| 10 | + branches: [main] |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read # to fetch code (actions/checkout) |
| 18 | + |
| 19 | +env: |
| 20 | + FORCE_COLOR: "1" # Make tools pretty. |
| 21 | + TOX_TESTENV_PASSENV: FORCE_COLOR |
| 22 | + PIP_DISABLE_PIP_VERSION_CHECK: "1" |
| 23 | + PIP_NO_PYTHON_VERSION_WARNING: "1" |
| 24 | + PYTHON_LATEST: "3.11" |
| 25 | + |
| 26 | +jobs: |
| 27 | + test: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + python-version: ["3.11", "3.12"] |
| 32 | + django: ["5.1"] |
| 33 | + wagtail: ["6.2", "6.3"] |
| 34 | + db: ["sqlite"] |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Set up Python ${{ matrix.python-version }} |
| 39 | + uses: actions/setup-python@v5 |
| 40 | + with: |
| 41 | + python-version: ${{ matrix.python-version }} |
| 42 | + |
| 43 | + - name: Install dependencies |
| 44 | + run: | |
| 45 | + python -Im pip install --upgrade pip flit tox tox-gh-actions |
| 46 | +
|
| 47 | + - name: 🏗️ Build wheel |
| 48 | + run: python -Im flit build --format wheel |
| 49 | + |
| 50 | + - name: Test |
| 51 | + env: |
| 52 | + TOXENV: py${{ matrix.python-version }}-django${{ matrix.django }}-wagtail${{ matrix.wagtail }}-sqlite |
| 53 | + run: tox --installpkg ./dist/*.whl |
| 54 | + |
| 55 | + - name: ⬆️ Upload coverage data |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: coverage-data-${{ matrix.python-version }}-${{ matrix.django }}-${{ matrix.wagtail }}-sqlite |
| 59 | + path: .coverage.* |
| 60 | + if-no-files-found: ignore |
| 61 | + include-hidden-files: true |
| 62 | + retention-days: 1 |
| 63 | + |
| 64 | + coverage: |
| 65 | + runs-on: ubuntu-latest |
| 66 | + needs: |
| 67 | + - test |
| 68 | + |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v4 |
| 71 | + - uses: actions/setup-python@v5 |
| 72 | + with: |
| 73 | + # Use latest Python, so it understands all syntax. |
| 74 | + python-version: ${{env.PYTHON_LATEST}} |
| 75 | + |
| 76 | + - run: python -Im pip install --upgrade coverage |
| 77 | + |
| 78 | + - name: ⬇️ Download coverage data |
| 79 | + uses: actions/download-artifact@v4 |
| 80 | + with: |
| 81 | + pattern: coverage-data-* |
| 82 | + merge-multiple: true |
| 83 | + |
| 84 | + - name: + Combine coverage |
| 85 | + run: | |
| 86 | + python -Im coverage combine |
| 87 | + python -Im coverage html --skip-covered --skip-empty |
| 88 | + python -Im coverage report |
| 89 | + echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY |
| 90 | + python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY |
| 91 | + - name: 📈 Upload HTML report |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: html-report |
| 95 | + path: htmlcov |
0 commit comments