From 7a8855a16a6a10400c0c1a66138205d4b9ec914a Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Fri, 1 May 2020 12:50:44 +0300 Subject: [PATCH 1/7] Add coverage measurement for datumaro --- .coveragerc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000000..50a95ebdb03a --- /dev/null +++ b/.coveragerc @@ -0,0 +1,32 @@ +[run] +branch = true + +source = + datumaro/datumaro/ + +omit = + datumaro/datumaro/__main__.py + datumaro/datumaro/version.py + +[report] +# Regexes for lines to exclude from consideration +exclude_lines = + # Have to re-enable the standard pragma + pragma: no cover + + # Don't complain about missing debug-only code: + def __repr__ + if\s+[\w\.()]+\.isEnabledFor\(log\.DEBUG\): + + # Don't complain if tests don't hit defensive assertion code: + raise AssertionError + raise NotImplementedError + + # Don't complain if non-runnable code isn't run: + if 0: + if __name__ == .__main__.: + +# don't fail on the code that can be found +ignore_errors = true + +skip_empty = true \ No newline at end of file From 0197bd10d893d50bfa16c5018e2ad106ae2822e0 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Fri, 1 May 2020 18:46:11 +0300 Subject: [PATCH 2/7] add whole project coverage --- .coveragerc | 7 +++++++ .gitignore | 1 + .travis.yml | 10 +++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.coveragerc b/.coveragerc index 50a95ebdb03a..7804da58abc9 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,10 +3,17 @@ branch = true source = datumaro/datumaro/ + cvat/apps/ + utils/cli/ omit = datumaro/datumaro/__main__.py datumaro/datumaro/version.py + cvat/settings/* + */tests/* + */test_* + */_test_* + */migrations/* [report] # Regexes for lines to exclude from consideration diff --git a/.gitignore b/.gitignore index 23872063a325..bc0260f9de3a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ docker-compose.override.yml __pycache__ *.pyc ._* +.coverage # Ignore development npm files node_modules diff --git a/.travis.yml b/.travis.yml index 9875fc6e3150..cc2612a37980 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ language: python python: - "3.5" +install: + - pip install codecov + services: - docker @@ -12,7 +15,8 @@ before_script: - docker-compose -f docker-compose.yml -f docker-compose.ci.yml build script: - - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'python3 manage.py test cvat/apps utils/cli' - - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'python3 manage.py test --pattern="_tests.py" cvat/apps/dataset_manager' - - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'python3 manage.py test datumaro/' + - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'coverage run -a manage.py test cvat/apps utils/cli && coverage run -a --source cvat/apps/ manage.py test --pattern="_tests.py" cvat/apps/dataset_manager' - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-data && npm install && cd ../cvat-core && npm install && npm run test && npm run coveralls' + +after_success: + - codecov \ No newline at end of file From d26c1e37c86f16933f2f74c46580aac8db9d6849 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Fri, 1 May 2020 20:16:30 +0300 Subject: [PATCH 3/7] use coveralls --- .travis.yml | 17 +++++++++++------ cvat/requirements/testing.txt | 1 + docker-compose.ci.yml | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc2612a37980..51b89f578ab4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,18 +5,23 @@ language: python python: - "3.5" -install: - - pip install codecov - services: - docker +env: + - CONTAINER_COVERAGE_DATA_DIR="/coverage_data" + - HOST_COVERAGE_DATA_DIR="${TRAVIS_BUILD_DIR}/coverage_data" + +install: + - gem install coveralls-lcov + before_script: - docker-compose -f docker-compose.yml -f docker-compose.ci.yml build + - mkdir -p ${HOST_COVERAGE_DATA_DIR} script: - - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'coverage run -a manage.py test cvat/apps utils/cli && coverage run -a --source cvat/apps/ manage.py test --pattern="_tests.py" cvat/apps/dataset_manager' - - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-data && npm install && cd ../cvat-core && npm install && npm run test && npm run coveralls' + - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'coverage run -a manage.py test cvat/apps utils/cli && coverage run -a --source cvat/apps/ manage.py test --pattern="_tests.py" cvat/apps/dataset_manager && mv .coverage ${CONTAINER_COVERAGE_DATA_DIR}' + - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-data && npm install && cd ../cvat-core && npm install && npm run test && mv ./reports/coverage/lcov.info ${CONTAINER_COVERAGE_DATA_DIR}' after_success: - - codecov \ No newline at end of file + - coveralls-lcov lcov.info \ No newline at end of file diff --git a/cvat/requirements/testing.txt b/cvat/requirements/testing.txt index f5f61eec145b..79c222a250fd 100644 --- a/cvat/requirements/testing.txt +++ b/cvat/requirements/testing.txt @@ -3,3 +3,4 @@ fakeredis==1.1.0 # Fix dependencies for fakeredis 1.1.0 # Pip will not reinstall six package if it is installed already six==1.12.0 +coveralls \ No newline at end of file diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index f67559124c1e..f2992ea5d00f 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -15,3 +15,5 @@ services: TRAVIS_JOB_ID: TRAVIS_BRANCH: TRAVIS_PULL_REQUEST: + volumes: + - ${HOST_COVERAGE_DATA_DIR}:${CONTAINER_COVERAGE_DATA_DIR} From a2e9f3b966e2eca231e0805e60de4b9b21a2401a Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Fri, 1 May 2020 20:22:28 +0300 Subject: [PATCH 4/7] merge env lines --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 51b89f578ab4..e0f372a59562 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ services: env: - CONTAINER_COVERAGE_DATA_DIR="/coverage_data" - - HOST_COVERAGE_DATA_DIR="${TRAVIS_BUILD_DIR}/coverage_data" + HOST_COVERAGE_DATA_DIR="${TRAVIS_BUILD_DIR}/coverage_data" install: - gem install coveralls-lcov From 0ed2205d3d2cc21342d2b2cf52491cdbab00fc3f Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Fri, 1 May 2020 20:37:57 +0300 Subject: [PATCH 5/7] pass env var --- docker-compose.ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index f2992ea5d00f..ac3a7c548e3e 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -15,5 +15,6 @@ services: TRAVIS_JOB_ID: TRAVIS_BRANCH: TRAVIS_PULL_REQUEST: + CONTAINER_COVERAGE_DATA_DIR: volumes: - ${HOST_COVERAGE_DATA_DIR}:${CONTAINER_COVERAGE_DATA_DIR} From 3fafdc86c47eb0f28ed26d9b0790a19efcb8f3b1 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Fri, 1 May 2020 20:44:34 +0300 Subject: [PATCH 6/7] merge coverages --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e0f372a59562..0b5c79a6cecc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ env: install: - gem install coveralls-lcov + - pip install coveralls before_script: - docker-compose -f docker-compose.yml -f docker-compose.ci.yml build @@ -24,4 +25,4 @@ script: - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-data && npm install && cd ../cvat-core && npm install && npm run test && mv ./reports/coverage/lcov.info ${CONTAINER_COVERAGE_DATA_DIR}' after_success: - - coveralls-lcov lcov.info \ No newline at end of file + - coveralls-lcov -v -n lcov.info > coverage.json && coveralls --merge=coverage.json \ No newline at end of file From 5c0fb8d5cbbdda0d7c9f9f7dba05485d2d1b09d9 Mon Sep 17 00:00:00 2001 From: Maxim Zhiltsov Date: Sat, 2 May 2020 08:59:48 +0300 Subject: [PATCH 7/7] change perms --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0b5c79a6cecc..278ec6bbda9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ install: before_script: - docker-compose -f docker-compose.yml -f docker-compose.ci.yml build - - mkdir -p ${HOST_COVERAGE_DATA_DIR} + - mkdir -m a=rwx -p ${HOST_COVERAGE_DATA_DIR} script: - docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'coverage run -a manage.py test cvat/apps utils/cli && coverage run -a --source cvat/apps/ manage.py test --pattern="_tests.py" cvat/apps/dataset_manager && mv .coverage ${CONTAINER_COVERAGE_DATA_DIR}'