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