Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ script:
# as long as PR builds
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${IS_NIGHTLY_BUILD}" = "no" ]; then COMMAND_THRESHOLD=$(expr ${COMMAND_THRESHOLD} \* 2); fi; ./scripts/travis/time-command.sh "make ${TASK}" ${COMMAND_THRESHOLD}
# Run any additional nightly checks only as part of a nightly (cron) build
- if [ "${IS_NIGHTLY_BUILD}" = "yes" ] && [ "${TASK}" = "ci-checks ci-packs-tests" ]; then make ci-checks-nightly; fi
- if [ "${IS_NIGHTLY_BUILD}" = "yes" ]; then ./scripts/travis/run-nightly-make-task-if-exists.sh "${TASK}"; fi
# NOTE: We only generate and submit coverage report for master and version branches
# NOTE: We put this here and not after_success so build is marked as failed if this step fails
# See https://docs.travis-ci.com/user/customizing-the-build/#breaking-the-build
Expand All @@ -147,3 +147,13 @@ script:
# Alternative: use strict pip pinning, including git-based pip packages
before_cache:
- if [ ${TRAVIS_PULL_REQUEST} = 'false' ] && [ "${IS_NIGHTLY_BUILD}" = "no" ]; then rm -rf virtualenv/; fi

# We want to be notified when a master or nightly build fails
notifications:
# Post build failures to '#stackstorm' channel in 'stackstorm' Slack
slack:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

