Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit 223ff6b

Browse files
raynaudoejleni
authored andcommitted
Initial commit
0 parents  commit 223ff6b

293 files changed

Lines changed: 60120 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

8 KB
Binary file not shown.

.circleci/config.yml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: zondax/circleci:latest
6+
steps:
7+
- checkout
8+
- run: git submodule update --init --recursive
9+
- run: cmake -DCMAKE_BUILD_TYPE=Debug . && make
10+
# Unfortunately need to disable leak sanitizer https://github.com/google/sanitizers/issues/916
11+
# Still run all other ASAN components
12+
- run: GTEST_COLOR=1 ASAN_OPTIONS=detect_leaks=0 ctest -VV
13+
14+
build_only_rust:
15+
docker:
16+
- image: zondax/rust-ci:latest
17+
steps:
18+
- checkout
19+
- run:
20+
name: rustfmt
21+
command: |
22+
cd ~/project/app/rust
23+
cargo fmt --version
24+
cargo fmt -- --check
25+
- run:
26+
name: clippy
27+
command: |
28+
cd ~/project/app/rust
29+
cargo clippy --version
30+
cargo clippy --all-features --all-targets || true
31+
- run:
32+
name: audit
33+
command: |
34+
cd ~/project/app/rust
35+
cargo audit --version
36+
cargo audit
37+
- run:
38+
name: run tests
39+
command: |
40+
cd ~/project/app/rust
41+
cargo test
42+
43+
build_ledger:
44+
docker:
45+
- image: zondax/builder-bolos:latest
46+
working_directory: ~/project
47+
environment:
48+
BOLOS_SDK: /home/zondax/project/deps/nanos-secure-sdk
49+
BOLOS_ENV: /opt/bolos
50+
steps:
51+
- checkout
52+
# Docker entrypoint is not considered
53+
- run: git submodule update --init --recursive
54+
- run:
55+
name: Build Standard light parser app
56+
command: |
57+
source /home/zondax/.cargo/env
58+
make
59+
- run:
60+
name: Build Standard full parser app
61+
command: |
62+
source /home/zondax/.cargo/env
63+
SUPPORT_SR25519=1 SUBSTRATE_PARSER_FULL=1 make
64+
- run:
65+
name: Build SR25519 app
66+
command: |
67+
source /home/zondax/.cargo/env
68+
SUPPORT_SR25519=1 make
69+
70+
test_zemu:
71+
machine:
72+
image: ubuntu-2004:202101-01
73+
resource_class: large
74+
working_directory: ~/repo
75+
environment:
76+
BASH_ENV: "/opt/circleci/.nvm/nvm.sh"
77+
steps:
78+
- checkout
79+
- run: git submodule update --init --recursive
80+
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
81+
- run:
82+
name: Install rust
83+
command: |
84+
sudo apt-get update
85+
sudo apt-get install -y cmake binutils-dev libcurl4-openssl-dev libiberty-dev libelf-dev libdw-dev
86+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y;
87+
no_output_timeout: 1800s
88+
- run:
89+
name: Install node + yarn
90+
command: |
91+
nvm install 14.4.0
92+
nvm use 14.4.0
93+
npm install -g yarn
94+
- run:
95+
name: Build Ledger app
96+
command: |
97+
SUBSTRATE_PARSER_FULL=1 make buildS
98+
make clean
99+
SUBSTRATE_PARSER_FULL=1 make buildX
100+
- run:
101+
name: Build/Install build js deps
102+
command: |
103+
nvm use 14.4.0
104+
export PATH=~/.cargo/bin:$PATH
105+
make zemu_install
106+
- run:
107+
name: Run zemu tests
108+
command: |
109+
nvm use 14.4.0
110+
export PATH=~/.cargo/bin:$PATH
111+
make zemu_test
112+
113+
test_zemu_sr25519:
114+
machine:
115+
image: ubuntu-2004:202101-01
116+
resource_class: large
117+
working_directory: ~/repo
118+
environment:
119+
BASH_ENV: "/opt/circleci/.nvm/nvm.sh"
120+
steps:
121+
- checkout
122+
- run: git submodule update --init --recursive
123+
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
124+
- run:
125+
name: Install rust
126+
command: |
127+
sudo apt-get update
128+
sudo apt-get install -y cmake binutils-dev libcurl4-openssl-dev libiberty-dev libelf-dev libdw-dev
129+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y;
130+
no_output_timeout: 1800s
131+
- run:
132+
name: Install node + yarn
133+
command: |
134+
nvm install 14.4.0
135+
nvm use 14.4.0
136+
npm install -g yarn
137+
- run:
138+
name: Build Ledger app
139+
command: |
140+
make SUBSTRATE_PARSER_FULL=1 build_sr25519
141+
- run:
142+
name: Build/Install build js deps
143+
command: |
144+
nvm use 14.4.0
145+
export PATH=~/.cargo/bin:$PATH
146+
make zemu_install
147+
- run:
148+
name: Run zemu tests for sr25519
149+
command: |
150+
nvm use 14.4.0
151+
export PATH=~/.cargo/bin:$PATH
152+
cd tests_zemu && yarn testSR25519
153+
154+
build_package:
155+
docker:
156+
- image: zondax/builder-bolos@sha256:0e0097c01ef3c6c964fea8d8b6e3a584f4ff209a04ec68b6b2b4aeab64379c23
157+
environment:
158+
BOLOS_SDK: /home/zondax/project/deps/nanos-secure-sdk
159+
BOLOS_ENV: /opt/bolos
160+
steps:
161+
- checkout
162+
- run: git submodule update --init --recursive
163+
- run:
164+
name: Build
165+
command: |
166+
source /home/zondax/.cargo/env
167+
cd /home/zondax/project
168+
make
169+
- 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
170+
171+
workflows:
172+
version: 2
173+
174+
default:
175+
jobs:
176+
- build
177+
- build_only_rust
178+
- build_ledger
179+
- test_zemu
180+
- test_zemu_sr25519
181+
- build_package:
182+
requires:
183+
- build
184+
- build_ledger
185+
- test_zemu
186+
- test_zemu_sr25519
187+
filters:
188+
branches:
189+
only:
190+
- master

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
end_of_line = lf
8+
insert_final_newline = true
9+
10+
[*.{c,h,cpp,hpp}]
11+
indent_style = space
12+
indent_size = 4
13+
14+
[*.{yml,sh}]
15+
indent_style = space
16+
indent_size = 2

