diff --git a/.github/workflows/build_and_functional_tests.yml b/.github/workflows/build_and_functional_tests.yml new file mode 100644 index 000000000..7e57e5c65 --- /dev/null +++ b/.github/workflows/build_and_functional_tests.yml @@ -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" + diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index d76a64c4c..910682551 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -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: diff --git a/tests/setup_script.sh b/tests/setup_script.sh new file mode 100755 index 000000000..12278dae2 --- /dev/null +++ b/tests/setup_script.sh @@ -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