Skip to content

Commit

Permalink
Add diff cover coverage check
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincarrogan committed Jun 24, 2024
1 parent 5445d2b commit 06c08f4
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ jobs:
name: Run tests
command: pipenv run pytest --cov=. --cov-report xml --cov-config=.coveragerc

- run:
name: Rename coverage file
command: mkdir coverage-output && cp .coverage coverage-output/.coverage

- persist_to_workspace:
root: coverage-output
paths:
- .coverage

- store_test_results:
path: test-results

Expand Down Expand Up @@ -145,6 +154,37 @@ jobs:
# the cache key changes whenever any of the branch name, Pipfile.lock checksum, or .pre-commit-config.yaml checksum change
key: dependencies-{{ .Branch }}-{{ checksum "Pipfile.lock" }}-{{ checksum ".pre-commit-config.yaml" }}

check_coverage:
working_directory: ~/repo
docker:
- image: cimg/python:3.8.17
steps:
- checkout

- attach_workspace:
at: ~/repo/tmp

- run: pip install coverage diff_cover

- run: coverage xml

- run: coverage html

- store_artifacts:
path: htmlcov

- run: diff-cover coverage.xml --compare-branch=origin/dev --html-report coverage-report.html

- store_artifacts:
path: coverage-report.html

- run: zip -r coverage.zip htmlcov coverage-report.html

- store_artifacts:
path: coverage.zip

- run: diff-cover coverage.xml --compare-branch=origin/master --fail-under=100


workflows:
version: 2
Expand All @@ -153,3 +193,6 @@ workflows:
- tests
- tests_postgres13
- linting
- check_coverage:
requires:
- tests

0 comments on commit 06c08f4

Please sign in to comment.