-
Notifications
You must be signed in to change notification settings - Fork 12
238 lines (212 loc) · 7.23 KB
/
test_plugins.yml
File metadata and controls
238 lines (212 loc) · 7.23 KB
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
---
name: Test Plugins
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
pull_request:
branches:
- 'main'
paths:
- 'plugins/**'
- 'tests/**'
- 'molecule/plugins/**'
- '.github/workflows/test_plugins.yml'
jobs:
sanity_ansible_18_19:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
env:
COLLECTION_NAMESPACE: netways
COLLECTION_NAME: elasticstack
strategy:
fail-fast: false
matrix:
python_version:
- "3.11"
- "3.12"
- "3.13"
ansible_version:
- "ansible-core>=2.18,<2.19" #Correspond ansible>=11.0,<12.0
- "ansible-core>=2.19,<2.20" #Correspond ansible>=12.0,<13.0
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install Ansible
run: |
python3 -m pip install --upgrade pip
python3 -m pip install "${{ matrix.ansible_version }}"
- name: Install collection
run: |
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
- name: Run sanity tests
run: |
cd ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
ansible-test sanity --python "${{ matrix.python_version }}" -v
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
sanity_ansible_20:
runs-on: ubuntu-latest
env:
COLLECTION_NAMESPACE: netways
COLLECTION_NAME: elasticstack
strategy:
fail-fast: false
matrix:
python_version:
- "3.12"
- "3.13"
- "3.14"
ansible_version:
- "ansible-core>=2.20,<2.21" #Correspond ansible>=13.0,<14.0
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python_version }}
- name: Install Ansible
run: |
python3 -m pip install --upgrade pip
python3 -m pip install "${{ matrix.ansible_version }}"
- name: Install collection
run: |
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
- name: Run sanity tests
run: |
cd ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
ansible-test sanity --python "${{ matrix.python_version }}" -v
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
unit-test:
needs:
- sanity_ansible_18_19
- sanity_ansible_20
runs-on: ubuntu-latest
env:
COLLECTION_NAMESPACE: netways
COLLECTION_NAME: elasticstack
strategy:
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install "ansible-core>=2.19,<2.20"
- name: Install collection
run: |
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
- name: Test `cert_info` module
run: |
PYTHONPATH=$HOME/.ansible/collections python3 tests/unit/plugins/modules/test_cert_info.py
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
- name: Test `certs` module util
run: |
PYTHONPATH=$HOME/.ansible/collections python3 tests/unit/plugins/module_utils/test_certs.py
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
molecule_plugins:
needs: unit-test
runs-on: ubuntu-latest
env:
COLLECTION_NAMESPACE: netways
COLLECTION_NAME: elasticstack
strategy:
fail-fast: false
matrix:
distro:
- debian13
scenario:
- plugins
release:
- 8
# - 9 # add when elasticsearch>=9 is supported by this collection
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install "ansible-core>=2.19,<2.20"
python3 -m pip install -r requirements-test.txt
- name: Install collection
run: |
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
- name: Test with molecule
run: |
ansible --version
molecule --version
molecule test -s ${{ matrix.scenario }}
env:
MOLECULE_DISTRO: ${{ matrix.distro }}
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
ELASTIC_RELEASE: ${{ matrix.release }}
python-cryptography:
needs: unit-test
runs-on: ubuntu-latest
env:
COLLECTION_NAMESPACE: netways
COLLECTION_NAME: elasticstack
strategy:
fail-fast: false
matrix:
python_cryptography_version:
- "3.4.8" # Test loading certificate with 3 parameter (old way).
- "41.0.7" # Last version before not_valid_after() and not_valid_before() deprecation.
- "42.0.0" # First release with deprecation https://cryptography.io/en/latest/changelog/
- "46.0.5" # Latest release
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install "ansible-core>=2.19,<2.20"
python3 -m pip install "cryptography==${{ matrix.python_cryptography_version }}"
- name: Install collection
run: |
mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
- name: Test cert_info with cryptography ${{ matrix.python_cryptography_version }}
run: |
PYTHONPATH=$HOME/.ansible/collections python3 tests/unit/plugins/modules/test_cert_info.py
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'