Skip to content

Commit

Permalink
Merge pull request #15 from Zondax/feat-stax-v2
Browse files Browse the repository at this point in the history
support stax
  • Loading branch information
ftheirs authored Mar 20, 2023
2 parents da151c8 + a5af71d commit 01ccc6a
Show file tree
Hide file tree
Showing 107 changed files with 321 additions and 4,446 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Verify PRs to main"
name: Verify PRs to main

on:
workflow_dispatch:
pull_request:
branches:
- main
Expand All @@ -13,33 +14,26 @@ jobs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
steps:
- id: get-user
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT

get_version:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
image: zondax/ledger-app-builder:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
SDK_VARNAME: NANOSP_SDK
outputs:
version: ${{ steps.store-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true

- name: Invoke `version`
shell: bash -l {0}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
run: make version

- run: make version
- id: store-version
run: echo ::set-output name=version::$(cat ./app/app.version)
run: echo "version=$(cat ./app/app.version)" >> $GITHUB_OUTPUT

check_app_version:
needs: get_version
Expand All @@ -56,4 +50,4 @@ jobs:

- name: Tag exists
if: ${{ steps.checkTag.outputs.exists == 'true' }}
run: exit 1
run: exit 1
4 changes: 2 additions & 2 deletions .github/workflows/ledger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true

Expand All @@ -34,4 +34,4 @@ jobs:
if: failure()
with:
name: scan-build
path: scan-build
path: scan-build
102 changes: 53 additions & 49 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Build
on: [ push ]
on:
workflow_dispatch:
push:
pull_request:
branches:
- main
- develop

jobs:
configure:
Expand All @@ -8,42 +14,52 @@ jobs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
steps:
- id: get-user
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT

build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
- name: Install deps
run: |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
make deps
- run: cmake -DCMAKE_BUILD_TYPE=Debug . && make
- run: GTEST_COLOR=1 ASAN_OPTIONS=detect_leaks=0 ctest -VV
- run: make cpp_test

build_ledger:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
image: zondax/ledger-app-builder:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
env:
BOLOS_SDK: /opt/nanos-secure-sdk
outputs:
size: ${{steps.build.outputs.size}}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
- name: Build Standard app
id: build
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
echo "size=$(python3 deps/ledger-zxlib/scripts/getSize.py s)" >> $GITHUB_OUTPUT
size_nano_s:
needs: build_ledger
runs-on: ubuntu-latest
env:
NANOS_LIMIT_SIZE: 136
steps:
- run: |
echo "LNS app size: ${{needs.build_ledger.outputs.size}} KiB"
[ ${{needs.build_ledger.outputs.size}} -le $NANOS_LIMIT_SIZE ]
test_zemu:
runs-on: ubuntu-latest
Expand All @@ -54,48 +70,40 @@ jobs:
echo $HOME
echo $DISPLAY
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
- name: Install rust
run: |
sudo apt-get update
sudo apt-get install -y cmake binutils-dev libcurl4-openssl-dev libiberty-dev libelf-dev libdw-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y;
- name: Install node
uses: actions/setup-node@v2
with:
node-version: '14.17.0'
uses: actions/setup-node@v3
- name: Install yarn
run: |
npm install -g yarn
- name: Build Ledger app
run: |
make SUBSTRATE_PARSER_FULL=1
run: make
- name: Build/Install build js deps
run: |
export PATH=~/.cargo/bin:$PATH
make zemu_install
run: make zemu_install
- name: Run zemu tests
run: |
export PATH=~/.cargo/bin:$PATH
make zemu_test
run: "cd tests_zemu; yarn test"
- name: Upload Snapshots (only failure)
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: snapshots-tmp
path: tests_zemu/snapshots-tmp/

build_package_0:
needs: [ configure, build, build_ledger, test_zemu]
build_package_nanos:
needs: [configure, build, build_ledger, test_zemu]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
image: zondax/ledger-app-builder:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
env:
BOLOS_SDK: /opt/nanos-secure-sdk
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
- name: Install deps
Expand All @@ -104,12 +112,11 @@ jobs:
- name: Build NanoS
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos.sh
- name: Set tag
id: nanos
run: echo ::set-output name=tag_name::$(./app/pkg/installer_nanos.sh version)
run: echo "tag_name=$(./app/pkg/installer_nanos.sh version)" >> $GITHUB_OUTPUT
- name: Create or Update Release (1)
id: create_release_0
uses: softprops/action-gh-release@v1
Expand All @@ -121,20 +128,18 @@ jobs:
draft: false
prerelease: false

build_package_1:
needs: [ configure, build, build_ledger, test_zemu ]
build_package_nanosp:
needs: [configure, build, build_ledger, test_zemu]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
image: zondax/ledger-app-builder:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanosplus-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
env:
BOLOS_SDK: /opt/nanosplus-secure-sdk
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: true
- name: Install deps
Expand All @@ -143,12 +148,11 @@ jobs:
- name: Build NanoSP
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
mv ./app/pkg/installer_s2.sh ./app/pkg/installer_nanos_plus.sh
- name: Set tag
id: nanosp
run: echo ::set-output name=tag_name::$(./app/pkg/installer_nanos_plus.sh version)
run: echo "tag_name=$(./app/pkg/installer_nanos_plus.sh version)" >> $GITHUB_OUTPUT
- name: Update Release
id: update_release_2
uses: softprops/action-gh-release@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fuzz/corpora

!build/.gitkeep
build/*
app/build/*
cmake-build-debug

tests_zemu/snapshots-tmp
Expand Down
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
url = https://github.com/LedgerHQ/nanos-secure-sdk
[submodule "deps/nanosplus-secure-sdk"]
path = deps/nanosplus-secure-sdk
url = https://github.com/LedgerHQ/nanosplus-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "deps/nanox-secure-sdk"]
path = deps/nanox-secure-sdk
url = https://github.com/LedgerHQ/nanox-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
[submodule "cmake/cmake-modules"]
path = cmake/cmake-modules
url = https://github.com/bilke/cmake-modules
Expand All @@ -16,3 +16,6 @@
[submodule "deps/ledger-zxlib"]
path = deps/ledger-zxlib
url = https://github.com/Zondax/ledger-zxlib.git
[submodule "deps/stax-secure-sdk"]
path = deps/stax-secure-sdk
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
15 changes: 2 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ifeq ($(BOLOS_SDK),)
# In this case, there is not predefined SDK and we run dockerized
# When not using the SDK, we override and build the XL complete app

SUBSTRATE_PARSER_FULL ?= 1
ZXLIB_COMPILE_STAX ?= 1
include $(CURDIR)/deps/ledger-zxlib/dockerized_build.mk

else
Expand All @@ -36,18 +36,7 @@ default:
COIN=$(COIN) $(MAKE) -C app $@
endif

# tests_tools_build:
# cd tests_tools/neon && yarn install

# tests_tools_test: tests_tools_build
# cd tests_tools/neon && yarn test

# zemu_install: tests_tools_build

test_all:
make zemu_install
# test sr25519
make clean_build && SUBSTRATE_PARSER_FULL=1 SUPPORT_SR25519=1 make buildS
cd tests_zemu && yarn testSR25519
make clean_build && SUBSTRATE_PARSER_FULL=1 make
make
make zemu_test
Loading

0 comments on commit 01ccc6a

Please sign in to comment.