-
Notifications
You must be signed in to change notification settings - Fork 551
300 lines (256 loc) · 8.43 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
name: CI
on:
- push
- pull_request
concurrency:
# If changes are pushed to a PR, stop all running workflows before starting new ones
group: ${{ github.head_ref || (github.repository == 'saltstack/salt-bootstrap' && github.run_id || github.ref_name) }}
cancel-in-progress: true
jobs:
collect-changed-files:
name: Collect changed files
runs-on: ubuntu-latest
outputs:
run-tests: ${{ steps.set-output.outputs.run-tests }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get specific changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
separator: ","
files: |
bootstrap-salt.*
tests/**
.github/workflows/**
files_ignore: |
.github/workflows/release.yml
- name: Set Job Output
id: set-output
run: |
echo "::set-output name=run-tests::${{ steps.changed-files.outputs.any_modified }}"
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v4
with:
name: exitstatus-${{ github.job }}
path: exitstatus/
generate-actions-workflow:
name: Generate The Actions Workflow
runs-on: ubuntu-latest
needs: collect-changed-files
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Pre-Commit
run: |
python3 -m pip install -U pip
python3 -m pip install pre-commit
pre-commit install --install-hooks
- name: Generate Workflow Actions
run: |
pre-commit run -av generate-actions-workflow
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v4
with:
name: exitstatus-${{ github.job }}
path: exitstatus/
lint:
name: Lint
runs-on: ubuntu-latest
needs: collect-changed-files
container: koalaman/shellcheck-alpine:latest
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
steps:
- uses: actions/checkout@v4
- name: ShellCheck
run: |
shellcheck -s sh -f tty bootstrap-salt.sh
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v4
with:
name: exitstatus-${{ github.job }}
path: exitstatus/
macos-12:
name: macOS 12
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-macos.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: macos-12
display-name: macOS 12
container-slug: macos-12
timeout: 20
runs-on: macos-12
instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]'
macos-13:
name: macOS 13
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-macos.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: macos-13
display-name: macOS 13
container-slug: macos-13
timeout: 20
runs-on: macos-13
instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]'
macos-14:
name: macOS 14
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-macos.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: macos-14
display-name: macOS 14
container-slug: macOS 14
timeout: 20
runs-on: macos-14
instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]'
windows-2022:
name: Windows 2022
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-windows.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: windows-2022
display-name: Windows 2022
container-slug: windows-2022
timeout: 20
runs-on: windows-2022
instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]'
debian-12:
name: Debian 12
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: debian-12
display-name: Debian 12
container-slug: systemd-debian-12
timeout: 20
instances: '["stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]'
photon-5:
name: Photon OS 5
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: photon-5
display-name: Photon OS 5
container-slug: systemd-photon-5
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
rockylinux-8:
name: Rocky Linux 8
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: rockylinux-8
display-name: Rocky Linux 8
container-slug: systemd-rockylinux-8
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
rockylinux-9:
name: Rocky Linux 9
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: rockylinux-9
display-name: Rocky Linux 9
container-slug: systemd-rockylinux-9
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
ubuntu-2204:
name: Ubuntu 22.04
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: ubuntu-2204
display-name: Ubuntu 22.04
container-slug: systemd-ubuntu-22.04
timeout: 20
instances: '["stable-3006", "git-3006", "onedir-3006", "stable-3006-8", "stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]'
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
needs:
- lint
- generate-actions-workflow
- macos-12
- macos-13
- macos-14
- windows-2022
- debian-12
- photon-5
- rockylinux-8
- rockylinux-9
- ubuntu-2204
if: always()
steps:
- name: Download Exit Status Files
if: always()
uses: actions/download-artifact@v4
with:
path: exitstatus/
pattern: exitstatus-*
merge-multiple: true
- name: Delete Exit Status Artifacts
if: always()
uses: geekyeggo/delete-artifact@v5
with:
pattern: exitstatus-*
failOnError: false
- name: Set Pipeline Exit Status
run: |
grep -RE 'failure|cancelled' exitstatus/ && exit 1 || exit 0
- name: Done
if: always()
run:
echo "All worflows finished"