|
| 1 | +name: Wagtail TinyTableBlock CI |
| 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.13' |
| 25 | + |
| 26 | +jobs: |
| 27 | + test-sqlite: |
| 28 | + runs-on: ubuntu-latest |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + python-version: ["3.12", "3.13"] |
| 32 | + django: ["4.2"] |
| 33 | + wagtail: ["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 }}-sqlite |
| 59 | + path: .coverage.* |
| 60 | + include-hidden-files: true |
| 61 | + if-no-files-found: ignore |
| 62 | + retention-days: 1 |
| 63 | + |
| 64 | + test-postgres: |
| 65 | + runs-on: ubuntu-latest |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + python-version: ["3.12", "3.13"] |
| 69 | + db: ["postgres"] |
| 70 | + |
| 71 | + services: |
| 72 | + postgres: |
| 73 | + image: postgres:15 |
| 74 | + env: |
| 75 | + POSTGRES_PASSWORD: postgres |
| 76 | + ports: |
| 77 | + - 5432:5432 |
| 78 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + - name: Set up Python ${{ matrix.python-version }} |
| 83 | + uses: actions/setup-python@v5 |
| 84 | + with: |
| 85 | + python-version: ${{ matrix.python-version }} |
| 86 | + - name: Install dependencies |
| 87 | + run: | |
| 88 | + python -Im pip install --upgrade pip flit tox tox-gh-actions |
| 89 | +
|
| 90 | + - name: 🏗️ Build wheel |
| 91 | + run: python -Im flit build --format wheel |
| 92 | + |
| 93 | + - name: Test |
| 94 | + env: |
| 95 | + DATABASE_URL: postgres://postgres:postgres@localhost:5432/wagtail_localize_git |
| 96 | + run: tox --installpkg ./dist/*.whl |
| 97 | + |
| 98 | + - name: ⬆️ Upload coverage data |
| 99 | + uses: actions/upload-artifact@v4 |
| 100 | + with: |
| 101 | + name: coverage-data-${{ matrix.python-version }} |
| 102 | + path: .coverage.* |
| 103 | + include-hidden-files: true |
| 104 | + if-no-files-found: ignore |
| 105 | + retention-days: 1 |
| 106 | + |
| 107 | + coverage: |
| 108 | + runs-on: ubuntu-latest |
| 109 | + needs: |
| 110 | + - test-sqlite |
| 111 | + - test-postgres |
| 112 | + |
| 113 | + steps: |
| 114 | + - uses: actions/checkout@v4 |
| 115 | + - uses: actions/setup-python@v5 |
| 116 | + with: |
| 117 | + # Use latest Python, so it understands all syntax. |
| 118 | + python-version: ${{env.PYTHON_LATEST}} |
| 119 | + |
| 120 | + - run: python -Im pip install --upgrade coverage |
| 121 | + |
| 122 | + - name: ⬇️ Download coverage data |
| 123 | + uses: actions/download-artifact@v4 |
| 124 | + with: |
| 125 | + pattern: coverage-data-* |
| 126 | + merge-multiple: true |
| 127 | + |
| 128 | + - name: + Combine coverage |
| 129 | + run: | |
| 130 | + python -Im coverage combine |
| 131 | + python -Im coverage html --skip-covered --skip-empty |
| 132 | + python -Im coverage report |
| 133 | + echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY |
| 134 | + python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY |
| 135 | + - name: 📈 Upload HTML report |
| 136 | + uses: actions/upload-artifact@v4 |
| 137 | + with: |
| 138 | + name: html-report |
| 139 | + path: htmlcov |
0 commit comments