Skip to content

Commit f396e1c

Browse files
ci: use molecule 5 for ci tests
1 parent 8576b8c commit f396e1c

File tree

5 files changed

+66
-27
lines changed

5 files changed

+66
-27
lines changed

.github/workflows/tests.yml

Lines changed: 62 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@ name: molecule test
22

33
on:
44
pull_request:
5-
types:
6-
- opened
7-
- reopened
8-
- synchronize
95
branches:
10-
- 'master'
6+
- main
7+
types: [opened, synchronize, reopened]
8+
paths:
9+
- 'defaults/**'
10+
- 'handlers/**'
11+
- 'molecule/**'
12+
- 'tasks/**'
13+
- 'templates/**'
14+
- 'vars/**'
1115
schedule:
12-
- cron: '0 6 * * 0'
16+
- cron: '0 6 * * 0'
1317
workflow_dispatch:
1418

1519
env:
16-
MOLECULE_DOCKER_VOLUMES: ro
17-
MOLECULE_DOCKER_CGROUPS_MODE: private
20+
MOLECULE_DOCKER_VOLUMES: rw
21+
MOLECULE_DOCKER_CGROUPS_MODE: host
1822

1923
jobs:
2024
repo:
21-
name: Test Repo Runner
25+
name: Test GHA Runner Role
2226
environment:
2327
name: test
24-
runs-on: ubuntu-20.04
28+
runs-on: ubuntu-22.04
2529
strategy:
2630
fail-fast: false
2731
max-parallel: 3
@@ -42,32 +46,67 @@ jobs:
4246
uses: actions/checkout@v3
4347
with:
4448
path: "${{ github.repository }}"
45-
- name: Molecule for Ansible - GHR Repository
46-
uses: MonolithProjects/[email protected]
49+
50+
- name: Set up Python 3
51+
uses: actions/setup-python@v4
52+
with:
53+
python-version: '3.x'
54+
55+
- name: Install test dependencies
56+
run: pip3 install ansible docker molecule molecule-plugins[docker] "requests<2.29.2"
57+
58+
- name: Run Molecule test - repo
59+
run: molecule test --scenario-name repo
60+
working-directory: "${{ github.repository }}"
4761
env:
62+
PY_COLORS: '1'
63+
ANSIBLE_FORCE_COLOR: '1'
64+
MOLECULE_IMAGE: ${{ matrix.config.os }}
65+
MOLECULE_DOCKER_CGROUPS_MODE: ${{ matrix.config.cgroup_mode }}
66+
MOLECULE_DOCKER_VOLUMES: ${{ matrix.config.volumes }}
4867
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
49-
with:
50-
os: ${{ matrix.config.os }}
51-
tag: ${{ matrix.config.tag }}
52-
molecule_command: test
53-
scenario: repo
5468

5569
org:
5670
name: Test Org Runner
5771
environment:
5872
name: test
59-
runs-on: ubuntu-20.04
73+
runs-on: ubuntu-22.04
6074
strategy:
6175
fail-fast: false
76+
max-parallel: 3
77+
matrix:
78+
config:
79+
- os: "debian11"
80+
tag: "latest"
81+
- os: "fedora37"
82+
tag: "latest"
83+
- os: "ubuntu20"
84+
tag: "latest"
85+
- os: "ubuntu22"
86+
tag: "latest"
87+
- os: "rockylinux8"
88+
tag: "latest"
6289
steps:
6390
- name: checkout
6491
uses: actions/checkout@v3
6592
with:
6693
path: "${{ github.repository }}"
67-
- name: Molecule for Ansible - GHR Organization
68-
uses: MonolithProjects/[email protected]
94+
95+
- name: Set up Python 3
96+
uses: actions/setup-python@v4
97+
with:
98+
python-version: '3.x'
99+
100+
- name: Install test dependencies
101+
run: pip3 install ansible docker molecule molecule-plugins[docker] "requests<2.29.2"
102+
103+
- name: Run Molecule tests -
104+
run: molecule test --scenario-name org
105+
working-directory: "${{ github.repository }}"
69106
env:
107+
PY_COLORS: '1'
108+
ANSIBLE_FORCE_COLOR: '1'
109+
MOLECULE_IMAGE: ${{ matrix.config.os }}
110+
MOLECULE_DOCKER_CGROUPS_MODE: ${{ matrix.config.cgroup_mode }}
111+
MOLECULE_DOCKER_VOLUMES: ${{ matrix.config.volumes }}
70112
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
71-
with:
72-
molecule_command: test
73-
scenario: org

