Skip to content

Commit 70ce3ab

Browse files
Different way of testing, simpler.
1 parent ba0812d commit 70ce3ab

File tree

8 files changed

+64
-121
lines changed

8 files changed

+64
-121
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/galaxy-action@1.2.1

.github/workflows/molecule.yml

Lines changed: 40 additions & 100 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: "debian"
@@ -44,8 +42,6 @@ jobs:
4442
tag: "40"
4543
- image: "fedora"
4644
tag: "latest"
47-
- image: "fedora"
48-
tag: "rawhide"
4945
- image: "ubuntu"
5046
tag: "latest"
5147
- image: "ubuntu"
@@ -55,102 +51,46 @@ jobs:
5551
steps:
5652
- name: checkout
5753
uses: actions/checkout@v4
54+
with:
55+
path: ansible-role-python_pip
56+
57+
- name: Set up Python
58+
uses: actions/setup-python@v5
59+
with:
60+
python-version: "3.13"
5861

59-
- name: molecule
62+
- name: Configure Docker for systemd
6063
run: |
61-
apt-get update -qq
62-
apt-get -y -qq install yamllint docker.io
63-
pip install --no-cache-dir tox
64-
if [ -f tox.ini ] ; then tox ; fi
65-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
66-
env:
67-
image: ${{ matrix.config.image }}
68-
tag: ${{ matrix.config.tag }}
69-
python-3-10:
70-
needs:
71-
- lint
72-
runs-on: ubuntu-20.04
73-
container:
74-
image: python:3.10
75-
strategy:
76-
fail-fast: false
77-
matrix:
78-
config:
79-
- image: "alpine"
80-
tag: "latest"
81-
- image: "debian"
82-
tag: "latest"
83-
- image: "debian"
84-
tag: "bullseye"
85-
- image: "enterpriselinux"
86-
tag: "latest"
87-
- image: "fedora"
88-
tag: "40"
89-
- image: "fedora"
90-
tag: "latest"
91-
- image: "fedora"
92-
tag: "rawhide"
93-
- image: "ubuntu"
94-
tag: "latest"
95-
- image: "ubuntu"
96-
tag: "jammy"
97-
- image: "ubuntu"
98-
tag: "focal"
99-
steps:
100-
- name: checkout
101-
uses: actions/checkout@v4
64+
sudo mkdir -p /etc/docker
65+
echo '{
66+
"features": {
67+
"buildkit": true
68+
},
69+
"exec-opts": ["native.cgroupdriver=systemd"]
70+
}' | sudo tee /etc/docker/daemon.json
71+
sudo systemctl restart docker || true
10272
103-
- name: molecule
73+
- name: Install Docker
74+
uses: docker/setup-buildx-action@v3
75+
76+
- name: Install dependencies
10477
run: |
105-
apt-get update -qq
106-
apt-get -y -qq install yamllint docker.io
107-
pip install --no-cache-dir tox
108-
if [ -f tox.ini ] ; then tox ; fi
109-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
110-
env:
111-
image: ${{ matrix.config.image }}
112-
tag: ${{ matrix.config.tag }}
113-
python-3-13:
114-
needs:
115-
- lint
116-
runs-on: ubuntu-20.04
117-
container:
118-
image: python:3.13
119-
strategy:
120-
fail-fast: false
121-
matrix:
122-
config:
123-
- image: "alpine"
124-
tag: "latest"
125-
- image: "debian"
126-
tag: "latest"
127-
- image: "debian"
128-
tag: "bullseye"
129-
- image: "enterpriselinux"
130-
tag: "latest"
131-
- image: "fedora"
132-
tag: "40"
133-
- image: "fedora"
134-
tag: "latest"
135-
- image: "fedora"
136-
tag: "rawhide"
137-
- image: "ubuntu"
138-
tag: "latest"
139-
- image: "ubuntu"
140-
tag: "jammy"
141-
- image: "ubuntu"
142-
tag: "focal"
143-
steps:
144-
- name: checkout
145-
uses: actions/checkout@v4
78+
python -m pip install --upgrade pip
79+
pip install ansible-lint molecule molecule-plugins[docker] ansible-core
80+
if [ -f ansible-role-python_pip/requirements.txt ]; then pip install -r ansible-role-python_pip/requirements.txt; fi
81+
if [ -f ansible-role-python_pip/requirements.yml ]; then ansible-galaxy install -r ansible-role-python_pip/requirements.yml; fi
82+
83+
# Create proper role directory structure for molecule
84+
mkdir -p ~/.ansible/roles
85+
ln -s ${GITHUB_WORKSPACE}/ansible-role-python_pip ~/.ansible/roles/robertdebock.python_pip
14686
147-
- name: molecule
87+
- name: Test with molecule
14888
run: |
149-
apt-get update -qq
150-
apt-get -y -qq install yamllint docker.io
151-
pip install --no-cache-dir tox
152-
if [ -f tox.ini ] ; then tox ; fi
153-
if [ ! -f tox.ini ] ; then pip install -r requirements.yml ; pip install ansible-lint ansible-core ; molecule test ; fi
89+
cd ansible-role-python_pip
90+
molecule test
15491
env:
155-
image: ${{ matrix.config.image }}
156-
tag: ${{ matrix.config.tag }}
92+
PY_COLORS: 1
93+
ANSIBLE_FORCE_COLOR: 1
94+
ANSIBLE_ROLES_PATH: ~/.ansible/roles:${GITHUB_WORKSPACE}/ansible-role-python_pip
95+
image: ${{ matrix.distro.image }}
96+
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 & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,52 @@ 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.python_pip
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: "debian"
2232
tag: "latest"
23-
python: ['python:3.9', 'python:3.10', 'python:3.13']
2433
- image: "debian"
2534
tag: "bullseye"
26-
python: ['python:3.9', 'python:3.10', 'python:3.13']
2735
- image: "enterpriselinux"
2836
tag: "latest"
29-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3037
- image: "fedora"
3138
tag: "40"
32-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3339
- image: "fedora"
3440
tag: "latest"
35-
python: ['python:3.9', 'python:3.10', 'python:3.13']
36-
- image: "fedora"
37-
tag: "rawhide"
38-
python: ['python:3.9', 'python:3.10', 'python:3.13']
3941
- image: "ubuntu"
4042
tag: "latest"
41-
python: ['python:3.9', 'python:3.10', 'python:3.13']
4243
- image: "ubuntu"
4344
tag: "jammy"
44-
python: ['python:3.9', 'python:3.10', 'python:3.13']
4545
- image: "ubuntu"
4646
tag: "focal"
47-
python: ['python:3.9', 'python:3.10', 'python:3.13']
4847

4948
galaxy:
49+
image: python:3.13
5050
script:
51-
- apk add ansible-core
51+
- apt-get update -qq
52+
- apt-get -y -qq install ansible-core
5253
- ansible-galaxy role import --api-key ${GALAXY_API_KEY} robertdebock ${CI_PROJECT_NAME}
5354
rules:
5455
- 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.python_pip
21+
- role: ansible-role-python_pip
2222
```
2323
2424
The machine needs to be prepared. In CI this is done using [`molecule/default/prepare.yml`](https://github.com/robertdebock/ansible-role-python_pip/blob/master/molecule/default/prepare.yml):

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: "pythonpip-${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)