From dbea2b2dc8f8a4cdc6f1725c876538b2f7b8c979 Mon Sep 17 00:00:00 2001 From: anknitintg Date: Mon, 18 Sep 2023 11:43:32 +0530 Subject: [PATCH 1/4] test code coverage tool installation in ci --- .circleci/config.yml | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 128544c..4ce1f09 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,4 +93,39 @@ jobs: if [ $? -ne 0 ]; then echo "Unformatted code detected. Please run black --fast . locally and commit to format your code." >&2 exit 1 - fi \ No newline at end of file + fi + + ## ------------------ Generate Code Coverage Report ------------------ + + code-coverage-report: + parameters: + with_merge: # Part of the PR-merge workflow + type: boolean + default: false + docker: + # https://circleci.com/developer/images/image/cimg/python + - image: cimg/python:3.11.0 + steps: + - when: + condition: << parameters.with_merge >> + steps: + - disable_build_if_not_pr + # Make sure that the build doesn't accidentally pull images from Docker Hub. + # Pulls from Docker Hub may fail due to rate-limiting after Nov 1 2020. + - disable_docker_hub + # Coverage html requires source code to build HTML views + - checkout + # Need a workspace for all the coverage reports + - attach_workspace: + at: /tmp/workspace + - run: + name: Compile Coverage Reports + command: | + set -x + pip install -r requirements-coveralls.txt + coverage combine /tmp/workspace/coverage-report-*/.coverage + coverage html -d htmlcov + coveralls + - store_artifacts: + name: Save Coverage Report + path: htmlcov/ \ No newline at end of file From 6671958052a83d9c9eed84100718c418376d454c Mon Sep 17 00:00:00 2001 From: anknitintg Date: Mon, 18 Sep 2023 11:46:52 +0530 Subject: [PATCH 2/4] run code-covergae-report in circle ci --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ce1f09..e92a9e1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,8 @@ workflows: context: org-sightmachine - run-unit-tests: context: org-sightmachine + - code-coverage-report: + context: org-sightmachine orbs: gcp-gke: circleci/gcp-gke@0.2.0 From 6f3ab91df88910dd3f2f1abe28a3e8d7e0fc2438 Mon Sep 17 00:00:00 2001 From: anknitintg Date: Mon, 18 Sep 2023 18:22:35 +0530 Subject: [PATCH 3/4] added .coveragec file --- .coveragec | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .coveragec diff --git a/.coveragec b/.coveragec new file mode 100644 index 0000000..ae01516 --- /dev/null +++ b/.coveragec @@ -0,0 +1,11 @@ +[run] +source = sightmachine-sdk +branch = True + +[paths] +source = + /home/circleci/project + +[report] +omit = + */tests/* \ No newline at end of file From 7a2de1d0f1ec9f24d25b85f8e51f715611ffb341 Mon Sep 17 00:00:00 2001 From: anknitintg Date: Mon, 18 Sep 2023 18:31:39 +0530 Subject: [PATCH 4/4] removed command coverage combine --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e92a9e1..e49fe5b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -125,7 +125,6 @@ jobs: command: | set -x pip install -r requirements-coveralls.txt - coverage combine /tmp/workspace/coverage-report-*/.coverage coverage html -d htmlcov coveralls - store_artifacts: