From 3f0e38dadf8a280320bec3a5bcbe97f1c51447fa Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Mon, 15 Dec 2025 11:29:19 +1100 Subject: [PATCH] Add ansible-lint in tests --- .forgejo/workflows/ci.yml | 2 +- tests.sh | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 4f9d0e7..d0707db 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: run: | apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - ansible + ansible ansible-lint - name: Install Poetry run: | diff --git a/tests.sh b/tests.sh index cf5e03b..68842f4 100755 --- a/tests.sh +++ b/tests.sh @@ -1,8 +1,24 @@ #!/bin/bash +set -eo pipefail + +# Pytests poetry run pytest -vvvv --cov=enroll --cov-report=term-missing --disable-warnings -poetry run enroll enroll --harvest /tmp/bundle --out /tmp/ansible && \ - cd /tmp/ansible && \ - sudo ansible-playbook playbook.yml -i "localhost," -c local --check --diff +BUNDLE_DIR="/tmp/bundle" +ANSIBLE_DIR="/tmp/ansible" +rm -rf "${BUNDLE_DIR}" "${ANSIBLE_DIR}" +# Generate data +poetry run \ + enroll enroll \ + --harvest "${BUNDLE_DIR}" \ + --out "${ANSIBLE_DIR}" + +builtin cd "${ANSIBLE_DIR}" + +# Lint +ansible-lint "${ANSIBLE_DIR}" + +# Run +sudo ansible-playbook playbook.yml -i "localhost," -c local --check --diff