.gdbinit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# https://www.jetbrains.com/help/clion/configuring-debugger-options.html#gdbinit-lldbinit
2+
#
3+
# You need to create `$HOME/.gdbinit` with the following content:
4+
# set auto-load local-gdbinit on
5+
# add-auto-load-safe-path /
6+
7+
set architecture arm
8+
handle SIGILL nostop pass noprint
9+
add-symbol-file app/bin/app.elf 0x40000000
10+
set backtrace limit 20
11+
b *0x40000000

.github/workflows/main.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Build
2+
on: [push]
3+
4+
jobs:
5+
configure:
6+
runs-on: ubuntu-latest
7+
outputs:
8+
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
9+
steps:
10+
- id: get-user
11+
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"
12+
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
submodules: true
20+
- name: Install deps
21+
run: |
22+
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
23+
make deps
24+
brew install conan
25+
- run: cmake -DCMAKE_BUILD_TYPE=Debug . && make
26+
- run: GTEST_COLOR=1 ASAN_OPTIONS=detect_leaks=0 ctest -VV
27+
28+
build_only_rust:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v2
33+
with:
34+
submodules: true
35+
- name: Install deps
36+
run: |
37+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
38+
- name: rustfmt
39+
run: |
40+
cd ./app/rust
41+
cargo fmt --version
42+
cargo fmt -- --check
43+
- name: clippy
44+
run: |
45+
cd ./app/rust
46+
cargo clippy --version
47+
cargo clippy --all-features --all-targets || true
48+
- name: audit
49+
run: |
50+
cd ./app/rust
51+
cargo audit --version
52+
cargo audit
53+
- name: run tests
54+
run: |
55+
cd ./app/rust
56+
cargo test
57+
58+
build_ledger:
59+
needs: configure
60+
runs-on: ubuntu-latest
61+
container:
62+
image: zondax/builder-bolos:latest
63+
options: --user ${{ needs.configure.outputs.uid_gid }}
64+
env:
65+
BOLOS_SDK: /__w/ledger-edgeware/ledger-edgeware/deps/nanos-secure-sdk
66+
BOLOS_ENV: /opt/bolos
67+
HOME: /home/zondax_circle
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v2
71+
with:
72+
submodules: true
73+
- name: Build Standard app
74+
shell: bash -l {0}
75+
run: |
76+
source $HOME/.cargo/env
77+
make
78+
- name: Build SR25519 app
79+
shell: bash -l {0}
80+
run: |
81+
source $HOME/.cargo/env
82+
SUPPORT_SR25519=1 make
83+
84+
test_zemu:
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Test
88+
run: |
89+
id
90+
echo $HOME
91+
echo $DISPLAY
92+
- name: Checkout
93+
uses: actions/checkout@v2
94+
with:
95+
submodules: true
96+
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
97+
- name: Install rust
98+
run: |
99+
sudo apt-get update
100+
sudo apt-get install -y cmake binutils-dev libcurl4-openssl-dev libiberty-dev libelf-dev libdw-dev
101+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y;
102+
- name: Install node
103+
uses: actions/setup-node@v2
104+
with:
105+
node-version: '14.4.0'
106+
- name: Install yarn
107+
run: |
108+
npm install -g yarn
109+
- name: Build Ledger app
110+
run: |
111+
make build_full_parser_s
112+
make clean
113+
make build_full_parser_x
114+
- name: Build/Install build js deps
115+
run: |
116+
export PATH=~/.cargo/bin:$PATH
117+
make zemu_install
118+
- name: Run zemu tests
119+
run: |
120+
export PATH=~/.cargo/bin:$PATH
121+
make zemu_test
122+
123+
test_zemu_sr25519:
124+
runs-on: ubuntu-latest
125+
steps:
126+
- name: Checkout
127+
uses: actions/checkout@v2
128+
with:
129+
submodules: true
130+
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
131+
- name: Install rust
132+
run: |
133+
sudo apt-get update
134+
sudo apt-get install -y cmake binutils-dev libcurl4-openssl-dev libiberty-dev libelf-dev libdw-dev
135+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y;
136+
- name: Install node
137+
uses: actions/setup-node@v2
138+
with:
139+
node-version: '14.4.0'
140+
- name: Install yarn
141+
run: |
142+
npm install -g yarn
143+
- name: Build Ledger app
144+
run: |
145+
make build_sr25519
146+
- name: Build/Install build js deps
147+
run: |
148+
export PATH=~/.cargo/bin:$PATH
149+
make zemu_install
150+
- name: Run zemu tests for sr25519
151+
run: |
152+
export PATH=~/.cargo/bin:$PATH
153+
cd tests_zemu && yarn testSR25519

0 commit comments

Comments
 (0)