-
Notifications
You must be signed in to change notification settings - Fork 84
208 lines (182 loc) · 8.56 KB
/
integration_source.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
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Integration tests, dependencies from source
on:
workflow_call:
inputs:
collection_pre_install:
required: false
type: string
default: ""
matrix_exclude:
# https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
# 2.14 supports Python 3.9-3.11
# 2.15 supports Python 3.9-3.11
# 2.16 supports Python 3.10-3.12
# https://docs.ansible.com/ansible/devel/roadmap/ROADMAP_2_17.html
# milestone is 2.17 until after 2.17 branches from devel
# devel is 2.17 until 2024-04-01
default: >-
[
{
"ansible-version": "stable-2.14",
"python-version": "3.12"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.12"
},
{
"ansible-version": "stable-2.17",
"python-version": "3.9"
},
{
"ansible-version": "stable-2.17",
"python-version": "3.10"
},
{
"ansible-version": "milestone",
"python-version": "3.10"
},
{
"ansible-version": "devel",
"python-version": "3.10"
},
]
required: false
type: string
jobs:
integration_source:
env:
PY_COLORS: "1"
source_directory: "./source"
collection_base_dir: "/home/runner/collections"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ansible-version:
- stable-2.15
- stable-2.16
- stable-2.17
- milestone
- devel
python-version:
- "3.10"
- "3.11"
- "3.12"
servicenow-version:
- "utah"
- "vancouver"
- "washington"
- "xanadu"
include:
- servicenow-version: "utah"
sn_host_secret: SN_HOST_UTAH
sn_username_secret: SN_USERNAME_UTAH
sn_password_secret: SN_PASSWORD_UTAH
- servicenow-version: "vancouver"
sn_host_secret: SN_HOST_VANCOUVER
sn_username_secret: SN_USERNAME_VANCOUVER
sn_password_secret: SN_PASSWORD_VANCOUVER
- servicenow-version: "washington"
sn_host_secret: SN_HOST_WASHINGTON
sn_username_secret: SN_USERNAME_WASHINGTON
sn_password_secret: SN_PASSWORD_WASHINGTON
- servicenow-version: "xanadu"
sn_host_secret: SN_HOST_XANADU
sn_username_secret: SN_USERNAME_XANADU
sn_password_secret: SN_PASSWORD_XANADU
exclude: ${{ fromJSON(inputs.matrix_exclude) }}
continue-on-error: ${{ matrix.ansible-version == 'devel' }}
name: "py${{ matrix.python-version }} / ${{ matrix.ansible-version }} / ${{ matrix.servicenow-version }}"
steps:
- name: Checkout the collection repository
uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
with:
path: ${{ env.source_directory }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: "0"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install ansible-core (${{ matrix.ansible-version }})
run: python3 -m pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check
- name: Pre install collections dependencies first so the collection install does not
run: ansible-galaxy collection install --pre ${{ inputs.collection_pre_install }} -p ${{ env.collection_base_dir }}
if: inputs.collection_pre_install != ''
- name: Read collection metadata from galaxy.yml
id: identify
uses: ansible-network/github_actions/.github/actions/identify_collection@main
with:
source_path: ${{ env.source_directory }}
- name: Build and install the collection
uses: ansible-network/github_actions/.github/actions/build_install_collection@main
with:
install_python_dependencies: true
source_path: ${{ env.source_directory }}
collection_path: ${{ steps.identify.outputs.collection_path }}
tar_file: ${{ steps.identify.outputs.tar_file }}
ansible_version: ${{ matrix.ansible-version }}
- name: Print the ansible version
run: ansible --version
- name: Print the python dependencies
run: python3 -m pip list
- name: Create integration_config.yml
env:
SN_HOST: ${{ secrets[matrix.sn_host_secret] }}
SN_USERNAME: ${{ secrets[matrix.sn_username_secret] }}
SN_PASSWORD: ${{ secrets[matrix.sn_password_secret] }}
run: |
touch ${{ steps.identify.outputs.collection_path }}/tests/integration/integration_config.yml
echo "sn_host: '${{ env.SN_HOST }}'" >> ${{ steps.identify.outputs.collection_path }}/tests/integration/integration_config.yml
echo "sn_username: '${{ env.SN_USERNAME }}'" >> ${{ steps.identify.outputs.collection_path }}/tests/integration/integration_config.yml
echo "sn_password: '${{ env.SN_PASSWORD }}'" >> ${{ steps.identify.outputs.collection_path }}/tests/integration/integration_config.yml
echo "collection_base_dir: '${{ steps.identify.outputs.collection_path }}'" >> ${{ steps.identify.outputs.collection_path }}/tests/integration/integration_config.yml
- name: Run itsm_api integration tests
run: ansible-test integration itsm_api
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_api_generic integration tests
run: ansible-test integration itsm_api_generic
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_attachment integration tests
run: ansible-test integration itsm_attachment
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_attachment_info integration tests
run: ansible-test integration itsm_attachment_info
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_attachment_upload integration tests
run: ansible-test integration itsm_attachment_upload
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_change_request integration tests
run: ansible-test integration itsm_change_request
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_change_request_task integration tests
run: ansible-test integration itsm_change_request_task
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_change_request_with_mapping integration tests
run: ansible-test integration itsm_change_request_with_mapping
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_configuration_item integration tests
run: ansible-test integration itsm_configuration_item
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_configuration_item_batch integration tests
run: ansible-test integration itsm_configuration_item_batch
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_configuration_item_relations integration tests
run: ansible-test integration itsm_configuration_item_relations
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_service_catalog_info integration tests
run: ansible-test integration itsm_service_catalog_info
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run itsm_service_catalog integration tests
run: ansible-test integration itsm_service_catalog
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run problem integration tests
run: ansible-test integration problem
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run problem_task integration tests
run: ansible-test integration problem_task
working-directory: ${{ steps.identify.outputs.collection_path }}
- name: Run problem_with_mapping integration tests
run: ansible-test integration problem_with_mapping
working-directory: ${{ steps.identify.outputs.collection_path }}