Skip to content

Commit

Permalink
Adapt smoke testing to test both molecule and ansible-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Jan 17, 2025
1 parent 4db0011 commit 2396eaa
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
20 changes: 20 additions & 0 deletions tools/smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -eu
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

for PROJECT in ansible-lint molecule; do
echo "Running tests for $PROJECT"
if [[ -d "${TOX_ENV_DIR}/${PROJECT}/.git" ]]; then
git -C "${TOX_ENV_DIR}/${PROJECT}" pull
else
mkdir -p "${TOX_ENV_DIR}/${PROJECT}"
git clone --recursive https://github.com/ansible/${PROJECT} "${TOX_ENV_DIR}/${PROJECT}"
fi
pushd "${TOX_ENV_DIR}/${PROJECT}" > /dev/null
tox devenv
source venv/bin/activate
uv pip install -e "$SCRIPT_DIR/.."
uv pip freeze | grep "file:"
pytest
popd
done
23 changes: 13 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ deps =
ansible217: ansible-core>=2.17,<2.18
ansible218: ansible-core>=2.18,<2.19

devel: ansible-core @ git+https://github.com/ansible/ansible.git@c5d18c39d81e2b3b10856b2fb76747230e4fac4a # GPLv3+
devel: ansible-core @ git+https://github.com/ansible/ansible.git@devel # GPLv3+
# avoid installing ansible-core on -devel envs:
!devel: ansible-core
extras =
Expand Down Expand Up @@ -171,20 +171,23 @@ extras = docs
passenv = *

[testenv:smoke]
description = Run ansible-lint own testing with current code from compat library
commands_pre =
ansible localhost -m ansible.builtin.git -a 'repo=https://github.com/ansible/ansible-lint dest={envdir}/tmp/ansible-lint'
pip install -e "{envdir}/tmp/ansible-lint[test]"
description = Run ansible-lint and molecule own testing with current code from compat library
; commands_pre =
; ansible localhost -m ansible.builtin.git -a 'repo=https://github.com/ansible/ansible-lint dest={envdir}/tmp/ansible-lint'
; pip install -e "{envdir}/tmp/ansible-lint[test]"
commands =
bash -c "pip freeze|grep ansible"
pytest -k role
deps =
ansible-core
bash tools/smoke.sh
; bash -c "pip freeze|grep ansible"
; pytest -k role
; deps =
; ansible-core
setenv =
{[testenv]setenv}
PIP_CONSTRAINT = /dev/null
PYTEST_REQPASS = 0
changedir = {envdir}/tmp/ansible-lint
; changedir = {envdir}/tmp/ansible-lint
allowlist_externals =
pwd
bash
sh
skip_install = true

0 comments on commit 2396eaa

Please sign in to comment.