From 31412a27bdbe6b6e8b732e3634b048659edc4826 Mon Sep 17 00:00:00 2001 From: Enno Hermann Date: Mon, 11 Mar 2024 11:24:23 +0100 Subject: [PATCH] ci: combine coverage reports --- .github/workflows/vocoder_tests.yml | 36 ++++++++++++++++++++++++++++- Makefile | 22 +++++++++--------- pyproject.toml | 4 ++++ requirements.dev.txt | 2 +- 4 files changed, 51 insertions(+), 13 deletions(-) diff --git a/.github/workflows/vocoder_tests.yml b/.github/workflows/vocoder_tests.yml index b877942a8f..d58535231e 100644 --- a/.github/workflows/vocoder_tests.yml +++ b/.github/workflows/vocoder_tests.yml @@ -7,7 +7,7 @@ on: pull_request: types: [opened, synchronize, reopened] jobs: - test: + vocoder-tests: runs-on: ubuntu-latest strategy: fail-fast: false @@ -40,3 +40,37 @@ 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.job }}-${{ matrix.python-version }} + path: .coverage.* + if-no-files-found: ignore + 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 + + python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY + python -Im coverage report + - name: Upload HTML report if check failed + uses: actions/upload-artifact@v4 + with: + name: html-report + path: htmlcov + if: ${{ failure() }} diff --git a/Makefile b/Makefile index ac0f793b13..8b704e69df 100644 --- a/Makefile +++ b/Makefile @@ -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} diff --git a/pyproject.toml b/pyproject.toml index b9902fc372..50d67db97d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,3 +64,7 @@ max-returns = 7 [tool.black] line-length = 120 target-version = ['py39'] + +[tool.coverage.run] +parallel = true +source = ["TTS"] diff --git a/requirements.dev.txt b/requirements.dev.txt index 68450fcad2..7f76b2400a 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,4 +1,4 @@ black==24.2.0 -coverage +coverage[toml] nose2 ruff==0.3.0