|
1 | | -name: Test |
2 | | - |
3 | 1 | on: |
4 | 2 | push: |
5 | 3 | branches: |
|
9 | 7 | - cron: '0 8 * * *' |
10 | 8 |
|
11 | 9 | jobs: |
| 10 | + |
12 | 11 | test: |
13 | | - name: 'Python ${{ matrix.python-version }} Django ${{ matrix.django-version }}' |
| 12 | + name: 'Test: Python ${{ matrix.python-version }} Django ${{ matrix.django-version }}' |
14 | 13 | runs-on: ubuntu-latest |
15 | 14 | strategy: |
16 | 15 | fail-fast: false |
|
20 | 19 | env: |
21 | 20 | PYTHONUNBUFFERED: 1 |
22 | 21 | PYTHONWARNINGS: always |
| 22 | + COVERAGE_FILE: coverage # note: not .coverage: https://github.com/actions/upload-artifact/issues/447 |
23 | 23 | steps: |
24 | 24 | - name: Checkout |
25 | 25 | run: | |
|
54 | 54 | - name: 'Install Browsers for Playwright tests' |
55 | 55 | run: make playwright-install |
56 | 56 |
|
57 | | - - name: 'Run tests with Python ${{ matrix.python-version }} Django ${{ matrix.django-version }}' |
| 57 | + - name: 'Run tests with Python ${{ matrix.python-version }} + Django ${{ matrix.django-version }}' |
58 | 58 | run: poetry run tox -e $(echo py${{ matrix.python-version }}-django${{ matrix.django-version }} | tr -d .) |
59 | 59 |
|
60 | | - - name: 'Upload coverage report' |
61 | | - run: bash <(curl -s https://codecov.io/bash) |
| 60 | + - name: Store partial coverage data |
| 61 | + uses: actions/upload-artifact@v3 |
| 62 | + with: |
| 63 | + name: coverage-data |
| 64 | + path: "coverage.*" # note: not .coverage: https://github.com/actions/upload-artifact/issues/447 |
| 65 | + if-no-files-found: error |
| 66 | + # crash if no files for upload could be found. |
| 67 | + # the most likely reasons for that are an error with the coverage tool itself |
| 68 | + # or a disparity between configured tox envs and the action's matrix. |
| 69 | + |
| 70 | + coverage: |
| 71 | + name: Coverage report |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: test |
| 74 | + env: |
| 75 | + COVERAGE_FILE: coverage # note: not .coverage: https://github.com/actions/upload-artifact/issues/447 |
| 76 | + steps: |
| 77 | + - name: Checkout |
| 78 | + uses: actions/checkout@v4 |
| 79 | + |
| 80 | + - name: Setup Python |
| 81 | + uses: actions/setup-python@v4 |
| 82 | + with: |
| 83 | + python-version: "3.11" |
| 84 | + |
| 85 | + - name: Install coverage |
| 86 | + run: python -m pip install --upgrade coverage[toml] |
| 87 | + |
| 88 | + - name: Download partial coverage data |
| 89 | + uses: actions/download-artifact@v3 |
| 90 | + |
| 91 | + - name: Combine individual data files |
| 92 | + run: python -m coverage combine coverage-data/ |
| 93 | + |
| 94 | + - name: Print report |
| 95 | + run: python -m coverage report |
| 96 | + |
| 97 | + - name: Generate HTML report |
| 98 | + run: python -m coverage html |
| 99 | + |
| 100 | + - name: Upload HTML report artifact |
| 101 | + uses: actions/upload-artifact@v3 |
| 102 | + with: |
| 103 | + name: coverage-html-report |
| 104 | + path: "htmlcov/*" |
| 105 | + if-no-files-found: error |
| 106 | + |
| 107 | + - name: Upload report to Codecov |
| 108 | + uses: codecov/codecov-action@v3 |
| 109 | + env: |
| 110 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 111 | + with: |
| 112 | + fail_ci_if_error: true |
0 commit comments