Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI #35

Merged
merged 10 commits into from
Nov 27, 2023
33 changes: 33 additions & 0 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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:
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: "compiled_app_binaries"
builder: ledger-app-builder

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"
21 changes: 21 additions & 0 deletions .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Run coding style check

# This workflow will run linting checks to ensure a level of code quality among all Ledger applications.
#
# The presence of this workflow is mandatory as a minimal level of linting is required.

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

jobs:
check_linting:
name: Check linting using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
with:
source: './src'
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
29 changes: 29 additions & 0 deletions .github/workflows/misspellings_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Misspellings checks

# This workflow performs some misspelling checks on the repository
# It is there to help us maintain a level of quality in our codebase and does not have to be kept on forked
# applications.

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

jobs:
misspell:
name: Check misspellings
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3

- name: Check misspellings
uses: codespell-project/actions-codespell@v2
with:
builtin: clear,rare
check_filenames: true
ignore_words_list: crate,Crate
44 changes: 44 additions & 0 deletions .github/workflows/python_tests_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Checks on the Python tests

# This workflow performs some checks on the Python client used by the Boilerplate tests
# It is there to help us maintain a level of quality in our codebase and does not have to be kept on forked
# applications.

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

jobs:

lint:
name: Boilerplate client linting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Installing PIP dependencies
run: |
pip install pylint
pip install --extra-index-url https://test.pypi.org/simple/ -r tests/requirements.txt
- name: Lint Python code
run: |
pylint --rc tests/setup.cfg tests/application_client/

mypy:
name: Type checking
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Installing PIP dependencies
run: |
pip install mypy
pip install --extra-index-url https://test.pypi.org/simple/ -r tests/requirements.txt
- name: Mypy type checking
run: |
mypy tests/application_client/
46 changes: 0 additions & 46 deletions .github/workflows/rust.yml

This file was deleted.

12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ authors = ["yhql", "agrojean-ledger"]
edition = "2021"

[dependencies]
ledger_device_sdk = "1.0.0"
ledger_device_ui_sdk = "1.1.0"
ledger_secure_sdk_sys = "1.0.0"
ledger_device_sdk = "1.0.1"
ledger_device_ui_sdk = "1.1.1"
ledger_secure_sdk_sys = "1.0.1"
agrojean-ledger marked this conversation as resolved.
Show resolved Hide resolved
include_gif = "1.0.0"
numtoa = "0.2.4"

Expand All @@ -21,7 +21,8 @@ pending_review_screen = ["ledger_device_sdk/pending_review_screen"]
[package.metadata.ledger]
curve = ["secp256k1"]
flags = "0"
path = [""]
path = ["44'/1'"]
name = "Rust Boilerplate"
agrojean-ledger marked this conversation as resolved.
Show resolved Hide resolved

[package.metadata.ledger.nanos]
icon = "crab.gif"
Expand Down
3 changes: 3 additions & 0 deletions ledger_app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
build_directory = "./"
sdk = "Rust"
devices = ["nanos", "nanox", "nanos+"]

[tests]
pytest_directory = "./tests/"
4 changes: 2 additions & 2 deletions src/app_ui/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ use ledger_device_ui_sdk::ui::{Field, MultiFieldReview};
const DISPLAY_ADDR_BYTES_LEN: usize = 20;

pub fn ui_display_pk(addr: &[u8]) -> Result<bool, AppSW> {
let addr_hex_str_buf = to_hex_all_caps(&addr[addr.len() - DISPLAY_ADDR_BYTES_LEN as usize..])
let addr_hex_str_buf = to_hex_all_caps(&addr[addr.len() - DISPLAY_ADDR_BYTES_LEN..])
.map_err(|_| AppSW::AddrDisplayFail)?;
let addr_hex_str = from_utf8(&addr_hex_str_buf[..DISPLAY_ADDR_BYTES_LEN * 2])
.map_err(|_| AppSW::AddrDisplayFail)?;

let mut addr_hex_str_with_prefix_buf = [0u8; DISPLAY_ADDR_BYTES_LEN * 2 + 2];
concatenate(&["0x", &addr_hex_str], &mut addr_hex_str_with_prefix_buf);
concatenate(&["0x", addr_hex_str], &mut addr_hex_str_with_prefix_buf);
let addr_hex_str_with_prefix =
from_utf8(&addr_hex_str_with_prefix_buf).map_err(|_| AppSW::AddrDisplayFail)?;

Expand Down
9 changes: 5 additions & 4 deletions src/app_ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ fn ui_about_menu(comm: &mut Comm) -> Event<ApduHeader> {
loop {
match MultiPageMenu::new(comm, &pages).show() {
EventOrPageIndex::Event(e) => return e,
i => match i {
EventOrPageIndex::Index(1) => return ui_menu_main(comm),
_ => (),
},
i => {
if let EventOrPageIndex::Index(1) = i {
return ui_menu_main(comm);
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/app_ui/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ pub fn ui_display_tx(tx: &Tx) -> Result<bool, AppSW> {
.trim_matches(char::from(0));

// Format destination address
let hex_addr_buf = to_hex_all_caps(&tx.to).map_err(|_| AppSW::TxDisplayFail)?;
let hex_addr_buf = to_hex_all_caps(tx.to).map_err(|_| AppSW::TxDisplayFail)?;
let hex_addr_str = from_utf8(&hex_addr_buf).map_err(|_| AppSW::TxDisplayFail)?;
let mut addr_with_prefix_buf = [0u8; 42];
concatenate(&["0x", hex_addr_str], &mut addr_with_prefix_buf);
let hex_addr_str_with_prefix =
from_utf8(&addr_with_prefix_buf).map_err(|_| AppSW::TxDisplayFail)?;

// Format memo
let memo_str = from_utf8(&tx.memo[..tx.memo_len as usize]).map_err(|_| AppSW::TxDisplayFail)?;
let memo_str = from_utf8(&tx.memo[..tx.memo_len]).map_err(|_| AppSW::TxDisplayFail)?;

// Define transaction review fields
let my_fields = [
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/get_public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn handler_get_public_key(comm: &mut Comm, display: bool) -> Result<(), AppS
&mut keccak256.header as *mut cx_hash_t,
CX_LAST,
pk_ptr,
64 as usize,
64_usize,
address.as_mut_ptr(),
address.len(),
) != CX_OK
Expand Down
1 change: 1 addition & 0 deletions src/handlers/sign_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use ledger_secure_sdk_sys::{
const MAX_TRANSACTION_LEN: usize = 510;

pub struct Tx<'a> {
#[allow(dead_code)]
nonce: u64,
pub value: u64,
pub to: &'a [u8],
Expand Down
Loading
Loading