1
1
name : Tests
2
2
3
3
on :
4
- workflow_dispatch :
5
4
push :
6
5
branches :
7
6
- master
8
7
pull_request :
9
8
branches :
10
9
- master
11
10
- develop
11
+ workflow_dispatch :
12
12
13
13
jobs :
14
14
scan-build :
15
15
name : Clang Static Analyzer
16
16
runs-on : ubuntu-latest
17
-
18
17
container :
19
- image : ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
18
+ image : ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite :latest
20
19
21
20
steps :
22
21
- uses : actions/checkout@v2
25
24
run : |
26
25
make clean
27
26
scan-build --use-cc=clang -analyze-headers -enable-checker security -enable-checker unix -enable-checker valist -o scan-build --status-bugs make default
27
+
28
28
- uses : actions/upload-artifact@v2
29
29
if : failure()
30
30
with :
39
39
name : Building binaries for E2E Zemu tests
40
40
runs-on : ubuntu-latest
41
41
container :
42
- image : ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
42
+ image : ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite :latest
43
43
44
44
steps :
45
45
- uses : actions/checkout@v2
@@ -52,19 +52,21 @@ jobs:
52
52
- name : Upload app binaries
53
53
uses : actions/upload-artifact@v2
54
54
with :
55
- name : e2e_elfs
55
+ name : e2e_zemu_elfs
56
56
path : ./tests/zemu/elfs/
57
57
58
58
jobs-e2e-zemu-tests :
59
59
name : E2E Zemu tests
60
60
needs : [building_for_e2e_zemu_tests]
61
61
runs-on : ubuntu-latest
62
+
62
63
steps :
63
64
- name : Test
64
65
run : |
65
66
id
66
67
echo $HOME
67
68
echo $DISPLAY
69
+
68
70
- name : Checkout
69
71
uses : actions/checkout@v2
70
72
90
92
path : tmp/
91
93
92
94
- name : Gather elfs
93
- run : cp `find tmp/e2e_elfs / -name "*.elf"` tests/zemu/elfs/
95
+ run : cp `find tmp/e2e_zemu_elfs / -name "*.elf"` tests/zemu/elfs/
94
96
95
97
- name : Run zemu tests
96
98
run : cd tests/zemu/ && yarn test
@@ -104,31 +106,31 @@ jobs:
104
106
name : Building binaries for E2E Speculos tests
105
107
runs-on : ubuntu-latest
106
108
container :
107
- image : ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
109
+ image : ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite :latest
108
110
109
111
steps :
110
112
- uses : actions/checkout@v2
111
113
112
114
- name : Build testing binaries
113
115
run : |
114
116
mkdir tests/speculos/elfs
115
- make clean && make DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOS_SDK && mv bin/app.elf tests/speculos/elfs/nanos.elf
116
- make clean && make DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOX_SDK && mv bin/app.elf tests/speculos/elfs/nanox.elf
117
- make clean && make DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOSP_SDK && mv bin/app.elf tests/speculos/elfs/nanosp.elf
117
+ make clean && make -j DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOS_SDK && mv bin/app.elf tests/speculos/elfs/nanos.elf
118
+ make clean && make -j DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOX_SDK && mv bin/app.elf tests/speculos/elfs/nanox.elf
119
+ make clean && make -j DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOSP_SDK && mv bin/app.elf tests/speculos/elfs/nanosp.elf
118
120
119
121
- name : Upload app binaries
120
122
uses : actions/upload-artifact@v2
121
123
with :
122
- name : e2e_elfs
124
+ name : e2e_speculos_elfs
123
125
path : ./tests/speculos/elfs
124
126
125
127
126
128
jobs-e2e-speculos-tests :
127
129
name : Speculos tests
128
130
strategy :
129
131
matrix :
130
- model : ["nanosp", "nanos", "nanox"]
131
-
132
+ model : ["nanosp", "nanos", "nanox"]
133
+
132
134
needs : [building_for_e2e_speculos_tests]
133
135
runs-on : ubuntu-latest
134
136
@@ -145,7 +147,7 @@ jobs:
145
147
path : tmp/
146
148
147
149
- name : Gather elfs
148
- run : cp `find tmp/e2e_elfs / -name "*.elf"` tests/speculos/elfs/
150
+ run : cp `find tmp/e2e_speculos_elfs / -name "*.elf"` tests/speculos/elfs/
149
151
150
152
- name : Install dependencies
151
153
run : |
@@ -154,6 +156,123 @@ jobs:
154
156
pip install --extra-index-url https://test.pypi.org/simple/ -r requirements.txt
155
157
156
158
- name : Run speculos tests
157
- run : |
159
+ run : |
158
160
cd tests/speculos
159
- pytest --model ${{ matrix.model }} --path ./elfs/${{ matrix.model }}.elf --display headless
161
+ pytest --model ${{ matrix.model }} --path ./elfs/${{ matrix.model }}.elf --display headless
162
+
163
+
164
+ # =====================================================
165
+ # RAGGER TESTS
166
+ # =====================================================
167
+
168
+ build_ragger_elfs :
169
+ name : Building binaries for Ragger tests
170
+ runs-on : ubuntu-latest
171
+ container :
172
+ image : ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest
173
+
174
+ steps :
175
+ - name : Clone
176
+ uses : actions/checkout@v2
177
+
178
+ - name : Build test binaries
179
+ run : |
180
+ make -j BOLOS_SDK=$NANOS_SDK CAL_TESTING_KEY=1
181
+ mv bin/app.elf app-nanos.elf
182
+ make clean
183
+ make -j BOLOS_SDK=$NANOX_SDK CAL_TESTING_KEY=1
184
+ mv bin/app.elf app-nanox.elf
185
+ make clean
186
+ make -j BOLOS_SDK=$NANOSP_SDK CAL_TESTING_KEY=1
187
+ mv bin/app.elf app-nanosp.elf
188
+
189
+ - name : Upload app binaries
190
+ uses : actions/upload-artifact@v2
191
+ with :
192
+ name : ragger_elfs
193
+ path : ./app-*.elf
194
+
195
+ create_ragger_env :
196
+ name : Cache Ragger environment
197
+ runs-on : ubuntu-latest
198
+
199
+ steps :
200
+ - name : Clone
201
+ uses : actions/checkout@v2
202
+
203
+ - name : APT update
204
+ run : |
205
+ sudo apt update
206
+
207
+ - name : Create virtual env with dependencies
208
+ run : |
209
+ cd tests/ragger
210
+ python3 -m venv ./venv
211
+ . ./venv/bin/activate
212
+ pip3 install --extra-index-url https://test.pypi.org/simple/ -r requirements.txt speculos
213
+ # Used for the cache key
214
+ echo "py_deps=$(pip freeze | md5sum | cut -d' ' -f1)" >> $GITHUB_ENV
215
+
216
+ - name : Download QEMU
217
+ run : |
218
+ sudo apt install --download-only -y qemu-user-static
219
+ mkdir -p tests/ragger/packages
220
+ cp /var/cache/apt/archives/*.deb tests/ragger/packages/
221
+ # Used for the cache key
222
+ echo "deb_deps=$(find /var/cache/apt/archives/ -maxdepth 0 -type f -name '*.deb' | md5sum | cut -d' ' -f 1)" >> $GITHUB_ENV
223
+
224
+ - name : Set up cache
225
+ uses : actions/cache@v3
226
+ with :
227
+ key : ${{ runner.os }}-raggenv-${{ env.py_deps }}-${{ env.deb_deps }}
228
+ path : |
229
+ tests/ragger/venv/
230
+ tests/ragger/packages/
231
+ outputs :
232
+ py_deps : ${{ env.py_deps }}
233
+ deb_deps : ${{ env.deb_deps }}
234
+
235
+
236
+ jobs-ragger-tests :
237
+ name : Ragger tests
238
+ strategy :
239
+ matrix :
240
+ model : ["nanos", "nanox", "nanosp"]
241
+ needs : [build_ragger_elfs, create_ragger_env]
242
+ runs-on : ubuntu-latest
243
+
244
+ steps :
245
+ - name : Clone
246
+ uses : actions/checkout@v2
247
+
248
+ - name : Download previously built artifacts
249
+ uses : actions/download-artifact@v2
250
+ with :
251
+ name : ragger_elfs
252
+ path : tmp/
253
+
254
+ - name : Put them where they belong
255
+ run : |
256
+ mkdir -p tests/ragger/elfs
257
+ find tmp/ -type f -name '*.elf' -exec cp {} tests/ragger/elfs/ \;
258
+
259
+ - name : Get cached environment
260
+ uses : actions/cache@v3
261
+ with :
262
+ key : ${{ runner.os }}-raggenv-${{ needs.create_ragger_env.outputs.py_deps }}-${{ needs.create_ragger_env.outputs.deb_deps }}
263
+ path : |
264
+ tests/ragger/venv/
265
+ tests/ragger/packages/
266
+
267
+ - name : Install QEMU
268
+ run : |
269
+ sudo mv tests/ragger/packages/*.deb /var/cache/apt/archives/
270
+ sudo apt install -y qemu-user-static
271
+
272
+ - name : Run tests
273
+ env :
274
+ CAL_SIGNATURE_TEST_KEY : ${{ secrets.CAL_SIGNATURE_TEST_KEY }}
275
+ run : |
276
+ cd tests/ragger
277
+ . ./venv/bin/activate
278
+ pytest --path ./elfs --model ${{ matrix.model }}
0 commit comments