Skip to content

Commit

Permalink
Split build and test CI entry point from workflow to provide a reusab…
Browse files Browse the repository at this point in the history
…le interface
  • Loading branch information
fbeutin-ledger committed Jan 2, 2025
1 parent 24bcdae commit e29a4f8
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ name: Build and run functional tests using ragger through reusable workflow

on:
workflow_dispatch:
inputs:
golden_run:
type: choice
required: true
default: 'Raise an error (default)'
description: CI behavior if the test snaphots are different than expected.
options:
- 'Raise an error (default)'
- 'Open a PR'
push:
branches:
- master
Expand All @@ -18,17 +27,9 @@ on:
pull_request:

jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
job_call_build_and_test:
name: Build and test
uses: ./.github/workflows/reusable_build_and_functional_tests.yml
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"
container_image: "ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin-musig2:latest"
branch_for_bitcoin: ${{ github.ref }}
regenerate_snapshots: ${{ inputs.golden_run == 'Open a PR' }}
50 changes: 50 additions & 0 deletions .github/workflows/reusable_build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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_call:
inputs:
branch_for_bitcoin:
required: false
default: 'develop'
type: string

test_filter:
required: false
default: '""'
type: string

regenerate_snapshots:
description: 'Clean snapshots, regenerate them, commit the changes in a branch, and open a PR'
required: false
default: false
type: boolean

jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
app_repository: LedgerHQ/app-bitcoin-new
app_branch_name: ${{ inputs.branch_for_bitcoin }}
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:
app_repository: LedgerHQ/app-bitcoin-new
app_branch_name: ${{ inputs.branch_for_bitcoin }}
test_filter: ${{ inputs.test_filter }}
download_app_binaries_artifact: "compiled_app_binaries"
container_image: "ghcr.io/ledgerhq/app-bitcoin-new/speculos-bitcoin-musig2:latest"
regenerate_snapshots: ${{ inputs.regenerate_snapshots }}

0 comments on commit e29a4f8

Please sign in to comment.