From 11a198fdc59f8369dcb75ebc3505a8d68e03e26c Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 24 Jul 2018 17:43:45 +0200 Subject: [PATCH 01/12] Try skipping coverage for pull requests. --- Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cc5308fe1f..fd70f0b3d9 100644 --- a/Makefile +++ b/Makefile @@ -49,8 +49,18 @@ PIP_OPTIONS := $(ST2_PIP_OPTIONS) NOSE_OPTS := --rednose --immediate --with-parallel NOSE_TIME := $(NOSE_TIME) -NOSE_COVERAGE_FLAGS := --with-coverage --cover-branches --cover-erase -NOSE_COVERAGE_PACKAGES := --cover-package=$(COMPONENTS_TEST_COMMA) + +TRAVIS_PULL_REQUEST := $(TRAVIS_PULL_REQUEST) + +# 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. +ifdef TRAVIS_PULL_REQUEST + NOSE_COVERAGE_FLAGS := --with-coverage --cover-branches --cover-erase + NOSE_COVERAGE_PACKAGES := --cover-package=$(COMPONENTS_TEST_COMMA) +else + NOSE_COVERAGE_FLAGS = "" + NOSE_COVERAGE_PACKAGES = "" +endif ifdef NOSE_TIME NOSE_OPTS := --rednose --immediate --with-parallel --with-timer From 1baafa96f62e36088955a9922d66010e2ba973e3 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 24 Jul 2018 18:03:33 +0200 Subject: [PATCH 02/12] Only run coverage on master branch and not on pull requests. --- Makefile | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index fd70f0b3d9..586c05d996 100644 --- a/Makefile +++ b/Makefile @@ -50,18 +50,6 @@ PIP_OPTIONS := $(ST2_PIP_OPTIONS) NOSE_OPTS := --rednose --immediate --with-parallel NOSE_TIME := $(NOSE_TIME) -TRAVIS_PULL_REQUEST := $(TRAVIS_PULL_REQUEST) - -# 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. -ifdef TRAVIS_PULL_REQUEST - NOSE_COVERAGE_FLAGS := --with-coverage --cover-branches --cover-erase - NOSE_COVERAGE_PACKAGES := --cover-package=$(COMPONENTS_TEST_COMMA) -else - NOSE_COVERAGE_FLAGS = "" - NOSE_COVERAGE_PACKAGES = "" -endif - ifdef NOSE_TIME NOSE_OPTS := --rednose --immediate --with-parallel --with-timer endif @@ -70,9 +58,18 @@ ifndef PIP_OPTIONS PIP_OPTIONS := endif -ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) - NOSE_COVERAGE_FLAGS += --cover-tests - NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),$(COMPONENTS_TEST_MODULES_COMMA) +# 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. +TRAVIS_PULL_REQUEST := $(TRAVIS_PULL_REQUEST) + +ifeq ($(TRAVIS_PULL_REQUEST),false) + NOSE_COVERAGE_FLAGS := --with-coverage --cover-branches --cover-erase + NOSE_COVERAGE_PACKAGES := --cover-package=$(COMPONENTS_TEST_COMMA) + + ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) + NOSE_COVERAGE_FLAGS += --cover-tests + NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),$(COMPONENTS_TEST_MODULES_COMMA) + endif endif .PHONY: all @@ -435,7 +432,9 @@ unit-tests: requirements .unit-tests .PHONY: .run-unit-tests-coverage ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) -.run-unit-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.unit + ifneq ($(NOSE_COVERAGE_FLAGS),) + .run-unit-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.unit + endif endif .run-unit-tests-coverage: @echo @@ -448,10 +447,9 @@ endif echo "Running tests in" $$component; \ echo "-----------------------------------------------------------"; \ . $(VIRTUALENV_DIR)/bin/activate; \ - COVERAGE_FILE=.coverage.unit.$$(echo $$component | tr '/' '.') \ - nosetests $(NOSE_OPTS) -s -v $(NOSE_COVERAGE_FLAGS) \ - $(NOSE_COVERAGE_PACKAGES) \ - $$component/tests/unit || exit 1; \ + COVERAGE_FILE=.coverage.unit.$$(echo $$component | tr '/' '.') \ + nosetests $(NOSE_OPTS) -s -v $(NOSE_COVERAGE_FLAGS) $(NOSE_COVERAGE_PACKAGES) \ + $$component/tests/unit || exit 1; \ echo "-----------------------------------------------------------"; \ echo "Done running tests in" $$component; \ echo "==========================================================="; \ @@ -507,7 +505,9 @@ itests: requirements .itests .PHONY: .run-integration-tests-coverage ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) -.run-integration-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.integration + ifneq ($(NOSE_COVERAGE_FLAGS),) + .run-integration-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.integration + endif endif .run-integration-tests-coverage: @echo From 31564fc43d59343ae7268cb8a413046051465e07 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 24 Jul 2018 18:29:22 +0200 Subject: [PATCH 03/12] Only submit coverage report on non pull request branches. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0d79960b38..e1d8a35214 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,7 +82,8 @@ before_cache: - if [ ${TRAVIS_PULL_REQUEST} = 'false' ]; then rm -rf virtualenv/; fi after_success: - - if [ ${TASK} = 'ci-unit' ] || [ ${TASK} = 'ci-integration' ]; then codecov; fi + # 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 # https://docs.travis-ci.com/user/notifications/#Webhooks-Delivery-Format #notifications: From 03ed58eaf58a85a0df2e9927b7563a4ac7374b7b Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 24 Jul 2018 11:00:05 -0700 Subject: [PATCH 04/12] Clean up new makefile logic --- Makefile | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 586c05d996..0a13aba79a 100644 --- a/Makefile +++ b/Makefile @@ -60,8 +60,6 @@ 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. -TRAVIS_PULL_REQUEST := $(TRAVIS_PULL_REQUEST) - ifeq ($(TRAVIS_PULL_REQUEST),false) NOSE_COVERAGE_FLAGS := --with-coverage --cover-branches --cover-erase NOSE_COVERAGE_PACKAGES := --cover-package=$(COMPONENTS_TEST_COMMA) @@ -70,6 +68,10 @@ ifeq ($(TRAVIS_PULL_REQUEST),false) NOSE_COVERAGE_FLAGS += --cover-tests NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),$(COMPONENTS_TEST_MODULES_COMMA) endif +else + # If we aren't running test coverage, don't try to include tests in coverage + # results + INCLUDE_TESTS_IN_COVERAGE := endif .PHONY: all @@ -432,9 +434,7 @@ unit-tests: requirements .unit-tests .PHONY: .run-unit-tests-coverage ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) - ifneq ($(NOSE_COVERAGE_FLAGS),) - .run-unit-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.unit - endif +.run-unit-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.unit endif .run-unit-tests-coverage: @echo @@ -447,9 +447,10 @@ endif echo "Running tests in" $$component; \ echo "-----------------------------------------------------------"; \ . $(VIRTUALENV_DIR)/bin/activate; \ - COVERAGE_FILE=.coverage.unit.$$(echo $$component | tr '/' '.') \ - nosetests $(NOSE_OPTS) -s -v $(NOSE_COVERAGE_FLAGS) $(NOSE_COVERAGE_PACKAGES) \ - $$component/tests/unit || exit 1; \ + COVERAGE_FILE=.coverage.unit.$$(echo $$component | tr '/' '.') \ + nosetests $(NOSE_OPTS) -s -v $(NOSE_COVERAGE_FLAGS) \ + $(NOSE_COVERAGE_PACKAGES) \ + $$component/tests/unit || exit 1; \ echo "-----------------------------------------------------------"; \ echo "Done running tests in" $$component; \ echo "==========================================================="; \ @@ -505,9 +506,7 @@ itests: requirements .itests .PHONY: .run-integration-tests-coverage ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) - ifneq ($(NOSE_COVERAGE_FLAGS),) - .run-integration-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.integration - endif +.run-integration-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.integration endif .run-integration-tests-coverage: @echo From f03ab8a1b03d5298461296346678258f9b029e3d Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 24 Jul 2018 12:09:11 -0700 Subject: [PATCH 05/12] Use and ignore virtualenv on OS X --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0a13aba79a..bef5553e66 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,7 @@ generate-api-spec: requirements .generate-api-spec echo "# Edit st2common/st2common/openapi.yaml.j2 and then run" >> st2common/st2common/openapi.yaml echo "# make .generate-api-spec" >> st2common/st2common/openapi.yaml echo "# to generate the final spec file" >> st2common/st2common/openapi.yaml - . virtualenv/bin/activate; st2common/bin/st2-generate-api-spec --config-file conf/st2.dev.conf >> st2common/st2common/openapi.yaml + . $(VIRTUALENV_DIR)/bin/activate; st2common/bin/st2-generate-api-spec --config-file conf/st2.dev.conf >> st2common/st2common/openapi.yaml .PHONY: circle-lint-api-spec circle-lint-api-spec: @@ -240,13 +240,13 @@ clean: .cleanpycs compile: @echo "======================= compile ========================" @echo "------- Compile all .py files (syntax check test - Python 2) ------" - @if python -c 'import compileall,re; compileall.compile_dir(".", rx=re.compile(r"/virtualenv|.tox"), quiet=True)' | grep .; then exit 1; else exit 0; fi + @if python -c 'import compileall,re; compileall.compile_dir(".", rx=re.compile(r"/virtualenv|virtualenv-osx|.tox"), quiet=True)' | grep .; then exit 1; else exit 0; fi .PHONY: compilepy3 compilepy3: @echo "======================= compile ========================" @echo "------- Compile all .py files (syntax check test - Python 3) ------" - @if python3 -c 'import compileall,re; compileall.compile_dir(".", rx=re.compile(r"/virtualenv|.tox|./st2tests/st2tests/fixtures/packs/test"), quiet=True)' | grep .; then exit 1; else exit 0; fi + @if python3 -c 'import compileall,re; compileall.compile_dir(".", rx=re.compile(r"/virtualenv|virtualenv-osx|.tox|./st2tests/st2tests/fixtures/packs/test"), quiet=True)' | grep .; then exit 1; else exit 0; fi .PHONY: .cleanpycs .cleanpycs: @@ -325,14 +325,14 @@ requirements: virtualenv .sdist-requirements $(VIRTUALENV_DIR)/bin/pip install --upgrade "virtualenv==15.1.0" # Required for packs.install in dev envs. # Generate all requirements to support current CI pipeline. - $(VIRTUALENV_DIR)/bin/python scripts/fixate-requirements.py --skip=virtualenv -s st2*/in-requirements.txt contrib/runners/*/in-requirements.txt -f fixed-requirements.txt -o requirements.txt + $(VIRTUALENV_DIR)/bin/python scripts/fixate-requirements.py --skip=virtualenv,virtualenv-osx -s st2*/in-requirements.txt contrib/runners/*/in-requirements.txt -f fixed-requirements.txt -o requirements.txt # Generate finall requirements.txt file for each component @for component in $(COMPONENTS_WITH_RUNNERS); do\ echo "==========================================================="; \ echo "Generating requirements.txt for" $$component; \ echo "==========================================================="; \ - $(VIRTUALENV_DIR)/bin/python scripts/fixate-requirements.py --skip=virtualenv -s $$component/in-requirements.txt -f fixed-requirements.txt -o $$component/requirements.txt; \ + $(VIRTUALENV_DIR)/bin/python scripts/fixate-requirements.py --skip=virtualenv,virtualenv-osx -s $$component/in-requirements.txt -f fixed-requirements.txt -o $$component/requirements.txt; \ done # Fix for Travis CI race From d9b7d0f4dc08a000c656953061ac7a565a9ed406 Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 24 Jul 2018 12:10:01 -0700 Subject: [PATCH 06/12] Don't try to combine coverage data if we aren't running tests with coverage instrumentation --- Makefile | 54 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index bef5553e66..75eb48ba74 100644 --- a/Makefile +++ b/Makefile @@ -458,29 +458,36 @@ endif .PHONY: .combine-unit-tests-coverage .combine-unit-tests-coverage: .run-unit-tests-coverage - . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.unit \ - coverage combine .coverage.unit.* + @if [ -n "$(NOSE_COVERAGE_FLAGS)" ]; then \ + . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.unit \ + coverage combine .coverage.unit.*; \ + fi .coverage.unit: - @compgen -G '.coverage.unit.*' && \ + @if compgen -G '.coverage.unit.*'; then \ for coverage_result in $$(compgen -G '.coverage.unit.*'); do \ echo "Combining data from $${coverage_result}"; \ . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.unit \ coverage combine $${coverage_result}; \ - done \ - || \ + done; \ + else \ echo "Running unit tests"; \ - make .combine-unit-tests-coverage + make .combine-unit-tests-coverage; \ + fi .PHONY: .report-unit-tests-coverage .report-unit-tests-coverage: .coverage.unit - . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.unit \ - coverage report + @if [ -n "$(NOSE_COVERAGE_FLAGS)" ]; then \ + . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.unit \ + coverage report; \ + fi .PHONY: .unit-tests-coverage-html .unit-tests-coverage-html: .coverage.unit - . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.unit \ - coverage html + @if [ -n "$(NOSE_COVERAGE_FLAGS)" ]; then \ + . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.unit \ + coverage html; \ + fi .PHONY: itests itests: requirements .itests @@ -530,29 +537,36 @@ endif .PHONY: .combine-integration-tests-coverage .combine-integration-tests-coverage: .run-integration-tests-coverage - . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.integration \ - coverage combine .coverage.integration.* + @if [ -n "$(NOSE_COVERAGE_FLAGS)" ]; then \ + . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.integration \ + coverage combine .coverage.integration.*; \ + fi .coverage.integration: - @compgen -G '.coverage.integration.*' && \ + @if compgen -G '.coverage.integration.*'; then \ for coverage_result in $$(compgen -G '.coverage.integration.*'); do \ echo "Combining data from $${coverage_result}"; \ . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.integration \ coverage combine $${coverage_result}; \ - done \ - || \ + done; \ + else \ echo "Running integration tests"; \ - make .combine-integration-tests-coverage + make .combine-integration-tests-coverage; \ + fi .PHONY: .report-integration-tests-coverage .report-integration-tests-coverage: .coverage.integration - @. $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.integration \ - coverage report + @if [ -n "$(NOSE_COVERAGE_FLAGS)" ]; then \ + . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.integration \ + coverage report; \ + fi .PHONY: .integration-tests-coverage-html .integration-tests-coverage-html: .coverage.integration - @. $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.integration \ - coverage html + @if [ -n "$(NOSE_COVERAGE_FLAGS)" ]; then \ + . $(VIRTUALENV_DIR)/bin/activate; COVERAGE_FILE=.coverage.integration \ + coverage html; \ + fi .PHONY: .itests-coverage-html .itests-coverage-html: .integration-tests-coverage-html From 968879883f47058580ea0f866e01e504d9cf89cb Mon Sep 17 00:00:00 2001 From: blag Date: Tue, 24 Jul 2018 16:03:13 -0700 Subject: [PATCH 07/12] Refactor to separate TRAVIS_PULL_REQUEST from ENABLE_COVERAGE --- Makefile | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 75eb48ba74..f286cf40b5 100644 --- a/Makefile +++ b/Makefile @@ -61,19 +61,23 @@ 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 NOSE_COVERAGE_FLAGS := --with-coverage --cover-branches --cover-erase NOSE_COVERAGE_PACKAGES := --cover-package=$(COMPONENTS_TEST_COMMA) - - ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) - NOSE_COVERAGE_FLAGS += --cover-tests - NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),$(COMPONENTS_TEST_MODULES_COMMA) - endif else - # If we aren't running test coverage, don't try to include tests in coverage - # results INCLUDE_TESTS_IN_COVERAGE := endif +# If we aren't running test coverage, don't try to include tests in coverage +# results +ifdef INCLUDE_TESTS_IN_COVERAGE + NOSE_COVERAGE_FLAGS += --cover-tests + NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),$(COMPONENTS_TEST_MODULES_COMMA) +endif + .PHONY: all all: requirements configgen check tests @@ -108,10 +112,16 @@ play: @echo @echo COMPONENT_PYTHONPATH=$(COMPONENT_PYTHONPATH) @echo + @echo TRAVIS_PULL_REQUEST=$(TRAVIS_PULL_REQUEST) + @echo + @echo ENABLE_COVERAGE=$(ENABLE_COVERAGE) + @echo @echo NOSE_COVERAGE_FLAGS=$(NOSE_COVERAGE_FLAGS) @echo @echo NOSE_COVERAGE_PACKAGES=$(NOSE_COVERAGE_PACKAGES) @echo + @echo INCLUDE_TESTS_IN_COVERAGE=$(INCLUDE_TESTS_IN_COVERAGE) + @echo .PHONY: check check: requirements flake8 checklogs @@ -433,7 +443,7 @@ unit-tests: requirements .unit-tests done .PHONY: .run-unit-tests-coverage -ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) +ifdef INCLUDE_TESTS_IN_COVERAGE .run-unit-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.unit endif .run-unit-tests-coverage: @@ -512,7 +522,7 @@ itests: requirements .itests done .PHONY: .run-integration-tests-coverage -ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) +ifdef INCLUDE_TESTS_IN_COVERAGE .run-integration-tests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),tests.integration endif .run-integration-tests-coverage: @@ -583,7 +593,7 @@ mistral-itests: requirements .mistral-itests . $(VIRTUALENV_DIR)/bin/activate; nosetests $(NOSE_OPTS) -s -v st2tests/integration/mistral || exit 1; .PHONY: .run-mistral-itests-coverage -ifneq ($(INCLUDE_TESTS_IN_COVERAGE),) +ifdef INCLUDE_TESTS_IN_COVERAGE .run-mistral-itests-coverage: NOSE_COVERAGE_PACKAGES := $(NOSE_COVERAGE_PACKAGES),st2tests.mistral.integration endif .run-mistral-itests-coverage: From 19706130929d6332c11d67e234db62a4bddb6709 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Wed, 25 Jul 2018 10:59:50 +0200 Subject: [PATCH 08/12] Use ENABLE_COVERAGE environment variable in Makefile to determine if coverage should be enabled or not and set this variable in .travis.yml. --- .travis.yml | 5 +++-- Makefile | 6 +----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f684861110..2b05138a8d 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 "") matrix: include: - env: TASK=ci-unit NODE_INDEX=0 NODE_TOTAL=2 @@ -64,7 +65,7 @@ before_install: install: - 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 +90,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 From 6478e489b4d31b1f26a8687a1ef4d7d4790a759a Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Wed, 25 Jul 2018 11:03:38 +0200 Subject: [PATCH 09/12] Enable some debug think so it's easier to test the change. --- .travis.yml | 2 +- Makefile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2b05138a8d..d2e9ec75cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ branches: env: global: - CACHE_NAME=JOB1 - - ENABLE_COVERAGE=$([ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "yes" || echo "") + - ENABLE_COVERAGE=$([ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo "yes" || echo "no") matrix: include: - env: TASK=ci-unit NODE_INDEX=0 NODE_TOTAL=2 diff --git a/Makefile b/Makefile index 14bf4a43ba..be73e5b9dd 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,8 @@ PIP_OPTIONS := $(ST2_PIP_OPTIONS) NOSE_OPTS := --rednose --immediate --with-parallel NOSE_TIME := $(NOSE_TIME) +COMPONENTS_TEST = "st2debug" + ifdef NOSE_TIME NOSE_OPTS := --rednose --immediate --with-parallel --with-timer endif From b6f1d1f56dd1159d2ff5e10aad30a26e64c2f220 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Wed, 25 Jul 2018 11:14:26 +0200 Subject: [PATCH 10/12] Print variable for debugging purposes. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d2e9ec75cd..57dbff2526 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,6 +64,7 @@ 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' ] && [ ${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 From 3455a5c744bc5a626491c7dbdf7693d6e6027208 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Wed, 25 Jul 2018 11:16:33 +0200 Subject: [PATCH 11/12] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 From 925a167106476aae91e1aea3bb536c85ebda99eb Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Wed, 25 Jul 2018 11:22:01 +0200 Subject: [PATCH 12/12] Remove debug stuff. --- .travis.yml | 4 ++-- Makefile | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57dbff2526..c5fbb9b23d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,7 @@ before_install: 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' ] && [ ${ENABLE_COVERAGE} = 'yes' ]; 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 @@ -91,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' ] && [ ${ENABLE_COVERAGE} = 'yes' ]; then codecov; fi + - if [ ${TASK} = 'ci-unit' ] || [ ${TASK} = 'ci-integration' ] && [ "${ENABLE_COVERAGE}" = 'yes' ]; then codecov; fi diff --git a/Makefile b/Makefile index be73e5b9dd..14bf4a43ba 100644 --- a/Makefile +++ b/Makefile @@ -50,8 +50,6 @@ PIP_OPTIONS := $(ST2_PIP_OPTIONS) NOSE_OPTS := --rednose --immediate --with-parallel NOSE_TIME := $(NOSE_TIME) -COMPONENTS_TEST = "st2debug" - ifdef NOSE_TIME NOSE_OPTS := --rednose --immediate --with-parallel --with-timer endif