Skip to content

Commit 8894f74

Browse files
Different way of testing, simpler.
1 parent 0bc3174 commit 8894f74

File tree

8 files changed

+64
-124
lines changed

8 files changed

+64
-124
lines changed

.github/workflows/galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
types: [created, edited, published, released]
1111
jobs:
1212
release:
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-latest
1414
steps:
1515
- name: galaxy
1616
uses: robertdebock/[email protected]

.github/workflows/molecule.yml

Lines changed: 40 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,21 @@ on:
1515

1616
jobs:
1717
lint:
18-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-latest
1919
steps:
2020
- name: checkout
2121
uses: actions/checkout@v4
2222
- name: ansible-lint
2323
uses: ansible-community/ansible-lint-action@main
2424

25-
python-3-9:
25+
molecule:
2626
needs:
2727
- lint
28-
runs-on: ubuntu-20.04
29-
container:
30-
image: python:3.9
28+
runs-on: ubuntu-latest
3129
strategy:
3230
fail-fast: false
3331
matrix:
34-
config:
32+
distro:
3533
- image: "alpine"
3634
tag: "latest"
3735
- image: "amazonlinux"
@@ -46,8 +44,6 @@ jobs:
4644
tag: "40"
4745
- image: "fedora"
4846
tag: "latest"
49-
- image: "fedora"
50-
tag: "rawhide"
5147
- image: "ubuntu"
5248
tag: "latest"
5349
- image: "ubuntu"
@@ -57,104 +53,46 @@ jobs:
5753
steps:
5854
- name: checkout
5955
uses: actions/checkout@v4
56+
with:
57+
path: ansible-role-diskspace
58+
59+
- name: Set up Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: "3.13"
6063

61-
- name: molecule
64+
- name: Configure Docker for systemd
6265
run: |
63-
apt-get update -qq
64-
apt-get -y -qq install yamllint docker.io
65-
pip install --no-cache-dir tox
66-
if [ -f tox.ini ] ; then tox ; fi
67-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
68-
env:
69-
image: ${{ matrix.config.image }}
70-
tag: ${{ matrix.config.tag }}
71-
python-3-10:
72-
needs:
73-
- lint
74-
runs-on: ubuntu-20.04
75-
container:
76-
image: python:3.10
77-
strategy:
78-
fail-fast: false
79-
matrix:
80-
config:
81-
- image: "alpine"
82-
tag: "latest"
83-
- image: "amazonlinux"
84-
tag: "latest"
85-
- image: "debian"
86-
tag: "latest"
87-
- image: "debian"
88-
tag: "bullseye"
89-
- image: "enterpriselinux"
90-
tag: "latest"
91-
- image: "fedora"
92-
tag: "40"
93-
- image: "fedora"
94-
tag: "latest"
95-
- image: "fedora"
96-
tag: "rawhide"
97-
- image: "ubuntu"
98-
tag: "latest"
99-
- image: "ubuntu"
100-
tag: "jammy"
101-
- image: "ubuntu"
102-
tag: "focal"
103-
steps:
104-
- name: checkout
105-
uses: actions/checkout@v4
66+
sudo mkdir -p /etc/docker
67+
echo '{
68+
"features": {
69+
"buildkit": true
70+
},
71+
"exec-opts": ["native.cgroupdriver=systemd"]
72+
}' | sudo tee /etc/docker/daemon.json
73+
sudo systemctl restart docker || true
74+
75+
- name: Install Docker
76+
uses: docker/setup-buildx-action@v3
10677

107-
- name: molecule
78+
- name: Install dependencies
10879
run: |
109-
apt-get update -qq
110-
apt-get -y -qq install yamllint docker.io
111-
pip install --no-cache-dir tox
112-
if [ -f tox.ini ] ; then tox ; fi
113-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
114-
env:
115-
image: ${{ matrix.config.image }}
116-
tag: ${{ matrix.config.tag }}
117-
python-3-13:
118-
needs:
119-
- lint
120-
runs-on: ubuntu-20.04
121-
container:
122-
image: python:3.13
123-
strategy:
124-
fail-fast: false
125-
matrix:
126-
config:
127-
- image: "alpine"
128-
tag: "latest"
129-
- image: "debian"
130-
tag: "latest"
131-
- image: "debian"
132-
tag: "bullseye"
133-
- image: "enterpriselinux"
134-
tag: "latest"
135-
- image: "fedora"
136-
tag: "40"
137-
- image: "fedora"
138-
tag: "latest"
139-
- image: "fedora"
140-
tag: "rawhide"
141-
- image: "ubuntu"
142-
tag: "latest"
143-
- image: "ubuntu"
144-
tag: "jammy"
145-
- image: "ubuntu"
146-
tag: "focal"
147-
steps:
148-
- name: checkout
149-
uses: actions/checkout@v4
80+
python -m pip install --upgrade pip
81+
pip install ansible-lint molecule molecule-plugins[docker] ansible-core
82+
if [ -f ansible-role-diskspace/requirements.txt ]; then pip install -r ansible-role-diskspace/requirements.txt; fi
83+
if [ -f ansible-role-diskspace/requirements.yml ]; then ansible-galaxy install -r ansible-role-diskspace/requirements.yml; fi
84+
85+
# Create proper role directory structure for molecule
86+
mkdir -p ~/.ansible/roles
87+
ln -s ${GITHUB_WORKSPACE}/ansible-role-diskspace ~/.ansible/roles/robertdebock.diskspace
15088
151-
- name: molecule
89+
- name: Test with molecule
15290
run: |
153-
apt-get update -qq
154-
apt-get -y -qq install yamllint docker.io
155-
pip install --no-cache-dir tox
156-
if [ -f tox.ini ] ; then tox ; fi
157-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
91+
cd ansible-role-diskspace
92+
molecule test
15893
env:
159-
image: ${{ matrix.config.image }}
160-
tag: ${{ matrix.config.tag }}
94+
PY_COLORS: 1
95+
ANSIBLE_FORCE_COLOR: 1
96+
ANSIBLE_ROLES_PATH: ~/.ansible/roles:${GITHUB_WORKSPACE}/ansible-role-diskspace
97+
image: ${{ matrix.distro.image }}
98+
tag: ${{ matrix.distro.tag }}

