Skip to content

Commit

Permalink
Use coverage directly instead of dwas for reporting coverage
Browse files Browse the repository at this point in the history
We will want to compiel coverage from multiple OSs, which we do not
handle normally otherwise. As such, let's just use coverage, it's going
to be faster too
  • Loading branch information
BenjaminSchubert committed Dec 30, 2023
1 parent 6827691 commit 9a73df3
Showing 1 changed file with 39 additions and 31 deletions.
70 changes: 39 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
path: ${{ env.JUNIT_REPORT_PATH }}/junit-${{ matrix.os }}-${{ matrix.python }}.xml
retention-days: 7

coverage:
report:
runs-on: ubuntu-latest
needs: test
if: always()
Expand All @@ -154,37 +154,21 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: pip

# FIXME: we should take dwas from pypi once it's published
- name: Install dwas
run: python -m pip install .
- name: Install package dependencies
run: pip install tabulate

- name: Download generated coverage files
- name: Download junit reports
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: coverage-*
path: .dwas/cache

- name: Generate coverage report
run: dwas --verbose --only coverage

- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
files: ./_artifacts/coverage/coverage.xml
fail_ci_if_error: true
verbose: true
pattern: junit-*
path: reports/

- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: coverage [html]
path: _artifacts/coverage/html
retention-days: 7
- name: Generate summary
run: python .github/scripts/summary.py reports/*.xml > "${GITHUB_STEP_SUMMARY}"

report:
coverage:
runs-on: ubuntu-latest
needs: test
if: always()
Expand All @@ -197,19 +181,43 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: pip

- name: Install package dependencies
run: pip install tabulate
- name: Install coverage
run: python -m pip install coverage[toml]

- name: Download junit reports
- name: Download generated coverage files
uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: junit-*
pattern: coverage-*
path: reports/

- name: Generate summary
run: python .github/scripts/summary.py reports/*.xml > "${GITHUB_STEP_SUMMARY}"
- name: Combine coverage files
run: coverage combine reports/*/*/coverage

- name: Generate coverage summary
run: coverage report --format=markdown --show-missing | tee "${GITHUB_STEP_SUMMARY}"

- name: Generate xml coverage
run: coverage xml -o _artifacts/coverage.xml

- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
files: ./_artifacts/coverage.xml
fail_ci_if_error: true
verbose: true

- name: Generate html coverage
run: coverage html --directory _artifacts/coverage/html

- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: coverage [html]
path: _artifacts/coverage/html
retention-days: 7

twine:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 9a73df3

Please sign in to comment.