rooms:
- secure: "rPA22aDgvNe0/S/2e+cp1rSDdDUPufLXnCbfnRzMPVDSQ2UPdLmEl9IeOoEHZmq92AZtzY8UnQaPFuoM0HAPrYDgKopn4n4KpOo+xUlJ92qdNj5qk3Z1TmQHwUYFvCkMvaR/CpX2liRr/YB3qM+1vFAMsYgmqrBX8vcEqNJQy/M="
on_pull_requests: false
on_success: change # default: always
on_failure: always # default: always
24 changes: 23 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ COMPONENTS_RUNNERS := $(wildcard contrib/runners/*)
COMPONENTS_WITHOUT_ST2TESTS := $(shell ls -a | grep ^st2 | grep -v .egg-info | grep -v st2tests | grep -v st2exporter)

COMPONENTS_WITH_RUNNERS := $(COMPONENTS) $(COMPONENTS_RUNNERS)
COMPONENTS_WITH_RUNNERS_WITHOUT_MISTRAL_RUNNER := $(foreach component,$(filter-out contrib/runners/mistral_v2,$(COMPONENTS_WITH_RUNNERS)),$(component))

COMPONENTS_TEST_DIRS := $(wildcard st2*/tests) $(wildcard contrib/runners/*/tests)

Expand All @@ -42,6 +43,7 @@ space_char :=
space_char +=
COMPONENT_PYTHONPATH = $(subst $(space_char),:,$(realpath $(COMPONENTS_WITH_RUNNERS)))
COMPONENTS_TEST := $(foreach component,$(filter-out $(COMPONENT_SPECIFIC_TESTS),$(COMPONENTS_WITH_RUNNERS)),$(component))
COMPONENTS_TEST_WITHOUT_MISTRAL_RUNNER := $(foreach component,$(filter-out $(COMPONENT_SPECIFIC_TESTS),$(COMPONENTS_WITH_RUNNERS_WITHOUT_MISTRAL_RUNNER)),$(component))
COMPONENTS_TEST_COMMA := $(subst $(slash),$(dot),$(subst $(space_char),$(comma),$(COMPONENTS_TEST)))
COMPONENTS_TEST_MODULES := $(subst $(slash),$(dot),$(COMPONENTS_TEST_DIRS))
COMPONENTS_TEST_MODULES_COMMA := $(subst $(space_char),$(comma),$(COMPONENTS_TEST_MODULES))
Expand Down Expand Up @@ -109,6 +111,8 @@ play:
@echo
@echo COMPONENTS_WITH_RUNNERS=$(COMPONENTS_WITH_RUNNERS)
@echo
@echo COMPONENTS_WITH_RUNNERS_WITHOUT_MISTRAL_RUNNER=$(COMPONENTS_WITH_RUNNERS_WITHOUT_MISTRAL_RUNNER)
@echo
@echo COMPONENTS_TEST=$(COMPONENTS_TEST)
@echo
@echo COMPONENTS_TEST_COMMA=$(COMPONENTS_TEST_COMMA)
Expand All @@ -119,6 +123,8 @@ play:
@echo
@echo COMPONENTS_TEST_MODULES_COMMA=$(COMPONENTS_TEST_MODULES_COMMA)
@echo
@echo COMPONENTS_TEST_WITHOUT_MISTRAL_RUNNER=$(COMPONENTS_TEST_WITHOUT_MISTRAL_RUNNER)
@echo
@echo COMPONENT_PYTHONPATH=$(COMPONENT_PYTHONPATH)
@echo
@echo TRAVIS_PULL_REQUEST=$(TRAVIS_PULL_REQUEST)
Expand Down Expand Up @@ -573,7 +579,7 @@ endif
@echo
@echo "----- Dropping st2-test db -----"
@mongo st2-test --eval "db.dropDatabase();"
for component in $(COMPONENTS_TEST); do\
for component in $(COMPONENTS_TEST_WITHOUT_MISTRAL_RUNNER); do\
echo "==========================================================="; \
echo "Running tests in" $$component; \
echo "-----------------------------------------------------------"; \
Expand Down Expand Up @@ -939,6 +945,13 @@ ci-py3-unit:
NOSE_WITH_TIMER=$(NOSE_WITH_TIMER) tox -e py36-unit -vv
NOSE_WITH_TIMER=$(NOSE_WITH_TIMER) tox -e py36-packs -vv

.PHONY: ci-py3-unit-nightly
ci-py3-unit-nightly:
@echo
@echo "==================== ci-py3-unit ===================="
@echo
NOSE_WITH_TIMER=$(NOSE_WITH_TIMER) tox -e py36-unit-nightly -vv

.PHONY: ci-py3-integration
ci-py3-integration: requirements .ci-prepare-integration .ci-py3-integration

Expand Down Expand Up @@ -977,6 +990,15 @@ ci-py3-integration: requirements .ci-prepare-integration .ci-py3-integration
.PHONY: ci-unit
ci-unit: .unit-tests-coverage-html

.PHONY: ci-unit-nightly
ci-unit-nightly:
# NOTE: We run mistral runner checks only as part of a nightly build to speed up
# non nightly builds (Mistral will be deprecated in the future)
@echo
@echo "============== ci-unit-nightly =============="
@echo
nosetests $(NOSE_OPTS) -s -v contrib/runners/mistral_v2/tests/unit

.PHONY: .ci-prepare-integration
.ci-prepare-integration:
sudo -E ./scripts/travis/prepare-integration.sh
Expand Down
38 changes: 38 additions & 0 deletions scripts/travis/run-nightly-make-task-if-exists.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

# Script which runs a corresponding make nightly tasks if it exists. If a task corresponding
# nightly task doesn't exist, it's ignored.
#
# For example, let's say we have TASK="ci-checks ci-unit ci-pack-tests" and only
# "ci-checks-nightly" make task exists.
# In this scenario, only "ci-check-nightly" tasks would run and other would be ignored.

TASK=$1

if [ ! "${TASK}" ]; then
echo "Missing TASK argument"
echo "Usage: $0 <make task>"
exit 2
fi

# Note: TASK could contain a list of multiple tasks
TASKS=($TASK)

EXISTING_TASKS=()
for TASK_NAME in ${TASKS[@]}; do
$(make -n ${TASK_NAME}-nightly &> /dev/null)

if [ $? -eq 0 ]; then
# Task {TASK}-nightly exists
EXISTING_TASKS+=("$TASK_NAME-nightly")
fi
done

# Run only tasks which exist
if [ ${#EXISTING_TASKS[@]} -eq 0 ]; then
echo "No existing nightly tasks found..."
exit 0
fi

echo "Running the following nightly tasks: ${EXISTING_TASKS[@]}"
exec make ${EXISTING_TASKS[@]}
15 changes: 13 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,23 @@ commands =
nosetests --rednose --immediate -sv contrib/runners/http_runner/tests/unit/
nosetests --rednose --immediate -sv contrib/runners/noop_runner/tests/unit/
nosetests --rednose --immediate -sv contrib/runners/local_runner/tests/unit/
nosetests --rednose --immediate -sv contrib/runners/mistral_v2/tests/unit/
nosetests --rednose --immediate -sv contrib/runners/orquesta_runner/tests/unit/
nosetests --rednose --immediate -sv contrib/runners/python_runner/tests/unit/
nosetests --rednose --immediate -sv contrib/runners/winrm_runner/tests/unit/

# Python 3 tasks
[testenv:py36-unit-nightly]
basepython = python3.6
setenv = PYTHONPATH = {toxinidir}/external:{toxinidir}/st2common:{toxinidir}/st2api:{toxinidir}/st2actions:{toxinidir}/st2exporter:{toxinidir}/st2reactor:{toxinidir}/st2tests:{toxinidir}/contrib/runners/action_chain_runner:{toxinidir}/contrib/runners/local_runner:{toxinidir}/contrib/runners/python_runner:{toxinidir}/contrib/runners/http_runner:{toxinidir}/contrib/runners/noop_runner:{toxinidir}/contrib/runners/announcement_runner:{toxinidir}/contrib/runners/remote_runner:{toxinidir}/contrib/runners/remote_runner:{toxinidir}/contrib/runners/mistral_v2:{toxinidir}/contrib/runners/orquesta_runner:{toxinidir}/contrib/runners/inquirer_runner:{toxinidir}/contrib/runners/http_runner:{toxinidir}/contrib/runners/winrm_runner
VIRTUALENV_DIR = {envdir}
passenv = NOSE_WITH_TIMER TRAVIS
install_command = pip install -U --force-reinstall {opts} {packages}
deps = virtualenv
-r{toxinidir}/requirements.txt
-e{toxinidir}/st2client
-e{toxinidir}/st2common
commands =
nosetests --rednose --immediate -sv contrib/runners/mistral_v2/tests/unit/

[testenv:py36-packs]
basepython = python3.6
setenv = PYTHONPATH = {toxinidir}/external:{toxinidir}/st2common:{toxinidir}/st2api:{toxinidir}/st2actions:{toxinidir}/st2exporter:{toxinidir}/st2reactor:{toxinidir}/st2tests:{toxinidir}/contrib/runners/action_chain_runner:{toxinidir}/contrib/runners/local_runner:{toxinidir}/contrib/runners/python_runner:{toxinidir}/contrib/runners/http_runner:{toxinidir}/contrib/runners/noop_runner:{toxinidir}/contrib/runners/announcement_runner:{toxinidir}/contrib/runners/remote_runner:{toxinidir}/contrib/runners/remote_runner:{toxinidir}/contrib/runners/mistral_v2:{toxinidir}/contrib/runners/orquesta_runner:{toxinidir}/contrib/runners/inquirer_runner:{toxinidir}/contrib/runners/http_runner:{toxinidir}/contrib/runners/winrm_runner
Expand Down