Build and run functional tests using ragger through reusable workflow #794
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | |
| # | |
| # The build part of this workflow is mandatory, this ensures that the app will be deployable in the Ledger App Store. | |
| # While the test part of 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: | |
| inputs: | |
| golden_run: | |
| type: choice | |
| required: true | |
| default: 'Raise an error (default)' | |
| description: CI behavior if the test snapshots are different than expected. | |
| options: | |
| - 'Raise an error (default)' | |
| - 'Open a PR' | |
| simulate_schedule: | |
| type: boolean | |
| description: 'Simulate the weekly schedule (Builds custom container)' | |
| default: false | |
| push: | |
| branches: | |
| - master | |
| - main | |
| - develop | |
| pull_request: | |
| schedule: | |
| # Runs at 2:00 AM CET every Monday | |
| - cron: '0 1 * * 1' | |
| jobs: | |
| build_container: | |
| name: Build and push speculos-bitcoin docker image | |
| # Runs on the Monday cron OR if the manual checkbox is ticked | |
| if: github.event_name == 'schedule' || inputs.simulate_schedule == true | |
| uses: ./.github/workflows/builder-image-workflow.yml | |
| secrets: inherit | |
| 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, build_container] | |
| # Ensures we still run if the container build was skipped (e.g., standard PRs) | |
| if: | | |
| always() && | |
| needs.build_application.result == 'success' && | |
| (needs.build_container.result == 'success' || needs.build_container.result == 'skipped') | |
| uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1 | |
| with: | |
| download_app_binaries_artifact: "compiled_app_binaries" | |
| # If scheduled or ticked-> use the custom bitcoin speculos image. | |
| # Otherwise -> pass an empty string to use Ledger's default image. | |
| container_image: ${{ (github.event_name == 'schedule' || inputs.simulate_schedule == true) && 'ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin:latest' || '' }} | |
| test_options: ${{ github.event_name == 'push' && '--enable_slow_tests' || '' }} | |
| regenerate_snapshots: ${{ github.event_name == 'workflow_dispatch' && inputs.golden_run == 'Open a PR' }} |