Skip to content

Skip molecule test for unmodified roles #2525

Skip molecule test for unmodified roles

Skip molecule test for unmodified roles #2525

Workflow file for this run

name: Run Molecule tests
on:
pull_request:
types:
- opened
- reopened
- synchronize
paths:
- '.github/**'
- 'roles/**'
- 'plugins/**'
- 'molecule-requirements.txt'
- 'requirements.yml'
workflow_dispatch:
jobs:
run_molecule:
strategy:
fail-fast: true
matrix:
tested_role:
- edpm_ceph_client_files
- edpm_ceph_hci_pre
- edpm_container_manage
- edpm_container_rm
- edpm_container_standalone
- edpm_ddp_package
- edpm_derive_pci_device_spec
- edpm_download_cache
- edpm_growvols
- edpm_logrotate_crond
- edpm_multipathd
- edpm_network_config
- edpm_neutron_dhcp
- edpm_neutron_metadata
- edpm_neutron_ovn
- edpm_neutron_sriov
- edpm_nftables
- edpm_nodes_validation
- edpm_ovn
- edpm_reboot
- edpm_sshd
- edpm_ssh_known_hosts
- edpm_timezone
- edpm_telemetry
- edpm_telemetry_logging
- edpm_users
- env_data
- edpm_pre_adoption_validation
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Check whether the role is modified
id: check_role
run: |
if [[ $(git diff --name-only roles | grep "${{ matrix.tested_role }}/") ]]; then
echo "modified=true" >> $GITHUB_OUTPUT
else
echo "modified=false" >> $GITHUB_OUTPUT
fi
- name: Install ansible
if: steps.check_role.outputs.modified == 'true'
run: pip install ansible
- name: Install collections
if: steps.check_role.outputs.modified == 'true'
run: ansible-galaxy collection install --force -r requirements.yml
- name: Install molecule deps
if: steps.check_role.outputs.modified == 'true'
run: pip install -r molecule-requirements.txt
- name: Run molecule test
if: steps.check_role.outputs.modified == 'true'
run: |
cd $GITHUB_WORKSPACE/roles/${{ matrix.tested_role }}
molecule test --all
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
ANSIBLE_VERBOSITY: 4
ANSIBLE_CALLBACKS_ENABLED: profile_tasks