Skip to content

Commit

Permalink
ci: combine coverage reports
Browse files Browse the repository at this point in the history
  • Loading branch information
eginhard committed Mar 11, 2024
1 parent b4fded6 commit 6a137a1
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 12 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: coverage

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
coverage:
if: always()
needs: vocoder-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- name: Combine coverage
run:
python -Im pip install --upgrade coverage[toml]|

python -Im coverage combine
python -Im coverage html --skip-covered --skip-empty

# Report and write to summary.
python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY

# Report again
python -Im coverage report
- name: Upload HTML report if check failed
uses: actions/upload-artifact@v4
with:
name: html-report
path: htmlcov
if: ${{ failure() }}
6 changes: 6 additions & 0 deletions .github/workflows/vocoder_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ jobs:
python3 setup.py egg_info
- name: Unit tests
run: make test_vocoder
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ github.action }}-${{ matrix.python-version }}
path: .coverage.*
if-no-files-found: ignore
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@ test_all: ## run tests and don't stop on an error.
./run_bash_tests.sh

test: ## run tests.
nose2 -F -v -B --with-coverage --coverage TTS tests
coverage run -m nose2 -F -v -B tests

test_vocoder: ## run vocoder tests.
nose2 -F -v -B --with-coverage --coverage TTS tests.vocoder_tests
coverage run -m nose2 -F -v -B tests.vocoder_tests

test_tts: ## run tts tests.
nose2 -F -v -B --with-coverage --coverage TTS tests.tts_tests
coverage run -m nose2 -F -v -B tests.tts_tests

test_tts2: ## run tts tests.
nose2 -F -v -B --with-coverage --coverage TTS tests.tts_tests2
coverage run -m nose2 -F -v -B tests.tts_tests2

test_xtts:
nose2 -F -v -B --with-coverage --coverage TTS tests.xtts_tests
coverage run -m nose2 -F -v -B tests.xtts_tests

test_aux: ## run aux tests.
nose2 -F -v -B --with-coverage --coverage TTS tests.aux_tests
coverage run -m nose2 -F -v -B tests.aux_tests
./run_bash_tests.sh

test_zoo: ## run zoo tests.
nose2 -F -v -B --with-coverage --coverage TTS tests.zoo_tests
coverage run -m nose2 -F -v -B tests.zoo_tests

inference_tests: ## run inference tests.
nose2 -F -v -B --with-coverage --coverage TTS tests.inference_tests
coverage run -m nose2 -F -v -B tests.inference_tests

data_tests: ## run data tests.
nose2 -F -v -B --with-coverage --coverage TTS tests.data_tests
coverage run -m nose2 -F -v -B tests.data_tests

test_text: ## run text tests.
nose2 -F -v -B --with-coverage --coverage TTS tests.text_tests
coverage run -m nose2 -F -v -B tests.text_tests

test_failed: ## only run tests failed the last time.
nose2 -F -v -B --with-coverage --coverage TTS tests
coverage run -m nose2 -F -v -B tests

style: ## update code style.
black ${target_dirs}
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,7 @@ max-returns = 7
[tool.black]
line-length = 120
target-version = ['py39']

[tool.coverage.run]
parallel = true
source = ["TTS"]
2 changes: 1 addition & 1 deletion requirements.dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==24.2.0
coverage
coverage[toml]
nose2
ruff==0.3.0

0 comments on commit 6a137a1

Please sign in to comment.