Skip to content

Commit

Permalink
Merge remote-tracking branch 'stencil/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dfordivam committed Feb 14, 2024
2 parents 6915500 + 2c05adf commit 9a34dba
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 9 deletions.
3 changes: 0 additions & 3 deletions .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ rustflags = [
"-C", "codegen-units=1",
"-C", "save-temps", # Fixes incremental builds by keeping .bc and .ll files
"-C", "embed-bitcode",
"--emit=metadata,link,obj,llvm-ir,llvm-bc"
]
runner = "./speculos-wrapper -m nanosp "

Expand All @@ -16,7 +15,6 @@ rustflags = [
"-C", "codegen-units=1",
"-C", "save-temps", # Fixes incremental builds by keeping .bc and .ll files
"-C", "embed-bitcode",
"--emit=metadata,link,obj,llvm-ir,llvm-bc"
]
runner = "./speculos-wrapper -m nanos "

Expand All @@ -25,7 +23,6 @@ rustflags = [
"-C", "codegen-units=1",
"-C", "save-temps", # Fixes incremental builds by keeping .bc and .ll files
"-C", "embed-bitcode",
"--emit=metadata,link,obj,llvm-ir,llvm-bc"
]
runner = "./speculos-wrapper -m nanox "

Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and run functional tests

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
- develop-sync
pull_request:

jobs:
build_application:
name: Build application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@jca/update_reusable_build
with:
upload_app_binaries_artifact: "compiled_app_binaries"
builder: ledger-app-builder

functional_tests:
name: Run tests
needs: build_application
uses: ./.github/workflows/functional_tests.yml
with:
download_app_binaries_artifact: "compiled_app_binaries"
100 changes: 100 additions & 0 deletions .github/workflows/functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
name: Functional tests

on:
workflow_call:
inputs:
app_repository:
description: 'The GIT repository to test (defaults to `github.repository`)'
required: false
default: ${{ github.repository }}
type: string
app_branch_name:
description: 'The GIT branch to test (defaults to `github.ref`)'
required: false
default: ${{ github.ref }}
type: string
download_app_binaries_artifact:
description: 'The name of the artifact containing the application binary file(s) to be tested. Required'
required: true
type: string
run_for_devices:
description: |
The list of device(s) on which the test will run.
Defaults to the full list of device(s) supported by the application as configured in the
'ledger_app.toml' manifest.
If the manifest is missing, defaults to ALL (["nanos", "nanox", "nanosp", "stax"]).
required: false
default: 'None'
type: string
upload_snapshots_on_failure:
description: 'Enable or disable upload of tests snapshots if the job fails (defaults to true).'
required: false
default: true
type: boolean
test_filter:
description: 'Specify an expression which implements a substring match on the test names'
required: false
default: '""'
type: string

jobs:
call_get_app_metadata:
# This job digests inputs and repository metadata provided by the `ledger_app.toml` manifest
# file, in order to output relevant directories, compatible devices, and other variables needed
# by following jobs.
name: Retrieve application metadata
uses: LedgerHQ/ledger-app-workflows/.github/workflows/_get_app_metadata.yml@v1
with:
app_repository: ${{ inputs.app_repository }}
app_branch_name: ${{ inputs.app_branch_name }}
compatible_devices: ${{ inputs.run_for_devices }}

functional_tests:
name: Functional tests
needs: call_get_app_metadata
strategy:
fail-fast: false
matrix:
device: ${{ fromJSON(needs.call_get_app_metadata.outputs.compatible_devices) }}
runs-on: ubuntu-latest

steps:
- name: Clone
uses: actions/checkout@v4
with:
repository: ${{ inputs.app_repository }}
ref: ${{ inputs.app_branch_name }}
submodules: recursive

- name: Download app binaries
uses: actions/download-artifact@v3
with:
name: ${{ inputs.download_app_binaries_artifact }}
path: ${{ needs.call_get_app_metadata.outputs.build_directory }}/build/

- name: Set Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Install yarn
uses: borales/actions-yarn@v4
with:
cmd: install # will run `yarn install` command
dir: 'ts-tests'

- name: Install tests dependencies
run: |
sudo apt-get update && sudo apt-get install -y qemu-user-static tesseract-ocr libtesseract-dev
pip install -U pip setuptools
pip install speculos
- name: Run test
run: |
BIN_DIR_NAME="$(echo ${{ matrix.device }} | sed 's/nanosp/nanos2/')"
speculos --api-port 5005 ${{ needs.call_get_app_metadata.outputs.build_directory }}/build/${BIN_DIR_NAME}/bin/app.elf --display headless &
sleep 5
cd ts-tests
yarn run test
23 changes: 23 additions & 0 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Ensure compliance with Ledger guidelines

# This workflow is mandatory in all applications
# It calls a reusable workflow guidelines_enforcer developed by Ledger's internal developer team.
# The successful completion of the reusable workflow is a mandatory step for an app to be available on the Ledger
# application store.
#
# More information on the guidelines can be found in the repository:
# LedgerHQ/ledger-app-workflows/

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:

jobs:
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
10 changes: 5 additions & 5 deletions rust-app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ extern "C" fn sample_main() {

pub mod interface;

#[cfg(all(target_family = "bolos"))]
#[cfg(target_family = "bolos")]
pub mod utils;

#[cfg(all(target_family = "bolos"))]
#[cfg(target_family = "bolos")]
pub mod implementation;

#[cfg(all(target_family = "bolos"))]
#[cfg(target_family = "bolos")]
pub mod menu;

#[cfg(all(target_family = "bolos"))]
#[cfg(target_family = "bolos")]
pub mod settings;

#[cfg(all(target_family = "bolos"))]
#[cfg(target_family = "bolos")]
pub mod main_nanos;

#[cfg(all(target_family = "bolos", test))]
Expand Down
2 changes: 1 addition & 1 deletion rust-app/src/main_nanos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn app_main() {

let mut idle_menu = IdleMenuWithSettings {
idle_menu: IdleMenu::AppMain,
settings: Settings::default(),
settings: Settings,
};
let mut busy_menu = BusyMenu::Working;

Expand Down

0 comments on commit 9a34dba

Please sign in to comment.