forked from theforeman/foreman-ansible-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
195 lines (186 loc) · 6.5 KB
/
main.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: CI
on: [push, pull_request]
env:
COLORTERM: 'yes'
TERM: 'xterm-256color'
PYTEST_ADDOPTS: '--color=yes'
concurrency:
group: ${{ github.ref_name }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-20.04
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
python:
- "3.10"
ansible:
- stable-2.12
- stable-2.13
- stable-2.14
- stable-2.15
- stable-2.16
- devel
include:
- python: "3.8"
ansible: "v2.9.17"
- python: "3.8"
ansible: "stable-2.10"
- python: "2.7"
ansible: "stable-2.11"
container: "python:2.7"
- python: "3.5"
ansible: "stable-2.11"
- python: "3.6"
ansible: "stable-2.11"
- python: "3.7"
ansible: "stable-2.11"
- python: "3.9"
ansible: "stable-2.11"
- python: "3.11"
ansible: "devel"
- python: "3.12"
ansible: "devel"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
if: matrix.container == null
- name: Install sudo
run: apt-get update && apt-get install -y sudo
if: matrix.container != null
- name: Install system dependencies
# libyaml-dev for PyYAML, rpm for rpm-py-installer, python3-rpm for rpm-shim
run: sudo apt-get install -y libyaml-dev rpm python3-rpm
- name: Fix up Python RPM binding filenames so that other Pythons find it
run: |
for file in /usr/lib/python3/dist-packages/rpm/_rpm*.cpython-*.so; do
sudo ln -s ${file} $(echo ${file} | sed 's/\.cpython[^.]*//');
done
if: matrix.container == null
- name: Install Ansible
run: pip install --upgrade https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz
- name: Ensure Jinja version is old enough for Ansible 2.9
run: pip install --upgrade 'Jinja2<3.1'
if: matrix.ansible == 'v2.9.17'
- name: Install dependencies
run: make test-setup
- name: prepare a redhat-uep.pem, even if we run on Ubuntu
run: sudo mkdir -p /etc/rhsm/ca/ && sudo curl -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
- name: Install required collections for ansible-base (2.10+)
run: ansible-galaxy collection install community.docker
if: matrix.ansible != 'v2.9.17'
- name: Run crud tests
run: make test-crud
- name: Run other tests
run: make test-other
- name: Run dist tests
run: make dist-test
- name: Run sanity tests
run: make SANITY_OPTS="--docker" sanity
if: matrix.ansible != 'v2.9.17' && matrix.ansible != 'stable-2.10' && matrix.ansible != 'stable-2.11'
checkmode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install system dependencies
# libyaml-dev for PyYAML, rpm for rpm-py-installer, python3-rpm for rpm-shim
run: sudo apt-get install -y libyaml-dev rpm python3-rpm
- name: Fix up Python RPM binding filenames so that other Pythons find it
run: |
for file in /usr/lib/python3/dist-packages/rpm/_rpm*.cpython-*.so; do
sudo ln -s ${file} $(echo ${file} | sed 's/\.cpython[^.]*//');
done
- name: Install Ansible
run: pip install --upgrade ansible-core
- name: Install dependencies
run: make test-setup
- name: prepare a redhat-uep.pem, even if we run on Ubuntu
run: sudo mkdir -p /etc/rhsm/ca/ && sudo curl -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
- name: Run check_mode tests
run: make test-check-mode
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: make doc-setup
- name: Generate changelog
run: antsibull-changelog release
- name: Build docs
run: make doc
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/_build/html/
galaxy-importer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: pip install --upgrade py galaxy-importer
- name: Run galaxy-importer
run: make galaxy-importer
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: |
pip install --upgrade ansible-core
pip install --upgrade -r requirements-lint.txt
- name: Run lint
run: make lint
- name: Upload collection artifact
uses: actions/upload-artifact@v4
with:
name: collection
path: theforeman-foreman-*.tar.gz
execution_environment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: pip install --upgrade ansible-core ansible-builder ansible-navigator
- name: Build EE
run: ansible-builder build -v 3 -t test-ee:latest -f meta/execution-environment.yml
- name: Test EE
run: |
ansible-navigator --execution-environment-image test-ee:latest --pull-policy never --mode stdout doc theforeman.foreman.host