-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci_complete
- Loading branch information
Showing
10 changed files
with
130 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o pipefail -eu | ||
|
||
error() { | ||
echo >&2 "error: $*" | ||
exit 1 | ||
} | ||
|
||
declare -a entry_point_args | ||
IFS='/:' read -ra entry_point_args <<< "$1" | ||
|
||
# Explode entry point args, for example '2.16/integration/3.10/2' or '2.16/sanity' | ||
ansible_version="${entry_point_args[0]}" | ||
test_name="${entry_point_args[1]}" | ||
python_version="${entry_point_args[2]:-}" | ||
test_group="${entry_point_args[3]:-}" | ||
|
||
export PYTHONIOENCODING="utf-8" | ||
export PIP_DISABLE_PIP_VERSION_CHECK="true" | ||
export ANSIBLE_COLLECTIONS_PATHS="$PWD/../.." | ||
|
||
command -v python | ||
python -V | ||
command -v pip | ||
pip --version | ||
|
||
if [ "$ansible_version" == "devel" ]; then | ||
pip install "https://github.com/ansible/ansible/archive/devel.tar.gz" | ||
else | ||
pip install "https://github.com/ansible/ansible/archive/stable-$ansible_version.tar.gz" | ||
fi | ||
pip list | ||
|
||
# Prepare coverage args | ||
if $COVERAGE; then | ||
coverage_args="--coverage" | ||
elif [[ "$COMMIT_MESSAGE" =~ ci_coverage ]]; then | ||
coverage_args="--coverage" | ||
else | ||
coverage_args="--coverage-check" | ||
fi | ||
|
||
# Prepare changed args | ||
if $COMPLETE; then | ||
changed_args="" | ||
elif [[ "$COMMIT_MESSAGE" =~ ci_complete ]]; then | ||
changed_args="" | ||
else | ||
changed_args="--changed" | ||
fi | ||
|
||
# Prepare unstable args | ||
if $IS_PULL_REQUEST; then | ||
unstable_args="--allow-unstable-changed" | ||
else | ||
unstable_args="" | ||
fi | ||
|
||
# Install dependencies | ||
pip install rstcheck | ||
|
||
pip install -r tests/integration/requirements.txt -c tests/constraints.txt | ||
ansible-galaxy -vvv collection install -r tests/requirements.yml | ||
|
||
# Dump env and set timeout | ||
timeout=45 | ||
if $COVERAGE; then | ||
timeout=60 | ||
fi | ||
|
||
ansible-test env --color -v --dump --show --timeout "$timeout" | ||
|
||
# Run tests | ||
case "$test_name" in | ||
sanity) | ||
# shellcheck disable=SC2086 | ||
ansible-test sanity --color -v \ | ||
--exclude plugins/module_utils/vendor/ \ | ||
--exclude scripts/ \ | ||
--exclude tests/utils/ \ | ||
--docker \ | ||
--junit \ | ||
$coverage_args \ | ||
$changed_args \ | ||
--allow-disabled | ||
;; | ||
|
||
units) | ||
# shellcheck disable=SC2086 | ||
ansible-test units --color -v \ | ||
--docker default \ | ||
--python "$python_version" \ | ||
$coverage_args \ | ||
$changed_args | ||
;; | ||
|
||
integration) | ||
# shellcheck disable=SC2086 | ||
ansible-test integration --color -v \ | ||
--remote-terminate always \ | ||
--remote-stage prod \ | ||
--docker \ | ||
--python "$python_version" \ | ||
--retry-on-error \ | ||
$coverage_args \ | ||
$changed_args \ | ||
--changed-all-target none \ | ||
--changed-all-mode exclude \ | ||
$unstable_args \ | ||
"shippable/hcloud/group$test_group" | ||
;; | ||
|
||
*) | ||
error "found invalid test_name: $test_name" | ||
;; | ||
esac |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.