-
Notifications
You must be signed in to change notification settings - Fork 1
400 lines (339 loc) · 11.5 KB
/
main.yaml
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
# This is based on
# <https://github.com/ongardie/cubicle/blob/b307fe9/.github/workflows/main.yaml>
# with Diego's permission. The initial workflow YAML skeleton before that was
# based on
# <https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml>
# and
# <https://github.com/ramosbugs/oauth2-rs/blob/main/.github/workflows/main.yml>.
#
# GitHub Actions workflow syntax documentation is here:
# <https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions>.
name: CI
on:
pull_request: {}
push:
branches:
- main
workflow_dispatch: {}
env:
INSTALL_RUST_VERSION: "1.75"
jobs:
rust_ppc:
name: Build PPC
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Free up some space on image
# see https://github.com/actions/runner-images/issues/2840
run: |
sudo rm -rf /usr/share/dotnet
shell: bash
- name: Install Rust with source
uses: actions-rs/toolchain@v1
with:
components: rust-src
default: true
profile: minimal
toolchain: ${{ env.INSTALL_RUST_VERSION }}
- name: Install PowerPC cross-compile dependencies
run: sudo apt update && sudo apt install qemu-user qemu-user-binfmt gcc-12-powerpc-linux-gnu
- name: Cross Compile PowerPC
run: ./build-ppc.sh
- name: Run unit tests on PowerPC
run: ./test-ppc.sh
cross_version_sdk:
# runs the latest realm code built with its particular sdk version
# with a client built from a specific sdk release.
name: SDK Cross version test
runs-on: ubuntu-22.04
timeout-minutes: 20
strategy:
matrix:
sdk_version: ["0.3.0", "main"]
steps:
- name: Check out hsm sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Check out sdk client sources
uses: actions/checkout@v4
with:
repository: "juicebox-systems/juicebox-sdk"
ref: ${{ matrix.sdk_version }}
path: "sdk_client"
submodules: recursive
- name: setup environment
uses: ./.github/actions/setup
with:
rust_version: ${{ env.INSTALL_RUST_VERSION }}
- name: build realm
uses: actions-rs/cargo@v1
with:
command: build
- name: Build client
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path sdk_client/rust/cli/demo/Cargo.toml
- name: Run demo
run: |
RUST_BACKTRACE=1 target/debug/demo_runner --demo sdk_client/target/debug/demo
shell: bash
cross_version_hsm:
# Runs the latest realm code against an older version of the software HSM
# This helps ensure we move the agent code forward without breaking compatability
# with the deployed and un-updatable hsm code.
name: HSM Cross version test
# Use same runner as Lint & Test. See comment there.
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
# Cancel Prepared Transfer fix (PR #462).
hsm_version: ["19a29d9f7dfd20f210f377d1ff9d22685d238ea1"]
steps:
- name: Check out sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Check out versioned hsm
uses: actions/checkout@v4
with:
ref: ${{ matrix.hsm_version }}
path: "versioned_hsm"
submodules: recursive
- name: Setup environment
uses: ./.github/actions/setup
with:
rust_version: ${{ env.INSTALL_RUST_VERSION }}
- name: Build versioned software HSM
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path versioned_hsm/Cargo.toml -p software_hsm
- name: Build realm
uses: actions-rs/cargo@v1
with:
command: build
- name: Run realm tests with versioned software HSM
uses: actions-rs/cargo@v1
with:
command: test
env:
RUST_BACKTRACE: '1'
SOFTWARE_HSM_DIR: ${{ github.workspace }}/versioned_hsm/target/debug
swift_demo:
name: Swift Demo
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Check out sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: Remove android emulator
# This is on the path and clashes with the bigtable emulator which is also
# called emulator.
shell: bash
run: |
rm /Users/runner/Library/Android/sdk/tools/emulator || true
- name: Setup environment
uses: ./.github/actions/setup
with:
rust_version: ${{ env.INSTALL_RUST_VERSION }}
skip_gcloud_cli_install: true
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
- name: Build FFI
run: cd sdk && ./swift/ffi.sh
- name: Use Swift Cache
uses: actions/cache@v3
with:
path: sdk/swift/demo/.build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build Swift Demo
run: cd sdk/swift/demo && swift build --verbose
- name: Run demo
run: |
RUST_BACKTRACE=1 target/debug/demo_runner --minimal --demo sdk/swift/demo/.build/debug/demo
shell: bash
lint_and_test:
name: Lint & Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: setup environment
uses: ./.github/actions/setup
with:
rust_version: ${{ env.INSTALL_RUST_VERSION }}
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
- name: Print build info
run: target/debug/load_balancer --version
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
args: --workspace --exclude 'entrust*' --package entrust_ops
command: test
env:
RUST_BACKTRACE: '1'
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
args: --all -- --check
command: fmt
- name: Run clippy
uses: actions-rs/cargo@v1
with:
args: --workspace --tests --exclude 'entrust*' --package entrust_ops -- -D warnings
command: clippy
- name: Install graphviz
run: sudo apt install graphviz
- name: Delete Merkle tree paper outputs
run: |
rm -r docs/merkle_tree/
git restore --source HEAD \
docs/merkle_tree/intro/system.dot \
docs/merkle_tree/intro/stacked_box.png \
docs/merkle_tree/storage/base128.dot \
docs/merkle_tree/merkle.typ \
docs/merkle_tree/references.bib \
docs/merkle_tree/template.typ \
docs/merkle_tree/to_tree.py
- name: Compile Merkle tree paper
uses: actions-rs/cargo@v1
with:
command: run
args: --package merkle_tree_docgen
- name: Check Merkle tree paper outputs
run: git diff --exit-code -- docs/merkle_tree
- name: Run Merkle tree paper Python
run: python3 docs/merkle_tree/to_tree.py
- name: Check SDK dependency versions agree
run: ./scripts/check-sdk-deps.py
wasm_demo:
name: WASM Demo
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out sources
uses: actions/checkout@v4
with:
submodules: recursive
- name: setup environment
uses: ./.github/actions/setup
with:
rust_version: ${{ env.INSTALL_RUST_VERSION }}
- uses: actions/setup-node@v3
with:
# it's not possible to pin certs yet with the experimental fetch in node 18,
# and our polyfill doesn't work well in 18. stick with 16 for now.
node-version: 16
- uses: jetli/[email protected]
- name: Build WASM
run: wasm-pack build sdk/rust/sdk/bridge/wasm --out-dir ../../../../javascript/juicebox-sdk --out-name juicebox-sdk --target nodejs
- name: NPM Install
run: |
cd sdk/javascript/demo
npm install
npm install -g ts-node
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
- name: Run demo
run: |
RUST_BACKTRACE=1 target/debug/demo_runner --demo sdk/javascript/demo/demo.ts
shell: bash
# Disabled, as the ncipher-shield-firmware is not proprietary and no longer hosted by us
# in a way that Github Actions can access.
# entrust:
# name: Build Entrust
# runs-on: ubuntu-latest
# timeout-minutes: 20
# steps:
# - name: Check out sources
# uses: actions/checkout@v4
# with:
# submodules: recursive
# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# components: clippy, rustfmt, rust-src
# default: true
# profile: minimal
# toolchain: ${{ env.INSTALL_RUST_VERSION }}
# - name: Use Rust Cache
# uses: Swatinem/rust-cache@v2
# - name: Authenticate to Google Cloud
# uses: google-github-actions/auth@v1
# with:
# credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT }}'
# - name: Download Codesafe from Google Cloud Storage
# run: |
# gcloud storage cp 'gs://ncipher-nshield-firmware/2023-08 v13.4 codesafe firmware secworld/Codesafe_Lin64-13.4.3.iso.zip' .
# echo '7d6eaff0548d90143d35834f1ea1cf092321e9003e10e14895a01a6f412adadb Codesafe_Lin64-13.4.3.iso.zip' | sha256sum -c -
# - name: Install Codesafe
# run: |
# unzip Codesafe_Lin64-13.4.3.iso.zip
# 7z e Codesafe_Lin64-13.4.3.iso linux/amd64/csd.tar.gz
# sudo tar -C / -xf csd.tar.gz
# rm Codesafe_Lin64-13.4.3.iso.zip Codesafe_Lin64-13.4.3.iso csd.tar.gz
# - name: Run clippy (entrust* crates)
# uses: actions-rs/cargo@v1
# with:
# args: --tests --package 'entrust*' -- -D warnings
# command: clippy
# - name: Run cargo build (entrust* crates)
# uses: actions-rs/cargo@v1
# with:
# args: --package 'entrust*'
# command: build
# - name: Run cargo test (entrust* crates)
# uses: actions-rs/cargo@v1
# with:
# args: --package 'entrust*'
# command: test
# env:
# RUST_BACKTRACE: '1'
# - name: Run release build
# uses: actions-rs/cargo@v1
# with:
# args: --all --release
# command: build
# - name: Run cargo build (PPC entrust_hsm.elf)
# run: ./entrust_hsm/compile_linux.sh --features insecure
# - name: Publish build to GCP bucket
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# run: |
# PROJECT='juicebox-infra'
# # bucket is sha1("ci-builds\n")
# GSPATH="9c39e3ca5fca69f058b9e673aef193b10d9e8c48/${{github.sha}}/"
# gcloud storage cp \
# "target/release/cluster" \
# "target/release/cluster_bench" \
# "target/release/cluster_manager" \
# "target/release/load_balancer" \
# "target/release/service_checker" \
# "target/release/software_agent" \
# "target/release/software_hsm" \
# "target/release/chaos" \
# "target/release/entrust_agent" \
# "target/release/entrust_init" \
# "target/release/entrust_ops" \
# "target/powerpc-unknown-linux-gnu/release/entrust_hsm.elf" \
# "gs://$GSPATH/"