Skip to content

Merge pull request #935 from LedgerHQ/cev/B2CA-2477_formatters #2051

Merge pull request #935 from LedgerHQ/cev/B2CA-2477_formatters

Merge pull request #935 from LedgerHQ/cev/B2CA-2477_formatters #2051

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:
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'
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: "ragger_elfs"
flags: "whitelist_keys"
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: "ragger_elfs"
regenerate_snapshots: ${{ inputs.golden_run == 'Open a PR' }}
build_clone_app:
name: Build Clone app using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
flags: "CHAIN=thundercore"
upload_app_binaries_artifact: "clone_elfs"
ragger_clone_tests:
name: Run ragger Clone tests using the reusable workflow
needs:
- build_application
- build_clone_app
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: "ragger_elfs"
additional_app_binaries_artifact: "clone_elfs"
additional_app_binaries_artifact_dir: ./tests/ragger/.test_dependencies/clone/build/
test_options: "--setup lib_mode"
regenerate_snapshots: ${{ inputs.golden_run == 'Open a PR' }}
build_mem_app:
name: Build Memory application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "memory_elfs"
flags: "memory_profiling"
run_for_devices: '["nanox"]'
ragger_mem_tests:
name: Run Memory 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: "memory_elfs"
run_for_devices: '["nanox"]'
upload_snapshots_on_failure: false
capture_file: pytest-logs-combined
ragger_mem__results:
name: Process pytest logs
if: always()
needs: ragger_mem_tests
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Download and process pytest logs
if: always()
uses: actions/download-artifact@v4
with:
name: pytest-logs-combined
path: logs
- name: Process logs with valground
if: always()
run: |
if [ -f logs/pytest-logs-combined.log ]; then
cat logs/pytest-logs-combined.log | tools/valground.py -q
fi