.github/workflows/requirements2png.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: Ansible Graphviz
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-latest
1414
permissions:
1515
contents: write
1616
steps:

.github/workflows/todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: "ubuntu-20.04"
13+
runs-on: "ubuntu-latest"
1414
steps:
1515
- uses: actions/checkout@v4
1616
- name: "TODO to Issue"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
.tox
55
.cache
66
.DS_Store
7+
.ansible

.gitlab-ci.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,54 @@ variables:
44
DEBIAN_FRONTEND: noninteractive
55

66
molecule:
7-
image: $python
7+
image: python:3.13
88
script:
99
- apt-get update -qq
1010
- apt-get -y -qq install yamllint docker.io
11-
- pip install --no-cache-dir tox
12-
- if [ -f tox.ini ] ; then tox ; fi
13-
- if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
11+
# Configure Docker for systemd
12+
- mkdir -p /etc/docker
13+
- echo '{"features":{"buildkit":true},"exec-opts":["native.cgroupdriver=systemd"]}' > /etc/docker/daemon.json
14+
- service docker restart || true
15+
# Install dependencies and run tests
16+
- pip install --no-cache-dir ansible-lint molecule molecule-plugins[docker] ansible-core
17+
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
18+
- if [ -f requirements.yml ]; then ansible-galaxy install -r requirements.yml; fi
19+
# Create proper role directory structure for molecule
20+
- mkdir -p ~/.ansible/roles
21+
- ln -s $CI_PROJECT_DIR ~/.ansible/roles/robertdebock.diskspace
22+
# Run molecule tests
23+
- cd $CI_PROJECT_DIR
24+
- ANSIBLE_ROLES_PATH=~/.ansible/roles:$CI_PROJECT_DIR molecule test
1425
rules:
1526
- if: $CI_COMMIT_REF_NAME == "master"
1627
parallel:
1728
matrix:
1829
- image: "alpine"
1930
tag: "latest"
20-
python: ['python:3.9', 'python:3.10', 'python:3.13']
2131
- image: "amazonlinux"
2232
tag: "latest"
23-
python: ['python:3.9', 'python:3.10']
2433
- image: "debian"
2534
tag: "latest"
26-
python: ['python:3.9', 'python:3.10', 'python:3.13']
2735
- image: "debian"
2836
tag: "bullseye"
29-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3037
- image: "enterpriselinux"
3138
tag: "latest"
32-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3339
- image: "fedora"
3440
tag: "40"
35-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3641
- image: "fedora"
3742
tag: "latest"
38-
python: ['python:3.9', 'python:3.10', 'python:3.13']
39-
- image: "fedora"
40-
tag: "rawhide"
41-
python: ['python:3.9', 'python:3.10', 'python:3.13']
4243
- image: "ubuntu"
4344
tag: "latest"
44-
python: ['python:3.9', 'python:3.10', 'python:3.13']
4545
- image: "ubuntu"
4646
tag: "jammy"
47-
python: ['python:3.9', 'python:3.10', 'python:3.13']
4847
- image: "ubuntu"
4948
tag: "focal"
50-
python: ['python:3.9', 'python:3.10', 'python:3.13']
5149

5250
galaxy:
51+
image: python:3.13
5352
script:
54-
- apk add ansible-core
53+
- apt-get update -qq
54+
- apt-get -y -qq install ansible-core
5555
- ansible-galaxy role import --api-key ${GALAXY_API_KEY} robertdebock ${CI_PROJECT_NAME}
5656
rules:
5757
- if: $CI_COMMIT_TAG != null

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
1818
gather_facts: true
1919

2020
roles:
21-
- role: robertdebock.diskspace
21+
- role: ansible-role-diskspace
2222
# In a container these mounts should be available.
2323
diskspace_mounts:
2424
- name: /etc/resolv.conf

molecule/default/molecule.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ platforms:
1717
- name: "diskspace-${image:-fedora}-${tag:-latest}${TOX_ENVNAME}"
1818
image: "${namespace:-robertdebock}/${image:-fedora}:${tag:-latest}"
1919
command: /sbin/init
20+
cgroupns_mode: host
2021
volumes:
2122
- /sys/fs/cgroup:/sys/fs/cgroup:rw
2223
privileged: true

0 commit comments

Comments
 (0)