Skip to content

Commit

Permalink
CI: use reusable workflow for ragger tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed Mar 11, 2024
1 parent f77ef2c commit f449156
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 40 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and run functional tests using ragger through reusable workflow

# This workflow will build the app and then run functional tests using the Ragger framework upon Speculos emulation.
# It calls a reusable workflow developed by Ledger's internal developer team to build the application and upload the
# resulting binaries.
# It then calls another reusable workflow to run the Ragger tests on the compiled application binary.
#
# While this workflow is optional, having functional testing on your application is mandatory and this workflow and
# tooling environment is meant to be easy to use and adapt after forking your application

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:

jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "compiled_app_binaries"
flags: "DEBUG=0 COIN=bitcoin_testnet"

ragger_tests:
name: Run ragger tests using the reusable workflow
needs: build_application
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: "compiled_app_binaries"

40 changes: 0 additions & 40 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,46 +100,6 @@ jobs:
name: documentation
path: doc/html

job_test:
name: Tests
strategy:
matrix:
include:
- model: nanos
- model: nanox
- model: nanosp
- model: stax

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@v2

- name: Download Bitcoin Testnet app binary
uses: actions/download-artifact@v2
with:
name: bitcoin-testnet-app-${{matrix.model}}
path: bin

- name: Run tests
run: |
cd tests
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=500
job_test_mainnet:
name: Tests on mainnet
strategy:
Expand Down
9 changes: 9 additions & 0 deletions tests/setup_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

sudo apt update -y && sudo apt install -y curl
curl -o /tmp/bitcoin.tar.gz https://bitcoincore.org/bin/bitcoin-core-26.0/bitcoin-26.0-x86_64-linux-gnu.tar.gz && \
sudo tar -xf /tmp/bitcoin.tar.gz -C / && \
sudo mv /bitcoin-26.0 /bitcoin

# Add bitcoin binaries to path
export PATH=/bitcoin/bin:$PATH

0 comments on commit f449156

Please sign in to comment.