Skip to content

Commit d2f71c3

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 d2f71c3

File tree

3 files changed

+222
-50
lines changed

3 files changed

+222
-50
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build sim
2+
description: Build device simulator(s)
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Install dependencies
7+
run: |
8+
sudo apt-get update
9+
sudo apt-get install -y gcc-arm-linux-gnueabihf libsdl2-image-dev libslirp-dev libpcsclite-dev ninja-build
10+
pip install poetry
11+
wget https://github.com/protocolbuffers/protobuf/releases/download/v22.0/protoc-22.0-linux-x86_64.zip
12+
sudo unzip protoc-22.0-linux-x86_64.zip -d /usr/local
13+
protoc --version
14+
15+
- name: Build simulator
16+
run: |
17+
git config --global user.email "[email protected]"
18+
git config --global user.name "ci"
19+
cd test; ./setup_environment.sh --${{ matrix.device.name }}; cd ..
20+
tar -czf ${{ matrix.device.archive }}.tar.gz ${{ matrix.device.paths }}
21+
22+
- uses: actions/upload-artifact@v4
23+
with:
24+
name: ${{ matrix.device.name }}-sim
25+
path: ${{ matrix.device.archive }}.tar.gz
26+
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: 169 additions & 50 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
@@ -275,11 +321,10 @@ jobs:
275321
run: |
276322
tail -v -n +1 test/*.std*
277323
278-
279-
test-all:
324+
test-trezor:
280325
name: Python ${{ matrix.python-version }} ${{ matrix.device }} ${{ matrix.interface }}
281326
runs-on: ubuntu-latest
282-
needs: [ sim-builder, ledger-app-builder, bitcoind-builder ]
327+
needs: [ sim-builder-trezor, bitcoind-builder ]
283328
timeout-minutes: 45
284329

285330
strategy:
@@ -289,39 +334,113 @@ jobs:
289334
device:
290335
- 'trezor-1'
291336
- 'trezor-t'
292-
- 'coldcard'
293-
- 'bitbox01'
294-
- 'jade'
295-
- 'ledger'
296-
- 'ledger-legacy'
297-
- 'keepkey'
298-
- 'bitbox02'
299337
interface: [ 'library', 'cli', 'stdin' ]
300338

301339
container: python:${{ matrix.python-version }}
302340

303341
steps:
304342
- uses: actions/checkout@v4
343+
- uses: ./.github/actions/test-device
305344

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

314-
- run: |
315-
tar -xvf bitcoind.tar.gz
351+
strategy:
352+
fail-fast: false
353+
matrix:
354+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
355+
device:
356+
- 'ledger'
357+
- 'ledger-legacy'
358+
interface: [ 'library', 'cli', 'stdin' ]
316359

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

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

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

0 commit comments

Comments
 (0)