|
75 | 75 | DB_PASSWORD: debug_toolbar |
76 | 76 | DB_HOST: 127.0.0.1 |
77 | 77 | DB_PORT: 3306 |
| 78 | + COVERAGE_FILE: ".coverage.mysql.${{ matrix.python-version }}" |
| 79 | + |
| 80 | + - name: Store coverage file |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: coverage-mysql-${{ matrix.python-version }} |
| 84 | + path: .coverage.mysql.${{ matrix.python-version }}* |
| 85 | + include-hidden-files: true |
78 | 86 |
|
79 | 87 |
|
80 | 88 | postgres: |
@@ -169,6 +177,14 @@ jobs: |
169 | 177 | DB_HOST: localhost |
170 | 178 | DB_PORT: 5432 |
171 | 179 | DJANGO_SELENIUM_TESTS: ${{ matrix.env.DJANGO_SELENIUM_TESTS }} |
| 180 | + COVERAGE_FILE: ".coverage.${{ matrix.database }}.${{ matrix.python-version }}" |
| 181 | + |
| 182 | + - name: Store coverage file |
| 183 | + uses: actions/upload-artifact@v4 |
| 184 | + with: |
| 185 | + name: coverage-${{ matrix.database }}-${{ matrix.python-version }} |
| 186 | + path: .coverage.${{ matrix.database }}.${{ matrix.python-version }}* |
| 187 | + include-hidden-files: true |
172 | 188 |
|
173 | 189 | sqlite: |
174 | 190 | runs-on: ubuntu-latest |
@@ -214,6 +230,14 @@ jobs: |
214 | 230 | env: |
215 | 231 | DB_BACKEND: sqlite3 |
216 | 232 | DB_NAME: ":memory:" |
| 233 | + COVERAGE_FILE: ".coverage.sqlite.${{ matrix.python-version }}" |
| 234 | + |
| 235 | + - name: Store coverage file |
| 236 | + uses: actions/upload-artifact@v4 |
| 237 | + with: |
| 238 | + name: coverage-sqlite-${{ matrix.python-version }} |
| 239 | + path: .coverage.sqlite.${{ matrix.python-version }}* |
| 240 | + include-hidden-files: true |
217 | 241 |
|
218 | 242 | lint: |
219 | 243 | runs-on: ubuntu-latest |
@@ -252,3 +276,38 @@ jobs: |
252 | 276 |
|
253 | 277 | - name: Test with tox |
254 | 278 | run: tox -e docs,packaging |
| 279 | + |
| 280 | + coverage: |
| 281 | + name: Coverage |
| 282 | + runs-on: ubuntu-latest |
| 283 | + needs: |
| 284 | + - mysql |
| 285 | + - postgres |
| 286 | + - sqlite |
| 287 | + permissions: |
| 288 | + pull-requests: write |
| 289 | + contents: write |
| 290 | + steps: |
| 291 | + - uses: actions/checkout@v4 |
| 292 | + with: |
| 293 | + persist-credentials: false |
| 294 | + |
| 295 | + - uses: actions/download-artifact@v4 |
| 296 | + id: download |
| 297 | + with: |
| 298 | + pattern: coverage-* |
| 299 | + merge-multiple: true |
| 300 | + |
| 301 | + - name: Coverage comment |
| 302 | + id: coverage_comment |
| 303 | + uses: py-cov-action/python-coverage-comment-action@6494290850a5098c2836298dad8f11082b4ceaa9 # v3 |
| 304 | + with: |
| 305 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 306 | + MERGE_COVERAGE_FILES: true |
| 307 | + |
| 308 | + - name: Store Pull Request comment to be posted |
| 309 | + uses: actions/upload-artifact@v4 |
| 310 | + if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' |
| 311 | + with: |
| 312 | + name: python-coverage-comment-action |
| 313 | + path: python-coverage-comment-action.txt |
0 commit comments