forked from trezor/trezor-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.yml
319 lines (295 loc) · 9.16 KB
/
build.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
image: registry.gitlab.com/satoshilabs/trezor/trezor-firmware/trezor-firmware-env.nix
# Caching
.gitlab_caching: &gitlab_caching
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .venv/
variables:
SDL_VIDEODRIVER: "dummy"
XDG_RUNTIME_DIR: "/var/tmp"
# Core
core fw regular build:
stage: build
<<: *gitlab_caching
needs: []
script:
- nix-shell --run "poetry run make -C core build_boardloader"
- nix-shell --run "poetry run make -C core build_bootloader"
- nix-shell --run "poetry run make -C core build_bootloader_ci"
- nix-shell --run "poetry run make -C core build_prodtest"
- nix-shell --run "poetry run make -C core build_firmware"
- nix-shell --run "poetry run make -C core sizecheck"
- cp core/build/firmware/firmware.bin trezor-fw-regular-$CORE_VERSION-$CI_COMMIT_SHORT_SHA.bin
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-regular-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
core fw regular debug build:
stage: build
<<: *gitlab_caching
needs: []
script:
- nix-shell --run "PYOPT=0 poetry run make -C core build_firmware"
- cp core/build/firmware/firmware.bin trezor-fw-regular-debug-$CORE_VERSION-$CI_COMMIT_SHORT_SHA.bin
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-regular-debug-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
core fw btconly build:
stage: build
<<: *gitlab_caching
needs: []
variables:
BITCOIN_ONLY: "1"
script:
- nix-shell --run "poetry run make -C core build_firmware"
- mv core/build/firmware/firmware.bin core/build/firmware/firmware-bitcoinonly.bin
- nix-shell --run "poetry run ./tools/check-bitcoin-only core/build/firmware/firmware-bitcoinonly.bin"
- cp core/build/firmware/firmware-bitcoinonly.bin trezor-fw-btconly-$CORE_VERSION-$CI_COMMIT_SHORT_SHA.bin
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-btconly-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
core fw btconly debug build:
stage: build
<<: *gitlab_caching
needs: []
variables:
BITCOIN_ONLY: "1"
PYOPT: "0"
script:
- nix-shell --run "poetry run make -C core build_firmware"
- cp core/build/firmware/firmware.bin trezor-fw-btconly-debug-$CORE_VERSION-$CI_COMMIT_SHORT_SHA.bin
only: # currently used only for HW tests and deploys
- schedules # nightly build
- /^legacy\//
- /^release\//
- /^secfix\//
- /^hw\//
- /^core\//
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-btconly-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
core fw btconly t1 build:
stage: build
<<: *gitlab_caching
needs: []
variables:
BITCOIN_ONLY: "1"
TREZOR_MODEL: "1"
script:
- nix-shell --run "poetry run make -C core build_firmware"
- cp core/build/firmware/firmware.bin trezor-fw-btconly-t1-$CORE_VERSION-$CI_COMMIT_SHORT_SHA.bin
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-btconly-t1-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
core unix regular build:
stage: build
<<: *gitlab_caching
needs: []
script:
- nix-shell --run "poetry run make -C core build_unix"
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- core/build/unix # most of it needed by test_rust
expire_in: 1 week
core unix frozen regular build:
stage: build
<<: *gitlab_caching
needs: []
script:
- nix-shell --run "poetry run make -C core build_unix_frozen"
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- core/build/unix/trezor-emu-core
expire_in: 1 week
core unix frozen btconly debug build:
stage: build
<<: *gitlab_caching
needs: []
variables:
PYOPT: "0"
BITCOIN_ONLY: "1"
script:
- nix-shell --run "poetry run make -C core build_unix_frozen"
- mv core/build/unix/trezor-emu-core core/build/unix/trezor-emu-core-bitcoinonly
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- core/build/unix/trezor-emu-core-bitcoinonly
expire_in: 1 week
core unix frozen debug build:
stage: build
<<: *gitlab_caching
needs: []
variables:
PYOPT: "0"
script:
- nix-shell --run "poetry run make -C core build_unix_frozen"
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
untracked: true
expire_in: 1 week
core unix frozen btconly debug t1 build:
stage: build
needs: []
variables:
BITCOIN_ONLY: "1"
TREZOR_MODEL: "1"
script:
- nix-shell --run "poetry run make -C core build_unix_frozen"
- mv core/build/unix/trezor-emu-core core/build/unix/trezor-emu-core-bitcoinonly
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- core/build/unix # most of it needed by test_rust
expire_in: 1 week
core macos frozen regular build:
stage: build
<<: *gitlab_caching
needs: []
when: manual
tags:
- darwin
script:
- nix-shell --run "poetry run make -C core build_unix_frozen"
- export NAME="trezor-emu-core.darwin"
- cp -v core/build/unix/trezor-emu-core ./$NAME
- chmod +x $NAME
- echo '"$(dirname "$BASH_SOURCE")"/trezor-emu-core.darwin' > trezor-emulator.command
- chmod u+x trezor-emulator.command
allow_failure: true
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-emu-core.darwin
- trezor-emulator.command
expire_in: 1 week
# Crypto
crypto build:
stage: build
<<: *gitlab_caching
needs: []
only:
changes:
- .gitlab-ci.yml
- ci/**/*
- crypto/**/*
script:
- nix-shell --run "poetry run make -C crypto"
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- crypto/tests/aestst
- crypto/tests/libtrezor-crypto.so
- crypto/tests/test_check
- crypto/tests/test_openssl
expire_in: 1 week
# Legacy
legacy fw regular build:
stage: build
<<: *gitlab_caching
needs: []
script:
- nix-shell --run "export PRODUCTION=1 && poetry run legacy/script/cibuild"
- nix-shell --run "poetry run legacy/script/setup"
- nix-shell --run "export PRODUCTION=0 && poetry run legacy/script/cibuild"
- nix-shell --run "poetry run make -C legacy/demo"
- mv legacy/firmware/trezor.bin trezor-fw-regular-$LEGACY_VERSION-$CI_COMMIT_SHORT_SHA.bin
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-regular-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
legacy fw regular debug build:
stage: build
<<: *gitlab_caching
needs: []
variables:
DEBUG_LINK: "1"
script:
- nix-shell --run "export PRODUCTION=1 && poetry run legacy/script/cibuild"
- nix-shell --run "poetry run legacy/script/setup"
- nix-shell --run "export PRODUCTION=0 && poetry run legacy/script/cibuild"
- mv legacy/firmware/trezor.bin trezor-fw-regular-debug-$LEGACY_VERSION-$CI_COMMIT_SHORT_SHA.bin
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-regular-debug-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
legacy fw btconly build:
stage: build
<<: *gitlab_caching
needs: []
variables:
BITCOIN_ONLY: "1"
script:
- nix-shell --run "export PRODUCTION=1 && poetry run legacy/script/cibuild"
- nix-shell --run "poetry run legacy/script/setup"
- nix-shell --run "export PRODUCTION=0 && poetry run legacy/script/cibuild"
- mv legacy/firmware/trezor.bin legacy/firmware/trezor-bitcoinonly.bin
- nix-shell --run "poetry run ./tools/check-bitcoin-only legacy/firmware/trezor-bitcoinonly.bin"
- mv legacy/firmware/trezor-bitcoinonly.bin trezor-fw-btconly-$LEGACY_VERSION-$CI_COMMIT_SHORT_SHA.bin
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-btconly-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
legacy fw btconly debug build:
stage: build
<<: *gitlab_caching
needs: []
variables:
BITCOIN_ONLY: "1"
DEBUG_LINK: "1"
script:
- nix-shell --run "export PRODUCTION=1 && poetry run legacy/script/cibuild"
- nix-shell --run "poetry run legacy/script/setup"
- nix-shell --run "export PRODUCTION=0 && poetry run legacy/script/cibuild"
- nix-shell --run "poetry run ./tools/check-bitcoin-only legacy/firmware/trezor.bin"
- mv legacy/firmware/trezor.bin trezor-fw-btconly-debug-$LEGACY_VERSION-$CI_COMMIT_SHORT_SHA.bin
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- trezor-fw-btconly-*.*.*-$CI_COMMIT_SHORT_SHA.bin
expire_in: 1 week
legacy emu regular debug build:
stage: build
<<: *gitlab_caching
needs: []
variables:
DEBUG_LINK: "1"
EMULATOR: "1"
script:
- nix-shell --run "poetry run legacy/script/cibuild"
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- legacy/firmware/trezor.elf
expire_in: 1 week
legacy emu btconly debug build:
stage: build
<<: *gitlab_caching
needs: []
variables:
BITCOIN_ONLY: "1"
DEBUG_LINK: "1"
EMULATOR: "1"
script:
- nix-shell --run "poetry run legacy/script/cibuild"
- mv legacy/firmware/trezor.elf legacy/firmware/trezor-bitcoinonly.elf
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- legacy/firmware/trezor-bitcoinonly.elf
expire_in: 1 week