diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index 709fcb66..c46896be 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -130,28 +130,12 @@ jobs: package_and_test_docker: name: Build and test the Speculos docker - runs-on: ubuntu-latest - container: - image: docker://ghcr.io/ledgerhq/speculos-builder:latest - steps: - - name: Clone - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Build the Speculos docker - uses: docker/build-push-action@v1 - with: - push: false - tags: test - - name: Run and test Speculos docker - uses: addnab/docker-run-action@v3 - with: - image: ledgerhq/speculos:test - options: -v ${{ github.workspace }}/apps/:/apps/ - run: | - apt-get update && apt-get install -qy netcat - /speculos/speculos.py /apps/btc.elf --model nanos --display=headless --apdu-port 9999 & - until `nc -w5 -z -v 127.0.0.1 9999`; do sleep 1; done; + uses: ./.github/workflows/reusable_ragger_tests_latest_speculos.yml + with: + app_repository: LedgerHQ/app-boilerplate + app_branch_name: master + test_dir: tests + speculos_app_branch_name: ${{ github.ref }} deploy_docker: name: Build and Upload the Speculos docker diff --git a/.github/workflows/reusable_ragger_tests_latest_speculos.yml b/.github/workflows/reusable_ragger_tests_latest_speculos.yml new file mode 100644 index 00000000..3ff6697b --- /dev/null +++ b/.github/workflows/reusable_ragger_tests_latest_speculos.yml @@ -0,0 +1,82 @@ +name: Functional tests using Ragger and latest speculos + +on: + workflow_call: + inputs: + app_repository: + required: false + default: ${{ github.repository }} + type: string + app_branch_name: + required: false + default: ${{ github.ref }} + type: string + test_dir: + required: true + type: string + speculos_app_branch_name: + required: false + default: develop + type: string + +jobs: + build_application: + name: Build application using the reusable workflow + uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1 + with: + app_repository: ${{ inputs.app_repository }} + app_branch_name: ${{ inputs.app_branch_name }} + upload_app_binaries_artifact: "compiled_app_binaries" + + ragger_tests: + name: Functional tests with Ragger + runs-on: ubuntu-latest + container: + image: docker://ghcr.io/ledgerhq/speculos-builder:latest + strategy: + fail-fast: false + matrix: + include: + - device: nanos + - device: nanox + - device: nanosp + - device: stax + steps: + - name: Clone + uses: actions/checkout@v3 + with: + repository: ledgerHQ/speculos + ref: ${{ inputs.speculos_app_branch_name }} + submodules: recursive + fetch-depth: 0 + + - name: Build the Speculos docker + uses: docker/build-push-action@v1 + with: + push: false + tags: test + + - name: Clone + uses: actions/checkout@v3 + with: + repository: ${{ inputs.app_repository }} + ref: ${{ inputs.app_branch_name }} + path: app + submodules: recursive + fetch-depth: 0 + + - name: Download app binaries + uses: actions/download-artifact@v3 + with: + name: "compiled_app_binaries" + path: ${{ github.workspace }}/app/build + + - name: Run and test Speculos docker + uses: addnab/docker-run-action@v3 + with: + image: ledgerhq/speculos:test + options: -v ${{ github.workspace }}/app:/app + run: | + apt-get update && apt-get install -y gcc + pip install --extra-index-url https://test.pypi.org/simple/ -r /app/${{ inputs.test_dir }}/requirements.txt + pytest /app/${{ inputs.test_dir }}/ --tb=short -v --device ${{ matrix.device }}