-
Notifications
You must be signed in to change notification settings - Fork 0
433 lines (399 loc) · 13.6 KB
/
example.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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
---
# Example of using firmware-action
name: example
on:
pull_request:
pull_request_review:
types: ['submitted']
merge_group:
push:
branches: ['main']
tags: ['v*']
env:
APPLY_FIXES: none
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# Status check for all jobs below
# This is to allow SKIPPED be considered as SUCCESS
status-check-example:
runs-on: ubuntu-latest
if: always()
needs:
- build-coreboot
- build-linux
- build-edk2
- build-stitching
- build-uroot
- test-operating-systems
steps:
- name: Check status
uses: re-actors/alls-green@release/v1
with:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}
# Check we jobs should be ran or skipped
skip-check:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
outputs:
changes: ${{ steps.filter.outputs.changes }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
changes:
- '.github/workflows/example.yml'
- 'docker/**'
- 'tests/**'
# Change detection in action golang code
changes:
runs-on: ubuntu-latest
needs: skip-check
# Required permissions
permissions:
pull-requests: read
outputs:
action: ${{ steps.filter.outputs.action }}
if: ${{ needs.skip-check.outputs.changes == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
action:
- 'action/**'
# Example of building coreboot
# ANCHOR: example_build_coreboot
build-coreboot:
runs-on: ubuntu-latest
needs:
- changes
- skip-check
strategy:
matrix:
coreboot-version: ['4.19', '4.20.1', '4.21', '24.02']
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }}
# Skip if pull_request_review on PR not made by a bot
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore cached coreboot repo
uses: actions/cache/restore@v4
with:
path: ./my_super_dooper_awesome_coreboot
key: coreboot-${{ matrix.coreboot-version }}
- name: Clone coreboot repo
run: |
git clone --branch "${{ matrix.coreboot-version }}" --depth 1 https://review.coreboot.org/coreboot my_super_dooper_awesome_coreboot || true
- name: Store coreboot repo in cache
uses: actions/cache/save@v4
with:
path: ./my_super_dooper_awesome_coreboot
key: coreboot-${{ matrix.coreboot-version }}
- name: Move my defconfig into place (filename must not contain '.defconfig')
run: |
mv "tests/coreboot_${{ matrix.coreboot-version }}/seabios.defconfig" "seabios_defconfig"
- name: firmware-action
uses: ./
# uses: 9elements/firmware-action
with:
config: 'tests/example_config__coreboot.json'
target: 'coreboot-example'
recursive: 'false'
compile: ${{ needs.changes.outputs.action }}
env:
COREBOOT_VERSION: ${{ matrix.coreboot-version }}
- name: Get artifacts
uses: actions/upload-artifact@v4
with:
name: coreboot-${{ matrix.coreboot-version }}
path: output
retention-days: 14
# ANCHOR_END: example_build_coreboot
# Example of building Linux kernel
# ANCHOR: example_build_linux_kernel
build-linux:
runs-on: ubuntu-latest
needs:
- changes
- skip-check
strategy:
matrix:
linux-version: ['6.1.45', '6.1.111', '6.6.52', '6.9.9', '6.11']
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }}
# Skip if pull_request_review on PR not made by a bot
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore cached linux source
uses: actions/cache/restore@v4
with:
path: ./linux-${{ matrix.linux-version }}.tar.xz
key: linux-${{ matrix.linux-version }}
- name: Prepare linux kernel
run: |
# Download source files
wget --quiet --continue "https://cdn.kernel.org/pub/linux/kernel/v${LINUX_MAJOR_VERSION}.x/linux-${{ matrix.linux-version }}.tar.xz"
wget --quiet "https://cdn.kernel.org/pub/linux/kernel/v${LINUX_MAJOR_VERSION}.x/linux-${{ matrix.linux-version }}.tar.sign"
unxz --keep "linux-${{ matrix.linux-version }}.tar.xz" >/dev/null
# Verify GPG signature
gpg2 --locate-keys [email protected] [email protected]
gpg2 --verify "linux-${{ matrix.linux-version }}.tar.sign"
# Extract
tar -xvf "linux-${{ matrix.linux-version }}.tar"
env:
LINUX_MAJOR_VERSION: 6
- name: Store linux source in cache
uses: actions/cache/save@v4
with:
path: ./linux-${{ matrix.linux-version }}.tar.xz
key: linux-${{ matrix.linux-version }}
- name: Move my defconfig into place (filename must not contain '.defconfig')
run: |
mv "tests/linux_${{ matrix.linux-version }}/linux.defconfig" "ci_defconfig"
- name: firmware-action
uses: ./
# uses: 9elements/firmware-action
with:
config: 'tests/example_config__linux.json'
target: 'linux-example'
recursive: 'false'
compile: ${{ needs.changes.outputs.action }}
env:
LINUX_VERSION: ${{ matrix.linux-version }}
- name: Get artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.linux-version }}
path: output
retention-days: 14
# ANCHOR_END: example_build_linux_kernel
# Example of building EDK2
# ANCHOR: example_build_edk2
build-edk2:
runs-on: ubuntu-latest
needs:
- changes
- skip-check
strategy:
matrix:
edk2-version: ['edk2-stable202208', 'edk2-stable202211']
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }}
# Skip if pull_request_review on PR not made by a bot
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore cached edk2 repo
uses: actions/cache/restore@v4
with:
path: ./Edk2
key: edk2-${{ matrix.edk2-version }}
- name: Clone edk2 repo
run: |
git clone --recurse-submodules --branch "${{ matrix.edk2-version }}" --depth 1 https://github.com/tianocore/edk2.git Edk2 || true
- name: Prepare file with build arguments
run: |
echo "-D BOOTLOADER=COREBOOT -D TPM_ENABLE=TRUE -D NETWORK_IPXE=TRUE" > "edk2_config.cfg"
- name: Store edk2 repo in cache
uses: actions/cache/save@v4
with:
path: ./Edk2
key: edk2-${{ matrix.edk2-version }}
- name: Get versions of edk2
id: edk2_versions
run: |
echo "ver_current=$( echo ${{ matrix.edk2-version }} | tr -cd '0-9' )" >> "${GITHUB_OUTPUT}"
echo "ver_breaking=$( echo 'edk2-stable202305' | tr -cd '0-9' )" >> "${GITHUB_OUTPUT}"
- name: Use GCC5 for old edk2
id: gcc_toolchain
# GCC5 is deprecated since edk2-stable202305
# For more information see https://github.com/9elements/firmware-action/issues/340
run: |
if [[ ! ${{ steps.edk2_versions.outputs.ver_current }} < ${{ steps.edk2_versions.outputs.ver_breaking }} ]]; then
echo "gcc_toolchain_version=GCC" >> "${GITHUB_OUTPUT}"
else
echo "gcc_toolchain_version=GCC5" >> "${GITHUB_OUTPUT}"
fi
- name: firmware-action
uses: ./
# uses: 9elements/firmware-action
with:
config: 'tests/example_config__edk2.json'
target: 'edk2-example'
recursive: 'false'
compile: ${{ needs.changes.outputs.action }}
env:
EDK2_VERSION: ${{ matrix.edk2-version }}
GCC_TOOLCHAIN_VERSION: ${{ steps.gcc_toolchain.outputs.gcc_toolchain_version }}
- name: Get artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.edk2-version }}
path: output
retention-days: 14
# ANCHOR_END: example_build_edk2
# Example of building Firmware Stitching
# ANCHOR: example_build_stitch
build-stitching:
runs-on: ubuntu-latest
needs:
- changes
- skip-check
strategy:
matrix:
coreboot-version: ['4.19']
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }}
# Skip if pull_request_review on PR not made by a bot
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore cached coreboot-blobs repo
uses: actions/cache/restore@v4
with:
path: ./stitch
key: coreboot-blobs-${{ matrix.coreboot-version }}
- name: Clone blobs repo
run: |
git clone --depth 1 https://review.coreboot.org/blobs stitch || true
- name: Store coreboot-blobs repo in cache
uses: actions/cache/save@v4
with:
path: ./stitch
key: coreboot-blobs-${{ matrix.coreboot-version }}
- name: firmware-action
uses: ./
# uses: 9elements/firmware-action
with:
config: 'tests/example_config__firmware_stitching.json'
target: 'stitching-example'
recursive: 'false'
compile: ${{ needs.changes.outputs.action }}
env:
COREBOOT_VERSION: ${{ matrix.coreboot-version }}
- name: Get artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.coreboot-version }}
path: output
retention-days: 14
# ANCHOR_END: example_build_stitch
# Example of building u-root
# ANCHOR: example_build_uroot
build-uroot:
runs-on: ubuntu-latest
needs:
- changes
- skip-check
strategy:
matrix:
uroot-version: ['0.14.0']
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }}
# Skip if pull_request_review on PR not made by a bot
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore cached u-root repo
uses: actions/cache/restore@v4
with:
path: ./u-root
key: u-root-${{ matrix.uroot-version }}
- name: Clone u-root repo
run: |
git clone --depth 1 --branch v${{ matrix.uroot-version }} https://github.com/u-root/u-root.git || true
- name: Store u-root repo in cache
uses: actions/cache/save@v4
with:
path: ./u-root
key: u-root-${{ matrix.uroot-version }}
- name: firmware-action
uses: ./
# uses: 9elements/firmware-action
with:
config: 'tests/example_config__uroot.json'
target: 'u-root-example'
recursive: 'false'
compile: ${{ needs.changes.outputs.action }}
env:
UROOT_VERSION: ${{ matrix.uroot-version }}
- name: Get artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.uroot-version }}
path: output
retention-days: 14
# ANCHOR_END: example_build_uroot
# Example of running on non-Linux systems
test-operating-systems:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
uroot-version: ['0.14.0']
runs-on: ${{ matrix.os }}
needs:
- changes
- skip-check
if: ${{ ! (github.event_name == 'pull_request_review' && github.actor != 'github-actions[bot]') && needs.skip-check.outputs.changes == 'true' }}
# Skip if pull_request_review on PR not made by a bot
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore cached u-root repo
uses: actions/cache/restore@v4
with:
path: ./u-root
key: u-root-${{ matrix.uroot-version }}
- name: Clone u-root repo
run: |
git clone --depth 1 --branch v${{ matrix.uroot-version }} https://github.com/u-root/u-root.git || true
- name: Store u-root repo in cache
uses: actions/cache/save@v4
with:
path: ./u-root
key: u-root-${{ matrix.uroot-version }}
- name: Install docker
if: ${{ runner.os == 'macOS' }}
run: |
brew install docker
brew install colima
brew services start colima
- name: firmware-action
continue-on-error: true
# This one fails on Windows and MacOS
# Since we do not have any real use-case right now, I will not fix it
uses: ./
with:
config: 'tests/example_config.json'
target: 'u-root-example'
recursive: 'false'
compile: ${{ needs.changes.outputs.action }}
env:
UROOT_VERSION: ${{ matrix.uroot-version }}