Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
jleni committed Jul 26, 2021
0 parents commit cb4366f
Show file tree
Hide file tree
Showing 326 changed files with 61,177 additions and 0 deletions.
197 changes: 197 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
version: 2
jobs:
build:
docker:
- image: zondax/circleci:latest
steps:
- checkout
- run: git submodule update --init --recursive
- run: cmake -DCMAKE_BUILD_TYPE=Debug . && make
# Unfortunately need to disable leak sanitizer https://github.com/google/sanitizers/issues/916
# Still run all other ASAN components
- run: GTEST_COLOR=1 ASAN_OPTIONS=detect_leaks=0 ctest -VV

build_only_rust:
docker:
- image: zondax/rust-ci:latest
steps:
- checkout
- run:
name: rustfmt
command: |
cd ~/project/app/rust
cargo fmt --version
cargo fmt -- --check
- run:
name: clippy
command: |
cd ~/project/app/rust
cargo clippy --version
cargo clippy --all-features --all-targets || true
- run:
name: audit
command: |
cd ~/project/app/rust
cargo audit --version
cargo audit
- run:
name: run tests
command: |
cd ~/project/app/rust
cargo test
build_ledger:
docker:
- image: zondax/builder-bolos:latest
working_directory: ~/project
environment:
BOLOS_SDK: /home/zondax/project/deps/nanos-secure-sdk
BOLOS_ENV: /opt/bolos
steps:
- checkout
# Docker entrypoint is not considered
- run: git submodule update --init --recursive
- run:
name: Build Standard light parser app
command: |
source /home/zondax/.cargo/env
make SUBSTRATE_PARSER_FULL=0
- run:
name: Build Standard full parser app
command: |
source /home/zondax/.cargo/env
make SUBSTRATE_PARSER_FULL=1
- run:
name: Build SR25519 app
command: |
source /home/zondax/.cargo/env
make SUPPORT_SR25519=1
test_zemu:
machine:
image: ubuntu-2004:202101-01
resource_class: large
working_directory: ~/repo
environment:
BASH_ENV: "/opt/circleci/.nvm/nvm.sh"
steps:
- checkout
- run: git submodule update --init --recursive
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
- run:
name: Install rust
command: |
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;
no_output_timeout: 1800s
- run:
name: Install node + yarn
command: |
nvm install 14.17.0
nvm use 14.17.0
npm install -g yarn
- run:
name: Build Ledger app
command: |
make clean_build && SUBSTRATE_PARSER_FULL=1 make buildS
make clean_build && SUBSTRATE_PARSER_FULL=1 make buildX
- run:
name: Build/Install build js deps
command: |
nvm use 14.17.0
export PATH=~/.cargo/bin:$PATH
make zemu_install
- run:
name: Run zemu tests
command: |
nvm use 14.17.0
export PATH=~/.cargo/bin:$PATH
make zemu_test
test_zemu_sr25519:
machine:
image: ubuntu-2004:202101-01
resource_class: large
working_directory: ~/repo
environment:
BASH_ENV: "/opt/circleci/.nvm/nvm.sh"
steps:
- checkout
- run: git submodule update --init --recursive
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
- run:
name: Install rust
command: |
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;
no_output_timeout: 1800s
- run:
name: Install node + yarn
command: |
nvm install 14.17.0
nvm use 14.17.0
npm install -g yarn
- run:
name: Build Ledger app
command: |
make clean_build && SUBSTRATE_PARSER_FULL=1 SUPPORT_SR25519=1 make buildS
- run:
name: Build/Install build js deps
command: |
nvm use 14.17.0
export PATH=~/.cargo/bin:$PATH
make zemu_install
- run:
name: Run zemu tests for sr25519
command: |
nvm use 14.17.0
export PATH=~/.cargo/bin:$PATH
cd tests_zemu && yarn testSR25519
build_package:
docker:
- image: zondax/builder-bolos:latest
environment:
BOLOS_SDK: /home/zondax/project/deps/nanos-secure-sdk
BOLOS_ENV: /opt/bolos
steps:
- checkout
- run: git submodule update --init --recursive
- run:
name: Build
command: |
source /home/zondax/.cargo/env
cd /home/zondax/project
make SUBSTRATE_PARSER_FULL=0
- run: /home/zondax/go/bin/ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete $(/home/zondax/project/app/pkg/installer_s.sh version) /home/zondax/project/app/pkg/installer_s.sh
- run:
name: Clear and rebuild XL version
command: |
source /home/zondax/.cargo/env
cd /home/zondax/project
make SUBSTRATE_PARSER_FULL=1
cp /home/zondax/project/app/pkg/installer_s.sh /home/zondax/project/app/pkg/installer_XL_s.sh
- run: /home/zondax/go/bin/ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete $(/home/zondax/project/app/pkg/installer_XL_s.sh version) /home/zondax/project/app/pkg/installer_XL_s.sh

