-
Notifications
You must be signed in to change notification settings - Fork 232
201 lines (158 loc) · 5.6 KB
/
ci-workflow.yml
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
---
name: Tests
on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:
jobs:
# =====================================================
# ZEMU TESTS
# =====================================================
building_for_e2e_zemu_tests:
name: Building binaries for E2E Zemu tests
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest
steps:
- uses: actions/checkout@v3
- name: Build testing binaries
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
cd tests/zemu/ && ./build_local_test_elfs.sh
- name: Upload app binaries
uses: actions/upload-artifact@v3
with:
name: e2e_zemu_elfs
path: ./tests/zemu/elfs/
jobs-e2e-zemu-tests:
name: E2E Zemu tests
needs: [building_for_e2e_zemu_tests]
runs-on: ubuntu-latest
steps:
- name: Test
run: |
id
echo $HOME
echo $DISPLAY
- name: Checkout
uses: actions/checkout@v3
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Install yarn
run: npm install -g yarn
- name: Build/Install build js deps
run: cd tests/zemu/ && yarn install
- name: Create tmp folder for artifacts
run: mkdir tests/zemu/elfs
- name: Download app binaries
uses: actions/download-artifact@v3
with:
path: tmp/
- name: Gather elfs
run: cp `find tmp/e2e_zemu_elfs/ -name "*.elf"` tests/zemu/elfs/
- name: Run zemu tests
run: cd tests/zemu/ && yarn test
# =====================================================
# SPECULOS TESTS
# =====================================================
building_for_e2e_speculos_tests:
name: Building binaries for E2E Speculos tests
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest
steps:
- uses: actions/checkout@v3
- name: Build testing binaries
run: |
mkdir tests/speculos/elfs
make clean && make -j DEBUG=1 NFT_STAGING_KEY=1 BOLOS_SDK=$NANOS_SDK && mv bin/app.elf tests/speculos/elfs/nanos.elf
make clean && make -j DEBUG=1 NFT_STAGING_KEY=1 BOLOS_SDK=$NANOX_SDK && mv bin/app.elf tests/speculos/elfs/nanox.elf
make clean && make -j DEBUG=1 NFT_STAGING_KEY=1 BOLOS_SDK=$NANOSP_SDK && mv bin/app.elf tests/speculos/elfs/nanosp.elf
- name: Upload app binaries
uses: actions/upload-artifact@v3
with:
name: e2e_speculos_elfs
path: ./tests/speculos/elfs
jobs-e2e-speculos-tests:
name: Speculos tests
strategy:
fail-fast: false
matrix:
model: ["nanosp", "nanos", "nanox"]
needs: [building_for_e2e_speculos_tests]
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Create tmp folder for artifacts
run: mkdir tests/speculos/elfs
- name: Download app binaries
uses: actions/download-artifact@v3
with:
path: tmp/
- name: Gather elfs
run: cp `find tmp/e2e_speculos_elfs/ -name "*.elf"` tests/speculos/elfs/
- name: Install dependencies
run: |
cd tests/speculos
sudo apt-get update && sudo apt-get install -y qemu-user-static
pip install -r requirements.txt
- name: Run speculos tests
run: |
cd tests/speculos
pytest --model ${{ matrix.model }} --path ./elfs/${{ matrix.model }}.elf --display headless
# =====================================================
# RAGGER TESTS
# =====================================================
build_ragger_elfs:
name: Build app for Ragger tests
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "ragger_elfs"
flags: "DEBUG=1 CAL_TEST_KEY=1 DOMAIN_NAME_TEST_KEY=1 SET_PLUGIN_TEST_KEY=1 NFT_TEST_KEY=1"
jobs-ragger-tests:
name: Run Ragger tests
needs: build_ragger_elfs
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: "ragger_elfs"
# =====================================================
# STATIC ANALYSIS
# =====================================================
# Static analysis on the main ETH chain is covered by the guidelines enforcer
scan-build:
name: Clang Static Analyzer on altcoin
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
strategy:
fail-fast: false
matrix:
device: ["nanos", "nanos2", "nanox", "stax"]
steps:
- name: Clone
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build with Clang Static Analyzer
run: |
eval "BOLOS_SDK=\$$(echo ${{ matrix.device }} | tr [:lower:] [:upper:])_SDK" && \
echo "BOLOS_SDK value will be: ${BOLOS_SDK}" && \
make -j ENABLE_SDK_WERROR=1 BOLOS_SDK=${BOLOS_SDK} CHAIN=polygon scan-build
- uses: actions/upload-artifact@v3
if: failure()
with:
name: scan-build
path: scan-build
- name: Upload scan result
if: failure()
uses: actions/upload-artifact@v3
with:
name: scan-build
path: scan-build