-
Notifications
You must be signed in to change notification settings - Fork 5
214 lines (203 loc) · 7.27 KB
/
tests.yaml
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
---
name: Test and build
"on":
push:
paths-ignore:
- ".github/**"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install yamllint
run: sudo apt install yamllint
- name: Lint
run: yamllint .
quick_tests:
runs-on: ubuntu-20.04
strategy:
matrix:
python_version:
- "3.11"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Sanity tests with dependencies
run: ansible-test sanity --requirements --python ${{ matrix.python_version }}
working-directory: ansible_collections/serverscom/sc_api
- name: Unit tests with dependencies
run: ansible-test units --requirements --python ${{ matrix.python_version }}
working-directory: ansible_collections/serverscom/sc_api
- name: Try-build by ansible-galaxy
run: ansible-galaxy collection build
working-directory: ansible_collections/serverscom/sc_api
integration_tests_cloud:
runs-on: ubuntu-20.04
needs: quick_tests
concurrency: API
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Configure integration tests
run: |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
env:
SC_TOKEN: "${{ secrets.SC_TOKEN }}"
- name: Integration tests
run: ansible-test integration --requirements --python 3.11
sc_ssh_key
sc_cloud_computing_flavors_info
sc_cloud_computing_regions_info
sc_cloud_computing_images_info
sc_cloud_computing_openstack_credentials
sc_cloud_computing_instance
sc_cloud_computing_instance_info
sc_cloud_computing_instance_ptr
sc_cloud_computing_instances_info
sc_cloud_computing_instance_state
# sc_cloud_computing_instance_reinstall - broken and unfinished
working-directory: ansible_collections/serverscom/sc_api
- name: Cleanup secrets
if: always()
run: |
dd if=/dev/zero bs=4k count=4 of=ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
sync
sync
integration_tests_bm:
runs-on: ubuntu-20.04
needs: integration_tests_cloud
concurrency: API
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Configure integration tests
run: |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
env:
SC_TOKEN: "${{ secrets.SC_TOKEN }}"
- name: Integration tests
run: ansible-test integration --requirements --python 3.11
sc_ssh_key
sc_baremetal_locations_info
sc_baremetal_servers_info
sc_dedicated_server_info
sc_dedicated_server_reinstall_quick
sc_dedicated_server_reinstall_long
working-directory: ansible_collections/serverscom/sc_api
- name: Cleanup secrets
if: always()
run: |
dd if=/dev/zero bs=4k count=4 of=ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
sync
sync
integration_tests_l2:
runs-on: ubuntu-20.04
needs: integration_tests_bm
concurrency: API
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Configure integration tests
run: |
envsubst < integration_config.yml.template > ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
env:
SC_TOKEN: "${{ secrets.SC_TOKEN }}"
- name: Integration tests
run: ansible-test integration --requirements --python 3.11
sc_l2_segment
sc_l2_segment_aliases
sc_l2_segments_info
working-directory: ansible_collections/serverscom/sc_api
- name: Cleanup secrets
if: always()
run: |
dd if=/dev/zero bs=4k count=4 of=ansible_collections/serverscom/sc_api/tests/integration/integration_config.yml
sync
sync
build:
runs-on: ubuntu-20.04
needs: integration_tests_l2
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Remove tests from final distribution
run: rm -r tests/
working-directory: ansible_collections/serverscom/sc_api
- name: Build collection
run: ansible-galaxy collection build
working-directory: ansible_collections/serverscom/sc_api
- name: Extract version
id: version
run: |
version=$(grep ^version galaxy.yml|awk '{print $2}')
echo "::set-output name=version::$version"
working-directory: ansible_collections/serverscom/sc_api
- name: Print artifact info
run: |
ls -la serverscom-sc_api-${{ steps.version.outputs.version }}.tar.gz
sha512sum serverscom-sc_api-${{ steps.version.outputs.version }}.tar.gz
tar tzf serverscom-sc_api-${{ steps.version.outputs.version }}.tar.gz
working-directory: ansible_collections/serverscom/sc_api
- name: Save artifact
if: ${{ endsWith(github.ref, steps.version.outputs.version) }}
uses: actions/upload-artifact@v2
with:
name: sc_api
path: ansible_collections/serverscom/sc_api/serverscom-sc_api-${{ steps.version.outputs.version }}.tar.gz
publish:
runs-on: ubuntu-20.04
needs: build
if: ${{ endsWith(github.ref, needs.build.outputs.version) }}
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: sc_api
- name: Debug output
run: ls -la serverscom-sc_api-${{needs.build.outputs.version }}.tar.gz
- name: Upload collection to galaxy
run: ansible-galaxy collection publish serverscom-sc_api-${{ needs.build.outputs.version }}.tar.gz --api-key="${{ secrets.GALAXY_API_TOKEN }}"