diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 82c07cbc..7a2faf10 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -17,7 +17,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install ruff pytest + pip install ruff pytest pytest-cov if [ -f .devcontainer/requirements.txt ]; then pip install -r .devcontainer/requirements.txt; fi - name: Lint with ruff run: | @@ -28,3 +28,40 @@ jobs: - name: Test with pytest run: | pytest + - name: Build coverage file + run: | + pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov-report "xml:coverage.xml" --cov=src src/tests/ | tee pytest-coverage.txt + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml + - name: Check the output coverage + run: | + echo "Coverage Percantage - ${{ steps.coverageComment.outputs.coverage }}" + echo "Coverage Color - ${{ steps.coverageComment.outputs.color }}" + echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}" + echo "Summary Report - ${{ steps.coverageComment.outputs.summaryReport }}" + echo "Coverage Warnings - ${{ steps.coverageComment.outputs.warnings }}" + echo "Coverage Errors - ${{ steps.coverageComment.outputs.errors }}" + echo "Coverage Failures - ${{ steps.coverageComment.outputs.failures }}" + echo "Coverage Skipped - ${{ steps.coverageComment.outputs.skipped }}" + echo "Coverage Tests - ${{ steps.coverageComment.outputs.tests }}" + echo "Coverage Time - ${{ steps.coverageComment.outputs.time }}" + echo "Not Success Test Info - ${{ steps.coverageComment.outputs.notSuccessTestInfo }}" + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./pytest-coverage.txt + pytest-xml-coverage-path: ./coverage.xml + title: Test Coverage Report + badge-title: Test Coverage + hide-badge: false + hide-report: false + create-new-comment: false + hide-comment: false + report-only-changed-files: false + remove-link-from-badge: false + unique-id-for-comment: python3.8 + junitxml-path: ./pytest.xml + junitxml-title: Test Summary