diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index efb9c7b2..d76d1ee0 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,6 +8,14 @@ on: jobs: tests: runs-on: ubuntu-latest + permissions: + # Gives the action the necessary permissions for publishing new + # comments in pull requests. + pull-requests: write + # Gives the action the necessary permissions for pushing data to the + # python-coverage-comment-action branch, and for editing existing + # comments (to avoid publishing multiple comments in the same PR) + contents: write steps: - uses: actions/checkout@v4 @@ -30,3 +38,10 @@ jobs: flask init-db coverage run -m pytest coverage report -m + + - name: Coverage comment + uses: py-cov-action/python-coverage-comment-action@v3 + with: + GITHUB_TOKEN: ${{ github.token }} + MINIMUM_GREEN: 90 + MINIMUM_ORANGE: 80 diff --git a/pyproject.toml b/pyproject.toml index 7910b385..c271a792 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,11 @@ line-length = 127 target-version = ['py311'] include = '\.pyi?$' +[tool.coverage.run] +branch = true +relative_files = true +source = ["eligibility_server"] + [tool.pyright] include = ["eligibility_server", "tests"]