-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (63 loc) · 2.23 KB
/
molecule-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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 }}"