-
Notifications
You must be signed in to change notification settings - Fork 13
130 lines (117 loc) · 4.31 KB
/
ansible-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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
name: ansible-test images
on:
push:
branches:
- main
paths:
- .github/workflows/ansible-test.yml
- ansible-test/**
pull_request:
branches:
- main
paths:
- .github/workflows/ansible-test.yml
- ansible-test/**
workflow_dispatch:
# Run daily (Monday at 08:00 UTC)
schedule:
- cron: '0 8 * * *'
env:
CONTAINER_REGISTRY: quay.io
CONTAINER_IMAGE_NAME: ansible-community/test-image
jobs:
build:
name: 'Build ansible-test images (${{ matrix.name }} with Python ${{ matrix.python }})'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- name: archlinux
python: '3.13'
ansible-core-1: ansible-core
ansible-core-2: devel
test-with-podman: true
test-with-docker: true
- name: debian-bullseye
python: '3.9'
ansible-core-1: ansible-core
ansible-core-2: devel
test-with-podman: true
test-with-docker: true
- name: debian-bookworm
python: '3.11'
ansible-core-1: ansible-core
ansible-core-2: devel
test-with-podman: true
test-with-docker: true
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
env:
ANSIBLE_CORE_1: ${{ matrix.ansible-core-1 }}
run: |
sudo apt-get install podman buildah
pip install "${ANSIBLE_CORE_1}"
- name: Build ${{ matrix.name }} image
env:
NAME: ${{ matrix.name }}
run: |
"${NAME}/build.sh"
podman tag "localhost/test-image:${NAME}" "${CONTAINER_REGISTRY}/${CONTAINER_IMAGE_NAME}:${NAME}"
working-directory: ./ansible-test/
# This is necessary to allow running systemd in rootless containers
- name: Start systemd user service
run: |
loginctl enable-linger runner
sleep 1
- name: Run basic tests with ${{ matrix.name }} image (${{ matrix.ansible-core-1 }}, Python versions ${{ matrix.python }}, Podman)
if: ${{ matrix.test-with-podman }}
env:
NAME: ${{ matrix.name }}
PYTHON_VERSIONS: ${{ matrix.python }}
ANSIBLE_TEST_PREFER_PODMAN: 1
run: |
for PYTHON in ${PYTHON_VERSIONS}; do
ansible-test integration --color -v --python "${PYTHON}" --docker "localhost/test-image:${NAME}" shippable/posix/group1/
done
working-directory: ./.github/ansible-test-tests/ansible_collections/testns/testcol
- name: Copy image from podman to docker
if: ${{ matrix.test-with-docker }}
env:
NAME: ${{ matrix.name }}
run: |
podman push "localhost/test-image:${NAME}" "docker-daemon:localhost/test-image:${NAME}"
- name: Install ansible-core ${{ matrix.ansible-core-2 }}
if: ${{ matrix.test-with-docker }}
env:
ANSIBLE_CORE_2: ${{ matrix.ansible-core-2 }}
run: |
pip install "https://github.com/ansible/ansible/archive/${ANSIBLE_CORE_2}.tar.gz"
- name: Run basic tests with ${{ matrix.name }} image (ansible-core ${{ matrix.ansible-core-2 }}, Python versions ${{ matrix.python }}, Docker)
if: ${{ matrix.test-with-docker }}
env:
NAME: ${{ matrix.name }}
PYTHON_VERSIONS: ${{ matrix.python }}
run: |
for PYTHON in ${PYTHON_VERSIONS}; do
ansible-test integration --color -v --python "${PYTHON}" --docker "localhost/test-image:${NAME}" shippable/posix/group1/
done
working-directory: ./.github/ansible-test-tests/ansible_collections/testns/testcol
- name: Publish container image as ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_IMAGE_NAME }}:${{ matrix.name }}
if: github.event_name != 'pull_request'
uses: redhat-actions/push-to-registry@v2
with:
registry: ${{ env.CONTAINER_REGISTRY }}
image: ${{ env.CONTAINER_IMAGE_NAME }}
tags: ${{ matrix.name }}
username: ${{ secrets.quay_write_user }}
password: ${{ secrets.quay_write_pass }}