diff --git a/.coveragerc b/.coveragerc index e9a8f12..ecd375d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,11 +2,15 @@ branch = True data_file = .coverage source=sanctions +relative_files = True omit = + CODEOWNERS sanctions/settings/* sanctions/conf/* *wsgi.py - */migrations/* + *migrations* *admin.py - */static/* - */templates/* + *static* + *templates* + *test* + *gunicorn_configuration.py \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 665b3e1..7413185 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,14 @@ jobs: os: [ubuntu-20.04] python-version: ['3.8'] toxenv: ["py38", "quality", "docs", "pii_check"] + 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@v3 @@ -36,9 +44,12 @@ jobs: TOXENV: ${{ matrix.toxenv }} run: tox - # - name: Run coverage - # if: matrix.python-version == '3.8' && matrix.toxenv == 'py38' - # uses: codecov/codecov-action@v3 - # with: - # flags: unittests - # fail_ci_if_error: true + - name: Run coverage + if: matrix.python-version == '3.8' && matrix.toxenv == 'py38' + uses: py-cov-action/python-coverage-comment-action@v3 + with: + GITHUB_TOKEN: ${{ github.token }} + MINIMUM_GREEN: 90 + MINIMUM_ORANGE: 80 + ANNOTATE_MISSING_LINES: true + ANNOTATION_TYPE: error diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 4da4768..0000000 --- a/codecov.yml +++ /dev/null @@ -1,12 +0,0 @@ -coverage: - status: - project: - default: - enabled: yes - target: auto - patch: - default: - enabled: yes - target: 100% - -comment: false diff --git a/requirements/ci.in b/requirements/ci.in index 3797849..21acde9 100644 --- a/requirements/ci.in +++ b/requirements/ci.in @@ -4,3 +4,4 @@ tox # Virtualenv management for tests tox-battery # Makes tox aware of requirements file changes +coverage diff --git a/requirements/ci.txt b/requirements/ci.txt index 4fd9673..1b4e236 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -4,6 +4,8 @@ # # make upgrade # +coverage==7.3.2 + # via -r requirements/ci.in distlib==0.3.7 # via virtualenv filelock==3.13.1 @@ -11,9 +13,14 @@ filelock==3.13.1 # tox # virtualenv packaging==23.2 - # via tox + # via + # pyproject-api + # tox platformdirs==3.11.0 - # via virtualenv + # via + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # tox + # virtualenv pluggy==1.3.0 # via tox py==1.11.0 @@ -21,10 +28,11 @@ py==1.11.0 six==1.16.0 # via tox tomli==2.0.1 - # via tox + # via + # pyproject-api + # tox tox==3.28.0 # via - # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/ci.in # tox-battery tox-battery==0.6.2