Skip to content

Merge pull request #39 from CoffeeITWorks/hotfix/github_actions_tests #75

Merge pull request #39 from CoffeeITWorks/hotfix/github_actions_tests

Merge pull request #39 from CoffeeITWorks/hotfix/github_actions_tests #75

Workflow file for this run

# https://thedatabaseme.de/2022/01/17/automated-testing-your-ansible-role-with-molecule-and-github-actions/
name: Molecule pipeline test
on:
push:
branches-ignore:
- "master"
tags-ignore:
- "*"
pull_request:
pull_request_review:
jobs:
molecule:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Better to use one scenario per OS for faster performance and easier debugging
scenario:
# - ubuntu-2204
# - rocky9
- local-stable
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies.
run: |
python3 -m pip install --upgrade pip
python3 -m pip install yamllint ansible-lint ansible molecule-podman
# https://www.linkedin.com/pulse/how-run-rootless-podman-service-github-actions-%D0%B4%D0%BC%D0%B8%D1%82%D1%80%D0%B8%D0%B9-%D0%BC%D0%B8%D1%88%D0%B0%D1%80%D0%BE%D0%B2
- name: Prepare the environment for podman
run: |
loginctl enable-linger $(whoami)
export XDG_RUNTIME_DIR=/run/user/$UID
podman system service --time=0 unix://${XDG_RUNTIME_DIR}/podman/podman.sock &
- name: Install Galaxy dependencies.
run: |
ansible-galaxy collection install community.docker
- name: check molecule version
run: molecule --version
- name: Run molecule converge
run: "molecule converge --scenario-name ${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
working-directory: "${{ github.repository }}"
- name: Run molecule syntax
run: "molecule syntax --scenario-name ${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
working-directory: "${{ github.repository }}"
- name: Run molecule idempotence
run: "molecule idempotence --scenario-name ${{ matrix.scenario }}"
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
working-directory: "${{ github.repository }}"