From 3fa7ffe951a2ff392aa80b21afe3627170f70cba Mon Sep 17 00:00:00 2001 From: leehk Date: Mon, 21 Apr 2025 13:01:00 +0800 Subject: [PATCH] use codecov again --- .github/workflows/template_unit_pytest.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/template_unit_pytest.yml b/.github/workflows/template_unit_pytest.yml index b23aacc..4cdabca 100644 --- a/.github/workflows/template_unit_pytest.yml +++ b/.github/workflows/template_unit_pytest.yml @@ -56,12 +56,12 @@ jobs: cat Pipfile pipenv sync -d - - name: Run tests with pytest and generate coverage report + - name: Run tests with pytest working-directory: ${{ env.WORKING_DIR }} run: | pipenv run pytest --version # Use the environment variables defined above for paths - pipenv run pytest -v -s -o log_cli=true --junitxml=results.xml --cov=${{ env.SRC_PATH }} --cov-report term ${{ env.TESTS_PATH }} + pipenv run pytest -v -s -o log_cli=true --junitxml=results.xml --cov=${{ env.SRC_PATH }} --cov-report=xml:${{ env.TESTS_COVERAGE_REPORT_PATH }} ${{ env.TESTS_PATH }} echo "Listing results in working directory:" ls -al ${{ github.workspace }}/${{ env.WORKING_DIR }} @@ -82,3 +82,12 @@ jobs: with: name: ${{ inputs.projectName }}-coverage-report path: ${{ env.TESTS_COVERAGE_REPORT_PATH }} + + - name: Upload coverage to Codecov + if: success() || failure() # always run + uses: codecov/codecov-action@v3 + with: + files: ${{ env.TESTS_COVERAGE_REPORT_PATH }} + fail_ci_if_error: true + +