-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun-docker-build.sh
executable file
·43 lines (36 loc) · 1.66 KB
/
run-docker-build.sh
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
#!/usr/bin/env bash
set -eu
export APP_NAME=`grep name rust-app/Cargo.toml | cut -d '"' -f2 | head -n1`
export RUST_NANOS_SDK_REV="3c22c1c1b5e2d909e34409fc92cfeed775541a63"
export RUST_NANOS_SDK_GIT="https://github.com/LedgerHQ/ledger-device-rust-sdk.git"
OUT_DIR="./docker-outputs"
for device in nanos nanosplus nanox
do
mkdir -p $OUT_DIR/$device
done
# Build apps using nightly
docker run \
--env APP_NAME \
--env RUST_NANOS_SDK_REV \
--env RUST_NANOS_SDK_GIT \
--env HOST_UID=$(id -u) \
--env HOST_GID=$(id -g) \
--rm -ti -v "$(realpath .):/app" \
ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest \
docker/run-build-in-docker.sh
# Run tests
# The speculos-wrapper need to be invoked from a dir further down, as it refers to "../ts-tests"
nix-shell -A nanos.rustShell --run "cd $OUT_DIR; ../speculos-wrapper -m nanos ../$OUT_DIR/nanos/$APP_NAME"
nix-shell -A nanosplus.rustShell --run "cd $OUT_DIR; ../speculos-wrapper -m nanosp ../$OUT_DIR/nanosplus/$APP_NAME"
nix-shell -A nanox.rustShell --run "cd $OUT_DIR; ../speculos-wrapper -m nanox ../$OUT_DIR/nanox/$APP_NAME"
echo "Tests done!"
# Create app.hex
for device in nanos nanosplus nanox
do
cp rust-app/Cargo.toml $OUT_DIR/$device/
cp rust-app/*.gif $OUT_DIR/$device/
nix-shell -A alamgu.perDevice.$device.rustShell --run "cd $OUT_DIR/$device; cargo ledger --use-prebuilt $APP_NAME --hex-next-to-json build $device"
done
echo "Use the following commands to install app"
echo 'nix-shell -A alamgu.rustShell --run "cd docker-outputs/nanos; ledgerctl install -f app_nanos.json"'
echo 'nix-shell -A alamgu.rustShell --run "cd docker-outputs/nanosplus; ledgerctl install -f app_nanosplus.json"'