forked from eclipse-leda/leda-distro
-
Notifications
You must be signed in to change notification settings - Fork 1
444 lines (436 loc) · 19 KB
/
build-selfhosted.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
434
435
436
437
438
439
440
441
442
443
444
# /********************************************************************************
# * Copyright (c) 2023 Contributors to the Eclipse Foundation
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License 2.0 which is available at
# * https://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/
#
# To run on Eclipse managed GitHub Runner, set to run on self-hosted and add a container name to the job:
# runs-on: self-hosted
# container: debian:bullseye
#
name: BitBake Build (Self-Hosted)
on:
workflow_dispatch:
workflow_call:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
pull-requests: write
jobs:
leda-qemux86_64:
name: "qemux86_64"
runs-on: self-hosted
continue-on-error: true
steps:
- name: Cleanup test reports
run: |
sudo rm -rf resources/docker-snapshot/leda-tests-reports
- name: Checkout
uses: actions/checkout@v3
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends socat file gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm python3-subunit mesa-common-dev zstd liblz4-tool tmux mc skopeo fdisk ruby-full jq libvirt-clients libvirt-daemon-system qemu-system-x86 qemu-system-arm qemu-kvm squashfs-tools rauc python3-newt ca-certificates curl gnupg lsb-release
- name: Install kas
run: sudo pip3 install kas
- name: Cache SState
id: cache-sstate
uses: pat-s/[email protected]
with:
path: build/sstate-cache
key: bb-sstate-cache-qemux86-64
- name: Build sdv-image-all
env:
KAS_MACHINE: qemux86-64
run: |
(r=3;while ! kas build kas/leda-qemux86-64.yaml:kas/mirrors.yaml:kas/oss-compliance/spdx.yaml ; do ((--r))||exit;sleep 60;done)
- name: Generate CHANGELOG.md
run: |
docker run --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator github_changelog_generator -u eclipse-leda -p leda-distro --no-author -t ${{ secrets.GITHUB_TOKEN }}
- name: Package all files
run: |
export ARC=eclipse-leda-qemu-x86_64.tar
rm -f ${ARC}.xz
time tar --create --gzip --file 3rdparty-licenses.tar.gz -C ./build/tmp/deploy/licenses/ .
time tar --create --verbose --file ${ARC} -C ./resources/runners/qemux86_64/ \
run-leda.sh \
run-leda.cmd \
readme.txt
time tar --append --verbose --file ${ARC} -C scripts/ \
provision-device.sh
time tar --append --verbose --file ${ARC} -C ./ \
LICENSE \
NOTICE.md \
CHANGELOG.md \
README.md \
3rdparty-licenses.tar.gz \
examples
time tar --append --verbose --dereference --file ${ARC} -C ./build/tmp/deploy/images/qemux86-64/ \
bzImage-qemux86-64.bin \
sdv-image-all-qemux86-64.wic.qcow2 \
sdv-rauc-bundle-minimal-qemux86-64.raucb \
sdv-rauc-bundle-full-qemux86-64.raucb \
sdv-rauc-bundle-rescue-qemux86-64.raucb \
ovmf.qcow2
time xz -v -8 -T0 ${ARC}
- name: Upload files
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-qemu-x86_64.tar.xz
if-no-files-found: error
path: eclipse-leda-qemu-x86_64.tar.xz
- name: Convert SPDX files to CycloneDX format
run: |
wget -nc -O cyclonedx https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.24.2/cyclonedx-linux-x64
chmod +x ./cyclonedx
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/qemux86-64/runtime ./cyclonedx-sbom-qemux86/runtime
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/qemux86-64/recipes ./cyclonedx-sbom-qemux86/recipes
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/qemux86-64/packages ./cyclonedx-sbom-qemux86/packages
env:
CYCLONEDX_CLI: ./cyclonedx
CONVERTER_LOG_LEVEL: INFO
- name: Package CycloneDX SBOM
run: |
tar --create --gzip --file eclipse-leda-cyclonedx-sbom-qemux86_64.tar.gz -C ./cyclonedx-sbom-qemux86 .
- name: Upload CycloneDX SBOM
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-cyclonedx-sbom-qemux86_64.tar.gz
if-no-files-found: error
path: eclipse-leda-cyclonedx-sbom-qemux86_64.tar.gz
- name: Package SPDX files
run: |
tar --create --gzip --file eclipse-leda-spdx-sbom-qemux86_64.tar.gz -C ./build/tmp/deploy/spdx/qemux86-64/ .
- name: Upload SPDX SBOM
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-spdx-sbom-qemux86_64.tar.gz
if-no-files-found: error
path: eclipse-leda-spdx-sbom-qemux86_64.tar.gz
- name: Package Patched Sources
run: |
tar --create --gzip --file eclipse-leda-sources-qemux86_64.tar.gz -C ./build/tmp/deploy/sources/ .
- name: Upload files
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-sources-qemux86_64.tar.gz
if-no-files-found: error
path: eclipse-leda-sources-qemux86_64.tar.gz
- uses: bacongobbler/[email protected]
if: github.repository_owner == 'SoftwareDefinedVehicle'
with:
source_dir: 'build/sstate-cache/'
extra_args: '--destination-path sstate-cache/'
container_name: 'yocto-sstate-cache'
overwrite: 'true'
connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
leda-qemuarm64:
name: "qemuarm64"
runs-on: self-hosted
continue-on-error: true
steps:
- name: Cleanup test reports
run: |
sudo rm -rf resources/docker-snapshot/leda-tests-reports
- name: Checkout
uses: actions/checkout@v3
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends socat file gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm python3-subunit mesa-common-dev zstd liblz4-tool tmux mc skopeo fdisk ruby-full jq libvirt-clients libvirt-daemon-system qemu-system-x86 qemu-system-arm qemu-kvm squashfs-tools rauc python3-newt ca-certificates curl gnupg lsb-release
- name: Install kas
run: sudo pip3 install kas
- name: Cache SState
id: cache-sstate
uses: pat-s/[email protected]
with:
path: build/sstate-cache
key: bb-sstate-cache-qemuarm64
- name: Build sdv-image-all
env:
KAS_MACHINE: qemuarm64
run: |
(r=3;while ! kas build kas/leda-qemuarm64.yaml:kas/mirrors.yaml:kas/oss-compliance/spdx.yaml ; do ((--r))||exit;sleep 60;done)
- name: Generate CHANGELOG.md
run: |
docker run --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator github_changelog_generator -u eclipse-leda -p leda-distro --no-author -t ${{ secrets.GITHUB_TOKEN }}
- name: Package all files
run: |
export ARC=eclipse-leda-qemu-arm64.tar
rm -f ${ARC}.xz
time tar --create --gzip --file 3rdparty-licenses.tar.gz -C ./build/tmp/deploy/licenses/ .
time tar --create --verbose --file ${ARC} -C ./resources/runners/qemuarm64/ \
run-leda.sh \
run-leda.cmd \
readme.txt
time tar --append --verbose --file ${ARC} -C scripts/ \
provision-device.sh
time tar --append --verbose --file ${ARC} -C ./ \
LICENSE \
NOTICE.md \
CHANGELOG.md \
README.md \
3rdparty-licenses.tar.gz \
examples
time tar --append --verbose --dereference --file ${ARC} -C ./build/tmp/deploy/images/qemuarm64/ \
Image-qemuarm64.bin \
sdv-image-all-qemuarm64.wic.qcow2 \
sdv-rauc-bundle-full-qemuarm64.raucb \
sdv-rauc-bundle-minimal-qemuarm64.raucb \
sdv-rauc-bundle-rescue-qemuarm64.raucb \
u-boot.bin
time xz -v -8 -T0 ${ARC}
- name: Upload files
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-qemu-arm64.tar.xz
if-no-files-found: error
path: eclipse-leda-qemu-arm64.tar.xz
- name: Convert SPDX files to CycloneDX format
run: |
wget -nc -O cyclonedx https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.24.2/cyclonedx-linux-x64
chmod +x ./cyclonedx
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/qemuarm64/runtime ./cyclonedx-sbom-qemuarm64/runtime
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/qemuarm64/recipes ./cyclonedx-sbom-qemuarm64/recipes
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/qemuarm64/packages ./cyclonedx-sbom-qemuarm64/packages
env:
CYCLONEDX_CLI: ./cyclonedx
CONVERTER_LOG_LEVEL: INFO
- name: Package CycloneDX SBOM
run: |
tar --create --gzip --file eclipse-leda-cyclonedx-sbom-qemuarm64.tar.gz -C ./cyclonedx-sbom-qemuarm64 .
- name: Upload CycloneDX SBOM
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-cyclonedx-sbom-qemuarm64.tar.gz
if-no-files-found: error
path: eclipse-leda-cyclonedx-sbom-qemuarm64.tar.gz
- name: Package SPDX files
run: |
tar --create --gzip --file eclipse-leda-spdx-sbom-qemuarm64.tar.gz -C ./build/tmp/deploy/spdx/qemuarm64/ .
- name: Upload files
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-spdx-sbom-qemuarm64.tar.gz
if-no-files-found: error
path: eclipse-leda-spdx-sbom-qemuarm64.tar.gz
- name: Package Patched Sources
run: |
tar --create --gzip --file eclipse-leda-sources-qemuarm64.tar.gz -C ./build/tmp/deploy/sources/ .
- name: Upload files
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-sources-qemuarm64.tar.gz
if-no-files-found: error
path: eclipse-leda-sources-qemuarm64.tar.gz
- uses: bacongobbler/[email protected]
if: github.repository_owner == 'SoftwareDefinedVehicle'
with:
source_dir: 'build/sstate-cache/'
extra_args: '--destination-path sstate-cache/'
container_name: 'yocto-sstate-cache'
overwrite: 'true'
connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
leda-raspberrypi4-64:
name: "raspberrypi4-64"
runs-on: self-hosted
needs: leda-qemuarm64
continue-on-error: true
steps:
- name: Cleanup test reports
run: |
sudo rm -rf resources/docker-snapshot/leda-tests-reports
- name: Checkout
uses: actions/checkout@v3
- name: Install tools
run: sudo apt-get install -y --no-install-recommends socat file gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm python3-subunit mesa-common-dev zstd liblz4-tool tmux mc skopeo fdisk ruby-full jq libvirt-clients libvirt-daemon-system qemu-system-x86 qemu-system-arm qemu-kvm squashfs-tools rauc python3-newt ca-certificates curl gnupg lsb-release
- name: Install kas
run: sudo pip3 install kas
- name: Cache SState
id: cache-sstate
uses: pat-s/[email protected]
with:
path: build/sstate-cache
key: bb-sstate-cache-raspberrypi4-64
- name: Build sdv-image-all
env:
KAS_MACHINE: raspberrypi4-64
run: |
(r=3;while ! kas build kas/leda-raspberrypi4-64.yaml:kas/mirrors.yaml:kas/oss-compliance/spdx.yaml ; do ((--r))||exit;sleep 60;done)
- name: Generate CHANGELOG.md
run: |
docker run --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator github_changelog_generator -u eclipse-leda -p leda-distro --no-author -t ${{ secrets.GITHUB_TOKEN }}
- name: Package all files
run: |
export ARC=eclipse-leda-raspberrypi.tar
rm -f ${ARC}.xz
time tar --create --verbose --gzip --file 3rdparty-licenses.tar.gz -C ./build/tmp/deploy/licenses/ .
time tar --create --verbose --file ${ARC} -C resources/runners/raspberrypi4/ \
readme.txt
time tar --append --verbose --file ${ARC} -C ./ \
LICENSE \
NOTICE.md \
CHANGELOG.md \
README.md \
3rdparty-licenses.tar.gz \
examples
time tar --append --verbose --dereference --file ${ARC} -C ./build/tmp/deploy/images/raspberrypi4-64/ \
Image-raspberrypi4-64.bin \
sdv-image-all-raspberrypi4-64.wic.bz2 \
sdv-image-all-raspberrypi4-64.wic.bmap \
sdv-rauc-bundle-full-raspberrypi4-64.raucb \
sdv-rauc-bundle-minimal-raspberrypi4-64.raucb \
sdv-rauc-bundle-rescue-raspberrypi4-64.raucb
time xz -v -1 -T0 ${ARC}
- name: Upload files
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-raspberrypi.tar.xz
if-no-files-found: error
path: eclipse-leda-raspberrypi.tar.xz
- name: Convert SPDX files to CycloneDX format
run: |
wget -nc -O cyclonedx https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.24.2/cyclonedx-linux-x64
chmod +x ./cyclonedx
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/raspberrypi4-64/runtime ./cyclonedx-sbom-raspberrypi4-64/runtime
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/raspberrypi4-64/recipes ./cyclonedx-sbom-raspberrypi4-64/recipes
python3 ./.github/workflow-scripts/sbom-converter.py ./build/tmp/deploy/spdx/raspberrypi4-64/packages ./cyclonedx-sbom-raspberrypi4-64/packages
env:
CYCLONEDX_CLI: ./cyclonedx
CONVERTER_LOG_LEVEL: INFO
- name: Package CycloneDX SBOM
run: |
tar --create --gzip --file eclipse-leda-cyclonedx-sbom-raspberrypi4-64.tar.gz -C ./cyclonedx-sbom-raspberrypi4-64 .
- name: Upload CycloneDX SBOM
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-cyclonedx-sbom-raspberrypi4-64.tar.gz
if-no-files-found: error
path: eclipse-leda-cyclonedx-sbom-raspberrypi4-64.tar.gz
- name: Package SPDX files
run: |
tar --create --gzip --file eclipse-leda-spdx-sbom-raspberrypi4-64.tar.gz -C ./build/tmp/deploy/spdx/raspberrypi4-64/ .
- name: Upload files
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-spdx-sbom-raspberrypi4-64.tar.gz
if-no-files-found: error
path: eclipse-leda-spdx-sbom-raspberrypi4-64.tar.gz
- name: Package Patched Sources
run: |
tar --create --gzip --file eclipse-leda-sources-raspberrypi4-64.tar.gz -C ./build/tmp/deploy/sources/ .
- name: Upload files
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-sources-raspberrypi4-64.tar.gz
if-no-files-found: error
path: eclipse-leda-sources-raspberrypi4-64.tar.gz
- uses: bacongobbler/[email protected]
if: github.repository_owner == 'SoftwareDefinedVehicle'
with:
source_dir: 'build/sstate-cache/'
extra_args: '--destination-path sstate-cache/'
container_name: 'yocto-sstate-cache'
overwrite: 'true'
connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
leda-docker:
name: "docker"
runs-on: self-hosted
needs:
- leda-qemuarm64
- leda-qemux86_64
continue-on-error: true
steps:
- name: Cleanup test reports
run: |
sudo rm -rf resources/docker-snapshot/leda-tests-reports
- name: Checkout
uses: actions/checkout@v3
- name: Install tools
run: sudo apt-get install -y --no-install-recommends socat file gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm python3-subunit mesa-common-dev zstd liblz4-tool tmux mc skopeo fdisk ruby-full jq libvirt-clients libvirt-daemon-system qemu-system-x86 qemu-system-arm qemu-kvm squashfs-tools rauc python3-newt ca-certificates curl gnupg lsb-release
- name: Install kas
run: sudo pip3 install kas
- name: Cache SState
id: cache-sstate
uses: pat-s/[email protected]
with:
path: build/sstate-cache
key: bb-sstate-cache-raspberrypi4-64
- name: Build qemux86-64
env:
KAS_MACHINE: qemux86-64
run: |
(r=3;while ! kas build kas/leda-qemux86-64.yaml:kas/mirrors.yaml:kas/oss-compliance/spdx.yaml ; do ((--r))||exit;sleep 60;done)
- name: Build qemuarm64
env:
KAS_MACHINE: qemuarm64
run: |
(r=3;while ! kas build kas/leda-qemuarm64.yaml:kas/mirrors.yaml:kas/oss-compliance/spdx.yaml ; do ((--r))||exit;sleep 60;done)
- name: Stop docker
if: always()
run: |
cd resources/docker-snapshot
./stop-docker.sh
./clear-docker.sh
- name: Build docker images
run: |
cd resources/docker-snapshot
./build-docker.sh
- name: Startup docker
run: |
cd resources/docker-snapshot
./run-docker.sh
- name: Run docker tests
timeout-minutes: 60
run: |
cd resources/docker-snapshot
./test-docker.sh
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v3
with:
name: eclipse-leda-tests
if-no-files-found: error
path: resources/docker-snapshot/leda-tests-reports
- name: Publish docker images
env:
GITHUB_TOKEN: ${{ secrets.ECLIPSE_LEDA_PUBLISH_DOCKER }}
run: |
cd resources/docker-snapshot
./publish-docker.sh
- name: Stop docker
if: always()
run: |
cd resources/docker-snapshot
./stop-docker.sh
./clear-docker.sh
generate_report:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: always()
needs: [ leda-docker ]
runs-on: self-hosted
steps:
- name: Cleanup test reports
run: |
sudo rm -rf resources/docker-snapshot/leda-tests-reports
- uses: actions/checkout@v2
- name: Download reports
uses: actions/download-artifact@v1
with:
name: eclipse-leda-tests
- name: Send report to commit
uses: joonvena/[email protected]
with:
report_path: eclipse-leda-tests
gh_access_token: ${{ secrets.GITHUB_TOKEN }}