diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b497ad2..772b740 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: branches: [ dev, main ] jobs: - build: + test: runs-on: ${{ matrix.os }} strategy: @@ -33,6 +33,23 @@ jobs: pytest --cov=cst_python --cov-report json shell: bash + - if: ${{matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'}} + name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: coverage_report + path: coverage.json + + coverage-check: + runs-on: ubuntu-latest + needs: + - test + + steps: + - name: Retrieve coverage report + uses: actions/download-artifact@v4 + with: + name: coverage_report - name: Coverage Check run: | python3 tests/check_coverage.py \ No newline at end of file diff --git a/tests/check_coverage.py b/tests/check_coverage.py index 7b59da5..8486a79 100644 --- a/tests/check_coverage.py +++ b/tests/check_coverage.py @@ -5,4 +5,6 @@ with open("coverage.json") as file: coverage_info = json.load(file) + print("Coverage:", coverage_info["totals"]["percent_covered"], "%") + assert coverage_info["totals"]["percent_covered"] > 75 \ No newline at end of file