Skip to content

Molecule

Molecule #74

Workflow file for this run

---
name: Molecule
# yamllint disable-line rule:truthy
on:
push:
pull_request:
schedule:
- cron: '29 21 * * 0'
jobs:
list-scenarios:
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.listscenarios.outputs.scenarios }}
steps:
- uses: actions/checkout@v4
- id: listscenarios
uses: ome/action-ansible-molecule-list-scenarios@main
test:
name: Test
needs:
- list-scenarios
runs-on: ubuntu-22.04
strategy:
# Keep running so we can see if other tests pass
fail-fast: false
matrix:
scenario: ${{fromJson(needs.list-scenarios.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install Ansible & Molecule
run: |
pip install "ansible<8" "ansible-lint<6.13" flake8
pip install "molecule<5" "ansible-compat<4"
pip install molecule-plugins[docker] pytest-testinfra
- name: Run molecule
run: molecule test -s "${{ matrix.scenario }}"
publish:
name: Galaxy
if: startsWith(github.ref, 'refs/tags')
needs:
- test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Read the role name
id: role-name
run: |
name=$(grep 'role_name' meta/main.yml | sed -r 's/^[^:]*:(.*)$/\1/' | tr -d '[:space:]') # noqa
echo "rolename=$name" >> "$GITHUB_OUTPUT"
- name: Publish to Galaxy
uses: ome/action-ansible-galaxy-publish@main
with:
galaxy-api-key: ${{ secrets.GALAXY_API_KEY }}
galaxy-version: ${{ github.ref_name }}
role-name: ${{ steps.role-name.outputs.rolename }}