-
Notifications
You must be signed in to change notification settings - Fork 58
379 lines (347 loc) · 11.6 KB
/
ci.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
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: CI
on:
- push
- pull_request
permissions:
contents: read
env:
COLUMNS: 160
jobs:
get-changed-files:
name: Get Changed Files
runs-on: ubuntu-latest
permissions:
contents: read # for dorny/paths-filter to fetch a list of changed files
pull-requests: read # for dorny/paths-filter to read pull requests
outputs:
changed-files: ${{ toJSON(steps.changed-files.outputs) }}
steps:
- uses: actions/checkout@v3
- name: Get Changed Files
id: changed-files
uses: dorny/paths-filter@v2
with:
token: ${{ github.token }}
list-files: json
filters: |
repo:
- added|modified:
- '**'
deleted:
- deleted:
- '**'
docs:
- doc/**
state-tree:
- added|modified: &state_tree_added_modified
- setup.py
- golden-pillar-tree/*
- golden-state-tree/*
- tools/**/*.py
os-images-scripts:
- added|modified: &os_images_scripts
- os-images/files/*
- os-images/AWS/files/*
os-images-almalinux:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/almalinux/*.hcl
os-images-amazonlinux:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/amazonlinux/*.hcl
os-images-amazonlinux2023:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/amazonlinux2023/*.hcl
os-images-archlinux:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/archlinux/*.hcl
os-images-centos:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/centos/*.hcl
os-images-centosstream:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/centosstream/*.hcl
os-images-debian:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/debian/*.hcl
os-images-fedora:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/fedora/*.hcl
os-images-opensuse:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
os-images-photon:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/photon/*.hcl
os-images-ubuntu:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/ubuntu/*.hcl
os-images-windows:
- added|modified:
- *state_tree_added_modified
- *os_images_scripts
- os-images/AWS/windows/*.hcl
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}-changed-files
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v3
with:
name: exitstatus
path: exitstatus
if-no-files-found: error
collect-jobs:
name: Collect Jobs To Run
runs-on: ubuntu-latest
needs:
- get-changed-files
outputs:
jobs: ${{ steps.collect-jobs.outputs.jobs }}
runner-version: ${{ steps.collect-jobs.outputs.runner-version }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Python Tools Scripts
env:
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
run: |
python3 -m pip install -r requirements/tools.txt
- name: Write Changed Files To A Local File
run:
echo '${{ needs.get-changed-files.outputs.changed-files }}' > changed-files.json
- name: Collect Jobs
id: collect-jobs
run:
tools ci collect-jobs ${{ github.event_name }} changed-files.json
- name: Check It
run:
echo ${{ steps.collect-jobs.outputs.jobs }}
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}-collect-jobs
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v3
with:
name: exitstatus
path: exitstatus
if-no-files-found: error
pre-commit:
name: Pre-Commit
uses: ./.github/workflows/pre-commit-action.yml
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['pre-commit'] }}
needs:
- collect-jobs
- get-changed-files
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
almalinux:
name: AlmaLinux
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-almalinux'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: almalinux
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
amazonlinux:
name: AmazonLinux
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-amazonlinux'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: amazonlinux
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
amazonlinux2023:
name: AmazonLinux2023
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-amazonlinux2023'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: amazonlinux2023
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
archlinux:
name: ArchLinux
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-archlinux'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: archlinux
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
centos:
name: CentOS
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-centos'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: centos
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
centosstream:
name: CentOS Stream
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-centosstream'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: centosstream
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
debian:
name: Debian
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-debian'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: debian
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
fedora:
name: Fedora
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-fedora'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: fedora
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
opensuse:
name: Opensuse
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-opensuse'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: opensuse
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
photon:
name: PhotonOS
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-photon'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: photon
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
ubuntu:
name: Ubuntu
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-ubuntu'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: ubuntu
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
windows:
name: Windows
needs:
- collect-jobs
- get-changed-files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['os-images-windows'] }}
uses: ./.github/workflows/build-image-action.yml
with:
distro-name: windows
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}
runner-version: ${{ needs.collect-jobs.outputs.runner-version }}
generate-configs:
name: Generate Configuration Files
if: ${{ fromJSON(needs.collect-jobs.outputs.jobs)['generate-configs'] }}
uses: ./.github/workflows/generate-configs-action.yml
needs:
- collect-jobs
- get-changed-files
- almalinux
- amazonlinux
- archlinux
- centos
- centosstream
- debian
- fedora
- opensuse
- photon
- ubuntu
- windows
set-pipeline-exit-status:
# This step is just so we can make github require this step, to pass checks
# on a pull request instead of requiring all
name: Set the ${{ github.workflow }} Pipeline Exit Status
runs-on: ubuntu-latest
if: always()
needs:
- collect-jobs
- pre-commit
- generate-configs
steps:
- name: Download Exit Status Files
if: always()
uses: actions/download-artifact@v3
with:
name: exitstatus
path: exitstatus
- name: Delete Exit Status Artifacts
if: always()
uses: geekyeggo/delete-artifact@v2
with:
name: exitstatus
failOnError: false
- name: Set Pipeline Exit Status
run: |
tree exitstatus
grep -RE 'failure|cancelled' exitstatus/ && exit 1 || exit 0
- name: Done
if: always()
run:
echo "All worflows finished"