Add ansible-lint in tests

This commit is contained in:
Miguel Jacq 2025-12-15 11:29:19 +11:00
parent 4cdc78915f
commit 3f0e38dadf
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
2 changed files with 20 additions and 4 deletions

View file

@ -15,7 +15,7 @@ jobs:
run: | run: |
apt-get update apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ansible ansible ansible-lint
- name: Install Poetry - name: Install Poetry
run: | run: |

View file

@ -1,8 +1,24 @@
#!/bin/bash #!/bin/bash
set -eo pipefail
# Pytests
poetry run pytest -vvvv --cov=enroll --cov-report=term-missing --disable-warnings poetry run pytest -vvvv --cov=enroll --cov-report=term-missing --disable-warnings
poetry run enroll enroll --harvest /tmp/bundle --out /tmp/ansible && \ BUNDLE_DIR="/tmp/bundle"
cd /tmp/ansible && \ ANSIBLE_DIR="/tmp/ansible"
sudo ansible-playbook playbook.yml -i "localhost," -c local --check --diff 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