molecule/custom_env/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ driver:
1414
name: docker
1515
platforms:
1616
- name: "${os:-ubuntu20}-${tag:-latest}"
17-
image: "${namespace:-monolithprojects}/systemd-${os:-ubuntu20}:${tag:-latest}"
17+
image: "${namespace:-monolithprojects}/systemd-${MOLECULE_IMAGE:-ubuntu22}:latest"
1818
volumes:
1919
- "/sys/fs/cgroup:/sys/fs/cgroup:${MOLECULE_DOCKER_VOLUMES:-rw}" # Use "ro" for cgroup v1 and "rw" for cgroup v2
2020
cgroupns_mode: ${MOLECULE_DOCKER_CGROUPS_MODE:-"host"} # Use "private" for cgroup v1 and "host" for cgroup v2

molecule/default/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ driver:
1414
name: docker
1515
platforms:
1616
- name: "${os:-ubuntu20}-${tag:-latest}"
17-
image: "${namespace:-monolithprojects}/systemd-${os:-ubuntu20}:${tag:-latest}"
17+
image: "${namespace:-monolithprojects}/systemd-${MOLECULE_IMAGE:-ubuntu22}:latest"
1818
volumes:
1919
- "/sys/fs/cgroup:/sys/fs/cgroup:${MOLECULE_DOCKER_VOLUMES:-rw}" # Use "ro" for cgroup v1 and "rw" for cgroup v2
2020
cgroupns_mode: ${MOLECULE_DOCKER_CGROUPS_MODE:-"host"} # Use "private" for cgroup v1 and "host" for cgroup v2

molecule/org/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ driver:
1414
name: docker
1515
platforms:
1616
- name: "${os:-ubuntu20}-${tag:-latest}"
17-
image: "${namespace:-monolithprojects}/systemd-${os:-ubuntu20}:${tag:-latest}"
17+
image: "${namespace:-monolithprojects}/systemd-${MOLECULE_IMAGE:-ubuntu22}:latest"
1818
volumes:
1919
- "/sys/fs/cgroup:/sys/fs/cgroup:${MOLECULE_DOCKER_VOLUMES:-rw}" # Use "ro" for cgroup v1 and "rw" for cgroup v2
2020
cgroupns_mode: ${MOLECULE_DOCKER_CGROUPS_MODE:-"host"} # Use "private" for cgroup v1 and "host" for cgroup v2

molecule/repo/molecule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ driver:
1414
name: docker
1515
platforms:
1616
- name: "${os:-ubuntu20}-${tag:-latest}"
17-
image: "${namespace:-monolithprojects}/systemd-${os:-ubuntu20}:${tag:-latest}"
17+
image: "${namespace:-monolithprojects}/systemd-${MOLECULE_IMAGE:-ubuntu22}:latest"
1818
volumes:
1919
- "/sys/fs/cgroup:/sys/fs/cgroup:${MOLECULE_DOCKER_VOLUMES:-rw}" # Use "ro" for cgroup v1 and "rw" for cgroup v2
2020
cgroupns_mode: ${MOLECULE_DOCKER_CGROUPS_MODE:-"host"} # Use "private" for cgroup v1 and "host" for cgroup v2

0 commit comments

Comments
 (0)