|
1 | 1 | name: Coverage |
2 | 2 | # Make sure pull requests increase coverage monotonically |
3 | 3 |
|
4 | | -on: [pull_request] |
| 4 | +on: |
| 5 | + pull_request: |
5 | 6 |
|
6 | 7 | jobs: |
7 | | - build: |
| 8 | + pytests: |
| 9 | + uses: ./.github/workflows/pytest.yml # use the callable pytest.yml workflow to run tests |
8 | 10 |
|
9 | | - runs-on: ${{ matrix.os }} |
10 | | - strategy: |
11 | | - matrix: |
12 | | - # os: [ubuntu-latest, macos-latest, windows-latest] |
13 | | - # python-version: ["3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"] |
14 | | - os: [ubuntu-latest] |
15 | | - python-version: ["3.12"] |
| 11 | + add_coverage_to_pullrequest: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + needs: pytests |
16 | 14 |
|
17 | 15 | steps: |
18 | | - - name: Checkout |
| 16 | + - name: Checkout code |
19 | 17 | uses: actions/checkout@v4 |
20 | 18 |
|
21 | | - - name: Set up Python ${{ matrix.python-version }} |
22 | | - uses: actions/setup-python@v5 |
| 19 | + - name: Download coverage report |
| 20 | + uses: actions/download-artifact@v4 |
23 | 21 | with: |
24 | | - python-version: ${{ matrix.python-version }} |
25 | | - |
26 | | - - name: Install dependencies |
27 | | - run: | |
28 | | - python -m pip install --upgrade pip setuptools wheel |
29 | | - python -m pip install -U pymavlink pytest pytest-cov coverage mock |
30 | | - pip install build |
31 | | - pip install -U . |
32 | | -
|
33 | | - - name: Install apt packages |
34 | | - run: | |
35 | | - sudo apt-get update |
36 | | - sudo apt-get install -y xvfb |
37 | | -
|
38 | | - - name: Test with unittest |
39 | | - run: | |
40 | | - export DISPLAY=:99 |
41 | | - Xvfb :99 -screen 0 1024x768x16 & |
42 | | - coverage run -m pytest |
43 | | - coverage xml -o tests/coverage.xml |
| 22 | + name: coverage-report-3.9 |
44 | 23 |
|
45 | 24 | - name: Get Cover |
46 | 25 | uses: andraghetti/coverage@v3.2 |
47 | 26 | with: |
48 | | - coverageFile: tests/coverage.xml |
| 27 | + coverageFile: coverage-3.9.xml |
49 | 28 | token: ${{ secrets.GITHUB_TOKEN }} |
50 | 29 | # Use always() to always run this step to publish test results when there are test failures |
51 | 30 | if: ${{ always() }} |
0 commit comments