Skip to content

Different way of testing, simpler. #256

Different way of testing, simpler.

Different way of testing, simpler. #256

Workflow file for this run

---
#
# Ansible managed
#
name: Ansible Molecule
on:
push:
branches:
- master
pull_request:
schedule:
- cron: '41 21 21 * *'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: ansible-lint
uses: ansible-community/ansible-lint-action@main
molecule:
needs:
- lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distro:
- image: "alpine"
tag: "latest"
- image: "amazonlinux"
tag: "latest"
- image: "enterpriselinux"
tag: "latest"
- image: "debian"
tag: "latest"
- image: "debian"
tag: "bullseye"
- image: "fedora"
tag: "40"
- image: "fedora"
tag: "latest"
- image: "ubuntu"
tag: "latest"
- image: "ubuntu"
tag: "jammy"
- image: "ubuntu"
tag: "focal"
steps:
- name: checkout
uses: actions/checkout@v4
with:
path: ansible-role-update
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Configure Docker for systemd
run: |
sudo mkdir -p /etc/docker
echo '{
"features": {
"buildkit": true
},
"exec-opts": ["native.cgroupdriver=systemd"]
}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker || true
- name: Install Docker
uses: docker/setup-buildx-action@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ansible-lint molecule molecule-plugins[docker] ansible-core
if [ -f ansible-role-update/requirements.txt ]; then pip install -r ansible-role-update/requirements.txt; fi
if [ -f ansible-role-update/requirements.yml ]; then ansible-galaxy install -r ansible-role-update/requirements.yml; fi
# Create proper role directory structure for molecule
mkdir -p ~/.ansible/roles
ln -s ${GITHUB_WORKSPACE}/ansible-role-update ~/.ansible/roles/robertdebock.update
- name: Test with molecule
run: |
cd ansible-role-update
molecule test
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
ANSIBLE_ROLES_PATH: ~/.ansible/roles:${GITHUB_WORKSPACE}/ansible-role-update
image: ${{ matrix.distro.image }}
tag: ${{ matrix.distro.tag }}