Skip to content

Add testnet support #20

Add testnet support

Add testnet support #20

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
- master
- develop
- liquid_develop
pull_request:
branches:
- master
- develop
- liquid_develop
jobs:
job_build:
name: Compilation for NanoS, X, and S+
strategy:
matrix:
include:
- model: nanos
SDK: "$NANOS_SDK"
- model: nanox
SDK: "$NANOX_SDK"
- model: nanosp
SDK: "$NANOSP_SDK"
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Build
run: |
make DEBUG=0 COIN=liquid BOLOS_SDK=${{ matrix.SDK }} && mv bin/ liquid-bin/
make clean
make DEBUG=0 COIN=liquid_regtest BOLOS_SDK=${{ matrix.SDK }} && mv bin/ liquid-regtest-bin/
make clean
make DEBUG=0 COIN=liquid_testnet BOLOS_SDK=${{ matrix.SDK }} && mv bin/ liquid-testnet-bin/
- name: Upload Liquid app binary
uses: actions/upload-artifact@v4
with:
name: liquid-app-${{ matrix.model }}
path: liquid-bin
- name: Upload Liquid Regtest app binary
uses: actions/upload-artifact@v4
with:
name: liquid-regtest-app-${{ matrix.model }}
path: liquid-regtest-bin
- name: Upload Liquid Testnet app binary
uses: actions/upload-artifact@v4
with:
name: liquid-testnet-app-${{ matrix.model }}
path: liquid-testnet-bin
job_unit_test:
name: Unit test
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Build unit tests
run: |
cd unit-tests/
cmake -Bbuild -H. && make -C build && make -C build test
- name: Generate code coverage
run: |
cd unit-tests/
lcov --directory . -b "$(realpath build/)" --capture --initial -o coverage.base && \
lcov --rc lcov_branch_coverage=1 --directory . -b "$(realpath build/)" --capture -o coverage.capture && \
lcov --directory . -b "$(realpath build/)" --add-tracefile coverage.base --add-tracefile coverage.capture -o coverage.info && \
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info && \
genhtml coverage.info -o coverage
- uses: actions/upload-artifact@v4
with:
name: code-coverage
path: unit-tests/coverage
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./unit-tests/coverage.info
flags: unittests
name: codecov-app-liquid
fail_ci_if_error: true
verbose: true
- name: HTML documentation
run: doxygen .doxygen/Doxyfile
- uses: actions/upload-artifact@v4
with:
name: documentation
path: doc/html
job_test_mainnet:
name: Tests on mainnet
strategy:
matrix:
include:
- model: nanos
- model: nanox
- model: nanosp
needs: job_build
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Download Liquid app binary
uses: actions/download-artifact@v4
with:
name: liquid-app-${{matrix.model}}
path: build/${{ matrix.model == 'nanosp' && 'nanos2' || matrix.model }}/bin
- name: Install tests dependencies
run: |
sudo apt-get update && sudo apt-get install -y qemu-user-static tesseract-ocr libtesseract-dev
pip install -U pip setuptools
- name: Run tests
run: |
cd tests_liquid_main
pip install --prefer-binary -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --tb=short -v --device=${{matrix.model}} --speculos_api_port 5000
job_test_python_lib_legacyapp:
if: false
name: Tests with the Python library and legacy Bitcoin app
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin:latest
ports:
- 1234:1234
- 9999:9999
- 40000:40000
- 41000:41000
- 42000:42000
- 43000:43000
options: --entrypoint /bin/bash
steps:
- name: Clone
uses: actions/checkout@v4
- name: Run tests
run: |
cd bitcoin_client/tests
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --timeout=300 --model=nanos
job_test_js_lib:
if: false
name: Tests with the JS library
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin:latest
ports:
- 1234:1234
- 9999:9999
- 40000:40000
- 41000:41000
- 42000:42000
- 43000:43000
options: --entrypoint /bin/bash
steps:
- name: Clone
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Install yarn
run: |
npm install -g yarn
- name: Download Liquid Regtest app binary
uses: actions/download-artifact@v4
with:
name: liquid-regtest-app-nanosp
path: bin
- name: Run tests
run: |
cd bitcoin_client_js
yarn install
LOG_SPECULOS=1 LOG_APDUS=1 SPECULOS="/speculos/speculos.py" yarn test
job_test_rust_client:
if: false
name: Tests for rust client library
needs: job_build
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Run tests
run: |
cd bitcoin_client_rs/
cargo test --no-default-features --features="async"