workflows:
version: 2

default:
jobs:
- build
- build_only_rust
- build_ledger
- test_zemu
- test_zemu_sr25519
- build_package:
requires:
- build
- build_ledger
- test_zemu
- test_zemu_sr25519
filters:
branches:
only:
- main
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# top-most EditorConfig file
root = true

[*]
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

[*.{c,h,cpp,hpp}]
indent_style = space
indent_size = 4

[*.{yml,sh}]
indent_style = space
indent_size = 2
11 changes: 11 additions & 0 deletions .gdbinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# https://www.jetbrains.com/help/clion/configuring-debugger-options.html#gdbinit-lldbinit
#
# You need to create `$HOME/.gdbinit` with the following content:
# set auto-load local-gdbinit on
# add-auto-load-safe-path /

# set architecture arm
# handle SIGILL nostop pass noprint
# add-symbol-file app/bin/app.elf 0x40000000
# set backtrace limit 20
# b *0x40000000
151 changes: 151 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: Build
on: [push]

jobs:
configure:
runs-on: ubuntu-latest
outputs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
steps:
- id: get-user
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"

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

build_only_rust:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Install deps
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: rustfmt
run: |
cd ./app/rust
cargo fmt --version
cargo fmt -- --check
- name: clippy
run: |
cd ./app/rust
cargo clippy --version
cargo clippy --all-features --all-targets || true
- name: audit
run: |
cd ./app/rust
cargo audit --version
cargo audit
- name: run tests
run: |
cd ./app/rust
cargo test
build_ledger:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos: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
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build Standard app
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
- name: Build SR25519 app
shell: bash -l {0}
run: |
source $HOME/.cargo/env
SUPPORT_SR25519=1 make
test_zemu:
runs-on: ubuntu-latest
steps:
- name: Test
run: |
id
echo $HOME
echo $DISPLAY
- name: Checkout
uses: actions/checkout@v2
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.4.0'
- name: Install yarn
run: |
npm install -g yarn
- name: Build Ledger app
run: |
make SUBSTRATE_PARSER_FULL=1
- name: Build/Install build js deps
run: |
export PATH=~/.cargo/bin:$PATH
make zemu_install
- name: Run zemu tests
run: |
export PATH=~/.cargo/bin:$PATH
make zemu_test
test_zemu_sr25519:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
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.4.0'
- name: Install yarn
run: |
npm install -g yarn
- name: Build Ledger app
run: |
make clean_build && SUBSTRATE_PARSER_FULL=1 SUPPORT_SR25519=1 make buildS
- name: Build/Install build js deps
run: |
export PATH=~/.cargo/bin:$PATH
make zemu_install
- name: Run zemu tests for sr25519
run: |
export PATH=~/.cargo/bin:$PATH
cd tests_zemu && yarn testSR25519
Loading

0 comments on commit cb4366f

Please sign in to comment.