Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom code coverage checker #259

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 46 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ jobs:
name: Install Dependencies
command: pipenv sync --dev

- run:
name: Install code coverage
command: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov

- save_cache:
paths:
- ./venv
Expand All @@ -54,12 +48,16 @@ jobs:

- run:
name: Run tests
command: pipenv run pytest --cov=. --cov-report xml --cov-config=.coveragerc
- store_test_results:
path: test-results
command: pipenv run pytest --cov=. --cov-config=.coveragerc

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

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

tests_postgres13:
docker:
Expand Down Expand Up @@ -97,12 +95,6 @@ jobs:
name: Install Dependencies
command: pipenv sync --dev

- run:
name: Install code coverage
command: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov

- save_cache:
paths:
- ./venv
Expand All @@ -114,12 +106,7 @@ jobs:

- run:
name: Run tests on Postgres 13
command: pipenv run pytest --cov=. --cov-report xml --cov-config=.coveragerc
- store_test_results:
path: test-results
- run:
name: Upload code coverage
command: ./codecov
command: pipenv run pytest

linting:
docker:
Expand Down Expand Up @@ -164,6 +151,39 @@ 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: ~/lite-hmrc
docker:
- image: cimg/python:3.9.18
steps:
- checkout

- attach_workspace:
at: ~/lite-hmrc/tmp

- run: pip install coverage diff_cover

- run: cp tmp/.coverage .

- run: coverage xml

- run: coverage html

- store_artifacts:
path: htmlcov

- run: diff-cover coverage.xml --compare-branch=origin/master --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 @@ -172,3 +192,6 @@ workflows:
- tests
- tests_postgres13
- linting
- check_coverage:
requires:
- tests