Skip to content

Commit 4ad27fe

Browse files
committed
ci: split device groups
This ensures the failure to build a simulator for one device doesn't abort running jobs for the others. They're still grouped by manufacturer. Alternative to #743.
1 parent a966f05 commit 4ad27fe

File tree

3 files changed

+234
-51
lines changed

3 files changed

+234
-51
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build sim
2+
description: Build device simulator(s)
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Install dependencies
7+
shell: bash
8+
run: |
9+
sudo apt-get update
10+
sudo apt-get install -y gcc-arm-linux-gnueabihf libsdl2-image-dev libslirp-dev libpcsclite-dev ninja-build
11+
pip install poetry
12+
wget https://github.com/protocolbuffers/protobuf/releases/download/v22.0/protoc-22.0-linux-x86_64.zip
13+
sudo unzip protoc-22.0-linux-x86_64.zip -d /usr/local
14+
protoc --version
15+
16+
- name: Build simulator
17+
shell: bash
18+
run: |
19+
git config --global user.email "[email protected]"
20+
git config --global user.name "ci"
21+
cd test; ./setup_environment.sh --${{ matrix.device.name }}; cd ..
22+
tar -czf ${{ matrix.device.archive }}.tar.gz ${{ matrix.device.paths }}
23+
24+
- uses: actions/upload-artifact@v4
25+
with:
26+
name: ${{ matrix.device.name }}-sim
27+
path: ${{ matrix.device.archive }}.tar.gz
28+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test device
2+
description: Run tests for one device type.
3+
runs:
4+
using: composite
5+
steps:
6+
- run: |
7+
pip install poetry
8+
poetry install
9+
10+
- uses: actions/download-artifact@v4
11+
with:
12+
name: bitcoind
13+
14+
- run: |
15+
tar -xvf bitcoind.tar.gz
16+
17+
- uses: ./.github/actions/install-sim
18+
with:
19+
device: ${{ matrix.device }}
20+
21+
- name: Run tests
22+
run: |
23+
cd test; poetry run ./run_tests.py --${{ matrix.device }} --interface=${{ matrix.interface }} --device-only; cd ..
24+
25+
- if: failure()
26+
run: |
27+
tail -v -n +1 test/*.std*

.github/workflows/ci.yml

Lines changed: 179 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ jobs:
142142
name: dist
143143
path: dist/
144144

145-
sim-builder:
146-
name: Sim builder
145+
sim-builder-trezor:
146+
name: Trezor sim builder
147147
runs-on: ubuntu-latest
148148

149149
strategy:
@@ -152,36 +152,82 @@ jobs:
152152
device:
153153
- { name: 'trezor-1', archive: 'trezor-firmware', paths: 'test/work/trezor-firmware' }
154154
- { name: 'trezor-t', archive: 'trezor-firmware', paths: 'test/work/trezor-firmware' }
155+
156+
steps:
157+
- uses: actions/checkout@v4
158+
- uses: ./.github/actions/build-sim
159+
160+
sim-builder-coldcard:
161+
name: Coldcard sim builder
162+
runs-on: ubuntu-latest
163+
164+
strategy:
165+
fail-fast: false
166+
matrix:
167+
device:
155168
- { name: 'coldcard', archive: 'coldcard-mpy', paths: 'test/work/firmware/external/micropython/ports/unix/coldcard-mpy test/work/firmware/unix/coldcard-mpy test/work/firmware/unix/l-mpy test/work/firmware/unix/l-port' }
169+
170+
steps:
171+
- uses: actions/checkout@v4
172+
- uses: ./.github/actions/build-sim
173+
174+
sim-builder-bitbox:
175+
name: Bitbox sim builder
176+
runs-on: ubuntu-latest
177+
178+
strategy:
179+
fail-fast: false
180+
matrix:
181+
device:
156182
- { name: 'bitbox01', archive: 'mcu', paths: 'test/work/mcu' }
183+
- { name: 'bitbox02', archive: 'bitbox02', paths: 'test/work/bitbox02-firmware/build-build/bin/simulator' }
184+
185+
steps:
186+
- uses: actions/checkout@v4
187+
- uses: ./.github/actions/build-sim
188+
189+
sim-builder-jade:
190+
name: Jade sim builder
191+
runs-on: ubuntu-latest
192+
193+
strategy:
194+
fail-fast: false
195+
matrix:
196+
device:
157197
- { name: 'jade', archive: 'jade', paths: 'test/work/jade/simulator' }
198+
199+
steps:
200+
- uses: actions/checkout@v4
201+
- uses: ./.github/actions/build-sim
202+
203+
sim-builder-ledger:
204+
name: Ledger sim builder
205+
runs-on: ubuntu-latest
206+
207+
strategy:
208+
fail-fast: false
209+
matrix:
210+
device:
158211
- { name: 'ledger', archive: 'speculos', paths: 'test/work/speculos' }
159-
- { name: 'keepkey', archive: 'keepkey-firmware', paths: 'test/work/keepkey-firmware/bin' }
160-
- { name: 'bitbox02', archive: 'bitbox02', paths: 'test/work/bitbox02-firmware/build-build/bin/simulator' }
161212

162213
steps:
163214
- uses: actions/checkout@v4
215+
- uses: ./.github/actions/build-sim
164216

165-
- name: Install dependencies
166-
run: |
167-
sudo apt-get update
168-
sudo apt-get install -y gcc-arm-linux-gnueabihf libsdl2-image-dev libslirp-dev libpcsclite-dev ninja-build
169-
pip install poetry
170-
wget https://github.com/protocolbuffers/protobuf/releases/download/v22.0/protoc-22.0-linux-x86_64.zip
171-
sudo unzip protoc-22.0-linux-x86_64.zip -d /usr/local
172-
protoc --version
217+
sim-builder-keepkey:
218+
name: Keepkey sim builder
219+
runs-on: ubuntu-latest
173220

174-
- name: Build simulator
175-
run: |
176-
git config --global user.email "[email protected]"
177-
git config --global user.name "ci"
178-
cd test; ./setup_environment.sh --${{ matrix.device.name }}; cd ..
179-
tar -czf ${{ matrix.device.archive }}.tar.gz ${{ matrix.device.paths }}
221+
strategy:
222+
fail-fast: false
223+
matrix:
224+
device:
225+
- { name: 'keepkey', archive: 'keepkey-firmware', paths: 'test/work/keepkey-firmware/bin' }
226+
227+
steps:
228+
- uses: actions/checkout@v4
229+
- uses: ./.github/actions/build-sim
180230

181-
- uses: actions/upload-artifact@v4
182-
with:
183-
name: ${{ matrix.device.name }}-sim
184-
path: ${{ matrix.device.archive }}.tar.gz
185231

186232
ledger-app-builder:
187233
name: Ledger App builder
@@ -210,7 +256,16 @@ jobs:
210256
test-dist:
211257
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.script.name }}
212258
runs-on: ubuntu-latest
213-
needs: [ dist-builder, sim-builder, ledger-app-builder, bitcoind-builder ]
259+
needs:
260+
- dist-builder
261+
- sim-builder-trezor
262+
- sim-builder-coldcard
263+
- sim-builder-bitbox
264+
- sim-builder-jade
265+
- sim-builder-ledger
266+
- sim-builder-keepkey
267+
- ledger-app-builder
268+
- bitcoind-builder
214269

215270
strategy:
216271
fail-fast: false
@@ -275,11 +330,10 @@ jobs:
275330
run: |
276331
tail -v -n +1 test/*.std*
277332
278-
279-
test-all:
333+
test-trezor:
280334
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.interface }}
281335
runs-on: ubuntu-latest
282-
needs: [ sim-builder, ledger-app-builder, bitcoind-builder ]
336+
needs: [ sim-builder-trezor, bitcoind-builder ]
283337
timeout-minutes: 45
284338

285339
strategy:
@@ -289,39 +343,113 @@ jobs:
289343
device:
290344
- 'trezor-1'
291345
- 'trezor-t'
292-
- 'coldcard'
293-
- 'bitbox01'
294-
- 'jade'
295-
- 'ledger'
296-
- 'ledger-legacy'
297-
- 'keepkey'
298-
- 'bitbox02'
299346
interface: [ 'library', 'cli', 'stdin' ]
300347

301348
container: python:${{ matrix.python-version }}
302349

303350
steps:
304351
- uses: actions/checkout@v4
352+
- uses: ./.github/actions/test-device
305353

306-
- run: |
307-
pip install poetry
308-
poetry install
309-
310-
- uses: actions/download-artifact@v4
311-
with:
312-
name: bitcoind
354+
test-ledger:
355+
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.interface }}
356+
runs-on: ubuntu-latest
357+
needs: [ sim-builder-ledger, ledger-app-builder, bitcoind-builder ]
358+
timeout-minutes: 45
313359

314-
- run: |
315-
tar -xvf bitcoind.tar.gz
360+
strategy:
361+
fail-fast: false
362+
matrix:
363+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
364+
device:
365+
- 'ledger'
366+
- 'ledger-legacy'
367+
interface: [ 'library', 'cli', 'stdin' ]
316368

317-
- uses: ./.github/actions/install-sim
318-
with:
319-
device: ${{ matrix.device }}
369+
container: python:${{ matrix.python-version }}
320370

321-
- name: Run tests
322-
run: |
323-
cd test; poetry run ./run_tests.py --${{ matrix.device }} --interface=${{ matrix.interface }} --device-only; cd ..
371+
steps:
372+
- uses: actions/checkout@v4
373+
- uses: ./.github/actions/test-device
374+
375+
test-coldcard:
376+
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.interface }}
377+
runs-on: ubuntu-latest
378+
needs: [ sim-builder-coldcard, bitcoind-builder ]
379+
timeout-minutes: 45
380+
381+
strategy:
382+
fail-fast: false
383+
matrix:
384+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
385+
device:
386+
- 'coldcard'
387+
interface: [ 'library', 'cli', 'stdin' ]
388+
389+
container: python:${{ matrix.python-version }}
390+
391+
steps:
392+
- uses: actions/checkout@v4
393+
- uses: ./.github/actions/test-device
394+
395+
test-bitbox:
396+
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.interface }}
397+
runs-on: ubuntu-latest
398+
needs: [ sim-builder-bitbox, bitcoind-builder ]
399+
timeout-minutes: 45
400+
401+
strategy:
402+
fail-fast: false
403+
matrix:
404+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
405+
device:
406+
- 'bitbox01'
407+
- 'bitbox02'
408+
interface: [ 'library', 'cli', 'stdin' ]
409+
410+
container: python:${{ matrix.python-version }}
411+
412+
steps:
413+
- uses: actions/checkout@v4
414+
- uses: ./.github/actions/test-device
415+
416+
test-jade:
417+
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.interface }}
418+
runs-on: ubuntu-latest
419+
needs: [ sim-builder-jade, bitcoind-builder ]
420+
timeout-minutes: 45
421+
422+
strategy:
423+
fail-fast: false
424+
matrix:
425+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
426+
device:
427+
- 'jade'
428+
interface: [ 'library', 'cli', 'stdin' ]
429+
430+
container: python:${{ matrix.python-version }}
431+
432+
steps:
433+
- uses: actions/checkout@v4
434+
- uses: ./.github/actions/test-device
435+
436+
test-keepkey:
437+
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.interface }}
438+
runs-on: ubuntu-latest
439+
needs: [ sim-builder-keepkey, bitcoind-builder ]
440+
timeout-minutes: 45
441+
442+
strategy:
443+
fail-fast: false
444+
matrix:
445+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
446+
device:
447+
- 'keepkey'
448+
interface: [ 'library', 'cli', 'stdin' ]
449+
450+
container: python:${{ matrix.python-version }}
451+
452+
steps:
453+
- uses: actions/checkout@v4
454+
- uses: ./.github/actions/test-device
324455

325-
- if: failure()
326-
run: |
327-
tail -v -n +1 test/*.std*

0 commit comments

Comments
 (0)