CI #82
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
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: 0 0 * * 0 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ansible/ansible-lint@v24 | |
integration: | |
name: Integration | |
runs-on: macos-latest | |
steps: | |
# Uninstall runner preinstalled software (cf. https://github.com/actions/runner-images?tab=readme-ov-file#software-and-image-support) | |
- run: brew uninstall node@20 | |
- uses: actions/checkout@v4 | |
- name: Install Ansible | |
run: | | |
python3 -m venv venv | |
source venv/bin/activate | |
pip3 install --requirement requirements.txt | |
- name: Install Ansible collections | |
run: | | |
source venv/bin/activate | |
ansible-galaxy install --role-file requirements.yml | |
- name: Perform a syntax check on the Ansible playbook | |
run: | | |
source venv/bin/activate | |
ansible-playbook --syntax-check playbook.yml | |
- name: Run Ansible playbook | |
run: | | |
source venv/bin/activate | |
ansible-playbook ${RUNNER_DEBUG:+-vvv} playbook.yml | |
env: | |
ANSIBLE_FORCE_COLOR: true | |
- name: Idempotence check | |
run: | | |
source venv/bin/activate | |
idempotence=$(mktemp) | |
ansible-playbook ${RUNNER_DEBUG:+-vvv} playbook.yml | tee -a ${idempotence} | |
tail ${idempotence} | grep --quiet 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1) | |
env: | |
ANSIBLE_FORCE_COLOR: true |