-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RHELPLAN-42920 - Collections - script - add tox/travis tests for coll…
…ection conversion, verification Adding collection to envlist and travis in tox.ini. Adding script .travis/runcollection.sh that is invoked by "tox -e collection". yamllint: since collection conversion removes some line breaks, yamllint tends to fail with line too long. Setting the level to warning in .yamllint_defaults.yml. utils.sh: supporting collections format path, e.g., - "$TOPDIR"/tests/ROLENAME/setup_module_utils.sh - SRC_COLL_MODULE_UTILS_DIR and DEST_COLL_MODULE_UTILS_DIR
- Loading branch information
Showing
4 changed files
with
80 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: MIT | ||
|
||
set -e | ||
|
||
#uncomment if you use $ME - otherwise set in utils.sh | ||
#ME=$(basename "$0") | ||
SCRIPTDIR=$(readlink -f "$(dirname "$0")") | ||
|
||
. "${SCRIPTDIR}/utils.sh" | ||
. "${SCRIPTDIR}/config.sh" | ||
|
||
# Collection commands that are run when `tox -e collection`: | ||
role=$(basename "${TOPDIR}") | ||
toxworkdir=${1:-${TOPDIR}/.tox} | ||
cd "${toxworkdir}" | ||
toxworkdir=$(pwd) | ||
envlist=${2:- "black,pylint,flake8,yamllint,py38,shellcheck"} | ||
|
||
git clone https://github.com/linux-system-roles/auto-maintenance | ||
|
||
python auto-maintenance/lsr_role2collection.py --src-path "${TOPDIR}/.." --dest-path "${toxworkdir}" --role "${role}" > "${toxworkdir}"/collection.out 2>&1 | ||
|
||
cd ansible_collections/fedora/system_roles | ||
tox -e "${envlist}" 2>&1 | tee "${toxworkdir}"/collection.tox.out || : | ||
|
||
rm -rf "${toxworkdir}"/auto-maintenance "${toxworkdir}"/ansible_collections | ||
cd "${TOPDIR}" | ||
res=$(grep "^ERROR: .*failed" "${toxworkdir}"/collection.tox.out || :) | ||
if [ "$res" != "" ]; then | ||
lsr_error "${ME}: tox in the converted collection format failed." | ||
exit 1 | ||
fi |
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