Skip to content

Commit 6f1d8d1

Browse files
committed
Change CI to add test using ledger emulator
1 parent f47351f commit 6f1d8d1

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

.github/workflows/cont_integration.yml

+29
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,32 @@ jobs:
172172
run: rustup update
173173
- name: Check fmt
174174
run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
175+
176+
test_harware_wallet:
177+
runs-on: ubuntu-latest
178+
strategy:
179+
matrix:
180+
rust:
181+
- version: 1.60.0 # STABLE
182+
- version: 1.56.1 # MSRV
183+
steps:
184+
- name: Checkout
185+
uses: actions/checkout@v3
186+
- name: Build simulator image
187+
run: docker build -t hwi/ledger_emulator ./ci -f ci/Dockerfile.ledger
188+
- name: Run simulator image
189+
run: docker run --name simulator --network=host hwi/ledger_emulator &
190+
- name: Install Python
191+
uses: actions/setup-python@v4
192+
with:
193+
python-version: '3.9'
194+
- name: Install python dependencies
195+
run: pip install hwi==2.1.1 protobuf==3.20.1
196+
- name: Set default toolchain
197+
run: rustup default ${{ matrix.rust.version }}
198+
- name: Set profile
199+
run: rustup set profile minimal
200+
- name: Update toolchain
201+
run: rustup update
202+
- name: Test
203+
run: cargo test --features test-hardware-signer

ci/Dockerfile.ledger

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Taken from bitcoindevkit/rust-hwi
2+
FROM ghcr.io/ledgerhq/speculos
3+
4+
RUN apt-get update
5+
RUN apt-get install wget -y
6+
RUN wget "https://github.com/LedgerHQ/speculos/blob/master/apps/nanos%23btc%232.1%231c8db8da.elf?raw=true" -O /speculos/btc.elf
7+
ADD automation.json /speculos/automation.json
8+
9+
ENTRYPOINT ["python", "./speculos.py", "--automation", "file:automation.json", "--display", "headless", "--vnc-port", "41000", "btc.elf"]

ci/automation.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": 1,
3+
"rules": [
4+
{
5+
"regexp": "Address \\(\\d/\\d\\)|Message hash \\(\\d/\\d\\)|Confirm|Fees|Review|Amount",
6+
"actions": [
7+
[ "button", 2, true ],
8+
[ "button", 2, false ]
9+
]
10+
},
11+
{
12+
"text": "Sign",
13+
"conditions": [
14+
[ "seen", false ]
15+
],
16+
"actions": [
17+
[ "button", 2, true ],
18+
[ "button", 2, false ],
19+
[ "setbool", "seen", true ]
20+
]
21+
},
22+
{
23+
"regexp": "Approve|Sign|Accept",
24+
"actions": [
25+
[ "button", 3, true ],
26+
[ "button", 3, false ]
27+
]
28+
}
29+
]
30+
}

0 commit comments

Comments
 (0)