diff --git a/.gitignore b/.gitignore index f3a07151e9..90bbd3043f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ pip-log.txt .coverage .coverage.integration.* .coverage.integration +.coverage.unit.* .coverage.unit cover coverage*.xml diff --git a/.travis.yml b/.travis.yml index f684861110..c5fbb9b23d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ branches: env: global: - CACHE_NAME=JOB1 + - ENABLE_COVERAGE=$([ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "yes" || echo "no") matrix: include: - env: TASK=ci-unit NODE_INDEX=0 NODE_TOTAL=2 @@ -63,8 +64,9 @@ before_install: - sudo pip install --upgrade "virtualenv==15.1.0" install: + - "echo ${ENABLE_COVERAGE}" - if [ "${TASK}" = 'compilepy3 ci-py3-unit' ] || [ "${TASK}" = 'ci-py3-integration' ]; then pip install "tox==3.0.0"; else make requirements; fi - - if [ "${TASK}" = 'ci-unit' ] || [ "${TASK}" = 'ci-integration' ]; then pip install codecov; fi + - if [ "${TASK}" = 'ci-unit' ] || [ "${TASK}" = 'ci-integration' ] && [ "${ENABLE_COVERAGE}" = 'yes' ]; then pip install codecov; fi - if [ "${TASK}" = 'ci-unit' ] || [ "${TASK}" = 'ci-integration' ] || [ "${TASK}" = 'compilepy3 ci-py3-unit' ] || [ "${TASK}" = 'ci-py3-integration' ]; then sudo .circle/add-itest-user.sh; fi # Let's enable rabbitmqadmin @@ -89,4 +91,4 @@ before_cache: after_success: # NOTE: We only generate and submit coverage report for master and version branches - - if [ ${TASK} = 'ci-unit' ] || [ ${TASK} = 'ci-integration' ] && [ ${TRAVIS_PULL_REQUEST} = 'false' ]; then codecov; fi + - if [ ${TASK} = 'ci-unit' ] || [ ${TASK} = 'ci-integration' ] && [ "${ENABLE_COVERAGE}" = 'yes' ]; then codecov; fi diff --git a/Makefile b/Makefile index f286cf40b5..14bf4a43ba 100644 --- a/Makefile +++ b/Makefile @@ -60,11 +60,7 @@ endif # NOTE: We only run coverage on master and version branches and not on pull requests since # it has a big performance overhead and is very slow. -ifeq ($(TRAVIS_PULL_REQUEST),false) - ENABLE_COVERAGE := yes -endif - -ifdef ENABLE_COVERAGE +ifeq ($(ENABLE_COVERAGE),yes) NOSE_COVERAGE_FLAGS := --with-coverage --cover-branches --cover-erase NOSE_COVERAGE_PACKAGES := --cover-package=$(COMPONENTS_TEST_COMMA) else