-
Notifications
You must be signed in to change notification settings - Fork 0
502 lines (484 loc) · 17.5 KB
/
main.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
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# This is a basic workflow to help you get started with Actions
name: Component Build & Test CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
# Allows you to run this workflow manually from the Actions tab
#workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
mps-build:
runs-on: ubuntu-22.04
needs: libgpiod
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout submodules
run: |
git submodule update --init src/pkvm_setup/libgpiod
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key mps)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit == 'true' }}
name: "Unpack mps"
run: |
tar -xvf packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: "Cache restore: libgpiod"
uses: actions/cache/restore@v3
with:
key: ${{ needs.libgpiod.outputs.CACHE_KEY }}
path: packages/${{ needs.libgpiod.outputs.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install aarch64 toolchain
run: |
sudo apt-get update
sudo apt-get install -y {gcc,g++}-aarch64-linux-gnu
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install verilator
run: sudo apt-get install -y verilator
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Build MPS
run: |
bash src/pkvm_setup/package.sh full_build mps
- name: Upload MPS binaries
uses: actions/upload-artifact@v4
with:
name: mps-binaries
path: components/mission_protection_system/src/mps.*
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
mps-test:
runs-on: ubuntu-22.04
needs: mps-build
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
- name: Download MPS binaries
uses: actions/download-artifact@v4
with:
name: mps-binaries
- name: Display structure of downloaded files
run: |
chmod +x mps.*
mv mps.* components/mission_protection_system/src/.
- name: Install pip3
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
- name: Test MPS
run: |
cd components/mission_protection_system/tests
pip3 install -r requirements.txt
MPS_DEBUG=1 QUICK=1 python3 ./run_all.py
trusted-boot-build:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
- name: Install aarch64 toolchain
run: |
sudo apt-get update
sudo apt-get install -y {gcc,g++}-aarch64-linux-gnu
- name: Build trusted_boot
run: |
cd components/platform_crypto/shave_trusted_boot/
make clean
# Build, then check it created the correct output file.
make
[ -f trusted_boot ]
make TARGET=aarch64
[ -f trusted_boot.aarch64 ]
vm_runner:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key vm_runner)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install aarch64 toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: hecrj/setup-rust-action@v2
with:
rust-version: 1.74
targets: aarch64-unknown-linux-gnu
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Build VM runner
run: |
bash src/pkvm_setup/package.sh full_build vm_runner
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
libgpiod:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
git submodule update --init src/pkvm_setup/libgpiod
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key libgpiod)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install dependency packages
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential autoconf automake autoconf-archive \
gcc-aarch64-linux-gnu
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Build libgpiod
run: |
bash src/pkvm_setup/package.sh full_build libgpiod
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
vhost_device:
runs-on: ubuntu-22.04
needs: libgpiod
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
git config --global url."https://galoisactions:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git submodule update --init src/pkvm_setup/libgpiod
git submodule update --init src/pkvm_setup/vhost-device
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key vhost_device)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: "Cache restore: libgpiod"
uses: actions/cache/restore@v3
with:
key: ${{ needs.libgpiod.outputs.CACHE_KEY }}
path: packages/${{ needs.libgpiod.outputs.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install dependency packages
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential autoconf automake autoconf-archive \
gcc-aarch64-linux-gnu
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: hecrj/setup-rust-action@v2
with:
rust-version: 1.74
targets: aarch64-unknown-linux-gnu
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Build vhost-device
run: |
# This must match the `rust-version` installed above.
export RUSTUP_TOOLCHAIN=1.74
bash src/pkvm_setup/package.sh full_build vhost_device
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
pkvm:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
git submodule update --init src/pkvm_setup/linux-pkvm
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key pkvm)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Fetch from Artifactory
run: |
bash src/pkvm_setup/package.sh download pkvm \
-u "${{ secrets.ARTIFACTORY_RDE_GENERIC_USERNAME }}:${{ secrets.ARTIFACTORY_RDE_GENERIC_ACCESS_TOKEN }}"
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
qemu:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
git config --global url."https://galoisactions:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git submodule update --init src/pkvm_setup/qemu
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key qemu)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Fetch from Artifactory
run: |
bash src/pkvm_setup/package.sh download qemu \
-u "${{ secrets.ARTIFACTORY_RDE_GENERIC_USERNAME }}:${{ secrets.ARTIFACTORY_RDE_GENERIC_ACCESS_TOKEN }}"
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
vm_image_base:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key vm_image_base)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Fetch from Artifactory
run: |
bash src/pkvm_setup/package.sh download vm_image_base \
-u "${{ secrets.ARTIFACTORY_RDE_GENERIC_USERNAME }}:${{ secrets.ARTIFACTORY_RDE_GENERIC_ACCESS_TOKEN }}"
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
vm_images:
runs-on: ubuntu-22.04
needs:
- vm_runner
- vhost_device
- pkvm
- qemu
- vm_image_base
steps:
- uses: actions/checkout@v4
- name: Checkout submodules
run: |
git config --global url."https://galoisactions:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git submodule update --init src/pkvm_setup/libgpiod
git submodule update --init src/pkvm_setup/vhost-device
git submodule update --init src/pkvm_setup/linux-pkvm
git submodule update --init src/pkvm_setup/qemu
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key vm_images)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: "Cache restore: vm_runner"
uses: actions/cache/restore@v3
with:
key: ${{ needs.vm_runner.outputs.CACHE_KEY }}
path: packages/${{ needs.vm_runner.outputs.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: "Cache restore: vhost_device"
uses: actions/cache/restore@v3
with:
key: ${{ needs.vhost_device.outputs.CACHE_KEY }}
path: packages/${{ needs.vhost_device.outputs.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: "Cache restore: pkvm"
uses: actions/cache/restore@v3
with:
key: ${{ needs.pkvm.outputs.CACHE_KEY }}
path: packages/${{ needs.pkvm.outputs.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: "Cache restore: qemu"
uses: actions/cache/restore@v3
with:
key: ${{ needs.qemu.outputs.CACHE_KEY }}
path: packages/${{ needs.qemu.outputs.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: "Cache restore: vm_image_base"
uses: actions/cache/restore@v3
with:
key: ${{ needs.vm_image_base.outputs.CACHE_KEY }}
path: packages/${{ needs.vm_image_base.outputs.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install dependency packages
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-arm qemu-utils
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Build VM images
run: |
bash src/pkvm_setup/package.sh full_build vm_images
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
mps-test-vm:
# Other jobs use Ubuntu 22.04, but that release has an old version of QEMU
# (6.2) and doesn't support vhost-user-gpio devices.
runs-on: ubuntu-24.04
needs:
- mps-build
- vm_images
- vhost_device
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download MPS binaries
uses: actions/download-artifact@v4
with:
name: mps-binaries
- name: Prepare MPS binaries for use
run: |
chmod +x mps.*
mv mps.* components/mission_protection_system/src/.
- name: "Cache restore: vm_images"
uses: actions/cache/restore@v3
with:
key: ${{ needs.vm_images.outputs.CACHE_KEY }}
path: packages/${{ needs.vm_images.outputs.CACHE_KEY }}.tar.gz
- name: "Cache restore: vhost_device"
uses: actions/cache/restore@v3
with:
key: ${{ needs.vhost_device.outputs.CACHE_KEY }}
path: packages/${{ needs.vhost_device.outputs.CACHE_KEY }}.tar.gz
- name: "Unpack vm_images"
run: |
tar -xvf packages/${{ needs.vm_images.outputs.CACHE_KEY }}.tar.gz
- name: "Unpack vhost_device"
run: |
tar -xvf packages/${{ needs.vhost_device.outputs.CACHE_KEY }}.tar.gz
- name: Install QEMU
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-arm
- uses: hecrj/setup-rust-action@v2
with:
rust-version: 1.74
- name: Run MPS tests
run: RUST_LOG=trace MPS_DEBUG=1 python3 src/vm_runner/tests/mps/run_tests.py
ardupilot:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout submodules
run: |
git config --global url."https://galoisactions:${{ secrets.VERSE_VHOST_DEVICE_ACCESS_TOKEN }}@github.com/".insteadOf "[email protected]:"
git submodule update --init components/autopilot/ardupilot
- name: Hash inputs
id: hash
run: |
cache_key="$(bash src/pkvm_setup/package.sh cache_key ardupilot)"
echo "Cache key: $cache_key"
echo "CACHE_KEY=$cache_key" >>$GITHUB_OUTPUT
echo "CACHE_KEY=$cache_key" >>$GITHUB_ENV
- name: Cache results
id: cache
uses: actions/cache@v3
with:
key: ${{ env.CACHE_KEY }}
path: packages/${{ env.CACHE_KEY }}.tar.gz
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Install dependencies
run: |
sudo apt-get update
BUILD_ONLY=1 bash components/autopilot/ardupilot_install_deps.sh
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Fetch additional submodules for build
run: |
bash components/autopilot/ardupilot_init_submodules.sh
- if: ${{ steps.cache.outputs.cache-hit != 'true' }}
name: Build ArduPilot
run: |
bash src/pkvm_setup/package.sh full_build ardupilot
outputs:
CACHE_KEY: ${{ steps.hash.outputs.CACHE_KEY }}
jsbsim_proxy:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
# jsbsim_proxy is trivial to build, so we don't bother packaging or
# caching it.
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install build-essential
- name: Build jsbsim_proxy
run: |
cd src/jsbsim_proxy
make
[ -f jsbsim_proxy ]
mkm:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
# mkm is trivial to build, so we don't bother packaging or caching it.
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y {gcc,g++}-aarch64-linux-gnu
- name: Build mkm
run: |
cd components/mission_key_management
make
[ -f mkm ]
make TARGET=aarch64
[ -f mkm.aarch64 ]
# Run tests
python3 run_tests.py