AnsibleCI #381
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: AnsibleCI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
schedule: # run weekly, every monday 02:00 | |
- cron: '0 2 * * 1' | |
permissions: {} | |
jobs: | |
build: | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
max-parallel: 4 | |
matrix: | |
include: | |
- molecule_distro: 'rockylinux:9' | |
experimental: false | |
suite: default | |
- molecule_distro: 'ubuntu:24.04' | |
experimental: false | |
suite: default | |
- molecule_distro: 'ubuntu:22.04' | |
experimental: false | |
suite: default | |
- molecule_distro: 'ubuntu:20.04' | |
experimental: false | |
suite: default | |
- molecule_distro: 'debian:12' | |
experimental: false | |
suite: default | |
- molecule_distro: 'debian:11' | |
experimental: false | |
suite: default | |
- molecule_distro: 'ubuntu:24.04' | |
experimental: false | |
suite: default-kmod | |
env: | |
ANSIBLE_CALLBACKS_ENABLED: profile_tasks | |
MOLECULE_NO_LOG: "false" | |
ANSIBLE_ROLE: juju4.falco | |
ANSIBLE_SUITE: ${{ matrix.suite }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: ${{ env.ANSIBLE_ROLE }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
set -x | |
python -m pip install --upgrade pip | |
pip install molecule molecule-plugins docker ansible-lint flake8 testinfra ansible | |
mkdir -p $HOME/.ansible/roles && ln -s $GITHUB_WORKSPACE/$ANSIBLE_ROLE $HOME/.ansible/roles/ || true | |
[ -f molecule/${SUITE}/requirements.yml ] && ansible-galaxy install -r molecule/${SUITE}/requirements.yml || true | |
- name: Fetch central settings repository | |
run: | | |
export settings_repo="https://raw.githubusercontent.com/juju4/ansible-ci-settings/main" | |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE | |
set -x | |
curl -o requirements.txt "$settings_repo/requirements.txt" | |
curl -o .ansible-lint "$settings_repo/.ansible-lint" | |
curl -o .yamllint "$settings_repo/.yamllint" | |
pip install -r requirements.txt | |
continue-on-error: true | |
- name: Environment | |
run: | | |
set -x | |
ansible --version | |
ansible-config dump --only-changed -t all | |
ansible-galaxy collection list || true | |
ansible-galaxy role list || true | |
pwd | |
env | |
find -ls | |
- name: Galaxy dependencies | |
run: | | |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE && ansible-galaxy install --timeout 120 --verbose -r molecule/$ANSIBLE_SUITE/requirements.yml | |
continue-on-error: true | |
- name: run test | |
run: | | |
cd $GITHUB_WORKSPACE/$ANSIBLE_ROLE && molecule test --scenario-name ${ANSIBLE_SUITE} | |
env: | |
PY_COLORS: '1' | |
ANSIBLE_FORCE_COLOR: '1' | |
MOLECULE_DISTRO: ${{ matrix.molecule_distro }} | |
- name: After script | Environment | |
run: | | |
set -x | |
ansible --version | |
ansible-config dump --only-changed -t all | |
ansible-galaxy collection list || true | |
ansible-galaxy role list || true | |
if: ${{ always() }} | |
continue-on-error: true |