From 2dcab795935594c2a82a5b03238473a7063724ff Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Tue, 5 Dec 2023 17:57:47 +0000 Subject: [PATCH 1/2] feat(ci/tests): add coverage comment step --- .github/workflows/run-tests.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 From 3f0e5bb9cdd95581bba298f4d7c878fb4462f02b Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Tue, 5 Dec 2023 17:58:02 +0000 Subject: [PATCH 2/2] chore(pyproject): configure coverage --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) 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"]