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 619d7cd commit e6ee1da
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 32 deletions.
35 changes: 3 additions & 32 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,8 @@ on:
pull_request:

jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
name: Build and test

Check failure on line 30 in .github/workflows/build_and_functional_tests.yml

View workflow job for this annotation

GitHub Actions / Check yaml files

30:5 [indentation] wrong indentation: expected 2 but found 4
uses: ./.github/workflows/reusable_swap_functional_tests.yml
with:
upload_app_binaries_artifact: "ragger_elfs"
flags: "CAL_TEST_KEY=1 TRUSTED_NAME_TEST_KEY=1 SET_PLUGIN_TEST_KEY=1 NFT_TEST_KEY=1"

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: "--with_lib_mode"
branch_for_ethereum: ${{ github.ref }}
regenerate_snapshots: ${{ inputs.golden_run == 'Open a PR' }}
70 changes: 70 additions & 0 deletions .github/workflows/reusable_build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
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_ethereum:
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_branch_name: ${{ inputs.branch_for_ethereum }}
upload_app_binaries_artifact: "ragger_elfs"
flags: "CAL_TEST_KEY=1 TRUSTED_NAME_TEST_KEY=1 SET_PLUGIN_TEST_KEY=1 NFT_TEST_KEY=1"

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_branch_name: ${{ inputs.branch_for_ethereum }}
download_app_binaries_artifact: "ragger_elfs"
test_filter: ${{ inputs.test_filter }}
regenerate_snapshots: ${{ inputs.regenerate_snapshots }}

build_clone_app:
name: Build Clone app using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
app_branch_name: ${{ inputs.branch_for_ethereum }}
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:
app_branch_name: ${{ inputs.branch_for_ethereum }}
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: "--with_lib_mode"
test_filter: ${{ inputs.test_filter }}
regenerate_snapshots: ${{ inputs.regenerate_snapshots }}

0 comments on commit e6ee1da

Please sign in to comment.