|
1 | 1 | name: CodeCov |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
4 | 8 |
|
5 | 9 | concurrency: |
6 | | - group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + group: ${{ github.head_ref || github.run_id }} |
7 | 11 | cancel-in-progress: true |
8 | 12 |
|
9 | 13 | jobs: |
10 | | - coverage: |
11 | | - runs-on: ${{ matrix.os }} |
| 14 | + tests: |
| 15 | + name: ${{ matrix.database }} Python ${{ matrix.python-version }} |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + |
12 | 18 | strategy: |
13 | 19 | fail-fast: false |
14 | 20 | matrix: |
15 | | - python-version: [ 3.7, 3.8, 3.9, "3.10",] # latest release minus two |
16 | | - requirements-file: [ |
17 | | - dj22_cms38.txt, |
18 | | - dj32_cms38.txt, |
19 | | - dj32_cms39.txt, |
20 | | - dj32_cms310.txt, |
21 | | - dj32_cms311.txt, |
22 | | - dj40_cms311.txt, |
23 | | - ] |
24 | | - os: [ |
25 | | - ubuntu-20.04, |
26 | | - ] |
27 | | - exclude: |
28 | | - - python-version: 3.7 |
29 | | - requirements-file: dj40_cms311.txt |
| 21 | + python-version: |
| 22 | + - 3.8 |
| 23 | + - 3.9 |
| 24 | + - '3.10' |
| 25 | + - '3.11' |
| 26 | + |
30 | 27 | steps: |
31 | | - - uses: actions/checkout@v2 |
32 | | - with: |
33 | | - fetch-depth: '2' |
| 28 | + - uses: actions/checkout@v3 |
34 | 29 |
|
35 | | - - name: Setup Python |
36 | | - uses: actions/setup-python@master |
| 30 | + - uses: actions/setup-python@v4 |
37 | 31 | with: |
38 | 32 | python-version: ${{ matrix.python-version }} |
39 | | - - name: Generate Report |
| 33 | + allow-prereleases: true |
| 34 | + cache: pip |
| 35 | + cache-dependency-path: 'requirements/*.txt' |
| 36 | + |
| 37 | + - name: Install dependencies |
40 | 38 | run: | |
41 | | - pip install -r tests/requirements/${{ matrix.requirements-file }} |
42 | | - coverage run setup.py test |
43 | | - - name: Upload Coverage to Codecov |
44 | | - uses: codecov/codecov-action@v1 |
| 39 | + python -m pip install --upgrade pip setuptools wheel |
| 40 | + python -m pip install --upgrade 'tox>=4.0.0rc3' |
| 41 | +
|
| 42 | + - name: Run tox targets for ${{ matrix.python-version }} |
| 43 | + run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .) |
| 44 | + |
| 45 | + - name: Upload coverage data |
| 46 | + uses: actions/upload-artifact@v3 |
| 47 | + with: |
| 48 | + name: coverage-data |
| 49 | + path: '.coverage*' |
| 50 | + |
| 51 | + coverage: |
| 52 | + name: Coverage |
| 53 | + runs-on: ubuntu-22.04 |
| 54 | + needs: tests |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v3 |
| 57 | + |
| 58 | + - uses: actions/setup-python@v4 |
| 59 | + with: |
| 60 | + python-version: '3.11' |
| 61 | + |
| 62 | + - name: Install dependencies |
| 63 | + run: python -m pip install --upgrade coverage[toml] |
| 64 | + |
| 65 | + - name: Download data |
| 66 | + uses: actions/download-artifact@v3 |
| 67 | + with: |
| 68 | + name: coverage-data |
| 69 | + |
| 70 | + - name: Combine coverage and fail if it's <100% |
| 71 | + run: | |
| 72 | + python -m coverage html --skip-covered --skip-empty |
| 73 | + python -m coverage report --fail-under=100 |
| 74 | +
|
| 75 | + - name: Upload HTML report |
| 76 | + if: ${{ failure() }} |
| 77 | + uses: actions/upload-artifact@v3 |
| 78 | + with: |
| 79 | + name: html-report |
| 80 | + path: htmlcov |
0 commit comments