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

B2CA-1584: Port Nano on NBGL #6

Merged
merged 13 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 0 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
BasedOnStyle: Google
IndentWidth: 4
---
Language: Cpp
ColumnLimit: 100
PointerAlignment: Right
Expand All @@ -12,7 +11,6 @@ SortIncludes: false
SpaceAfterCStyleCast: true
AllowShortCaseLabelsOnASingleLine: false
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortFunctionsOnASingleLine: None
BinPackArguments: false
Expand Down
5 changes: 4 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Checklist

<!-- Put an `x` in each box when you have completed the items. -->

- [ ] App update process has been followed <!-- See comment below -->
- [ ] Target branch is `develop` <!-- unless you have a very good reason -->
- [ ] Application version has been bumped <!-- required if your changes are to be deployed -->

<!-- Make sure you followed the process described in https://developers.ledger.com/docs/device-app/deliver/maintenance before opening your Pull Request.
<!-- Make sure you followed the process described in https://developers.ledger.com/docs/device-app/deliver/maintenance
before opening your Pull Request.
Don't hesitate to contact us directly on Discord if you have any questions ! https://developers.ledger.com/discord -->
10 changes: 5 additions & 5 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
type: choice
required: true
default: 'Raise an error (default)'
description: CI behavior if the test snaphots are different than expected.
description: CI behavior if the test snapshots are different than expected.
options:
- 'Raise an error (default)'
- 'Open a PR'
Expand All @@ -30,21 +30,21 @@ on:

jobs:
build_application_nbgl_test:
name: Build application using the reusable workflow
name: Build nbgl_test application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "compiled_app_binaries"
flags: "COIN=nbgl_test"

build_application_demo:
name: Build application using the reusable workflow
name: Build demo application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "compiled_app_binaries_demo"
flags: "COIN=demo"

ragger_tests:
name: Run ragger tests using the reusable workflow
name: Run ragger tests on nbgl_test using the reusable workflow
needs: build_application_nbgl_test
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/codeql_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,21 @@ jobs:
analyse:
name: Analyse
strategy:
fail-fast: false
matrix:
sdk: ["$STAX_SDK", "$FLEX_SDK"]
#'cpp' covers C and C++
language: [ 'cpp' ]
sdk: ["$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK", "$FLEX_SDK"]
# 'cpp' covers C and C++
language: ['cpp']
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-and-quality
Expand All @@ -41,4 +42,4 @@ jobs:
make BOLOS_SDK=${{ matrix.sdk }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
4 changes: 2 additions & 2 deletions .github/workflows/documentation_generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:

steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: HTML documentation
run: doxygen .doxygen/Doxyfile

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: documentation
path: doc/html
14 changes: 7 additions & 7 deletions .github/workflows/misspellings_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
name: Check misspellings
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Clone
uses: actions/checkout@v4

- name: Check misspellings
uses: codespell-project/actions-codespell@v1
with:
builtin: clear,rare
check_filenames: true
- name: Check misspellings
uses: codespell-project/actions-codespell@v2
with:
builtin: clear,rare
check_filenames: true
35 changes: 16 additions & 19 deletions .github/workflows/python_client_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,28 @@ on:
pull_request:

jobs:

lint:
name: NBGL_Tests client linting
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
- name: Installing PIP dependencies
run: |
pip install pylint
pip install -r tests/requirements.txt
- name: Lint Python code
run: |
pylint --rc tests/setup.cfg tests/application_client/
- name: Clone
uses: actions/checkout@v4
- name: Installing PIP dependencies
run: |
pip install pylint
pip install -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 -r tests/requirements.txt
- name: Mypy type checking
run: |
mypy tests/application_client/
- name: Clone
uses: actions/checkout@v4
- name: Installing PIP dependencies
run: |
pip install mypy
pip install -r tests/requirements.txt
- name: Mypy type checking
run: mypy tests/application_client/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ doc/latex
ledger/

# Vscode
.vscode/
.vscode/
11 changes: 11 additions & 0 deletions .mdl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Style file for mdl
# https://github.com/markdownlint/markdownlint/blob/main/docs/creating_styles.md

# Include all rules
all

# Disable specific rules
#exclude_rule 'MD012'

# Update rules configuration
rule 'MD013', :line_length => 120
14 changes: 14 additions & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# markdownlint config file

# Use custom style file
style "#{File.dirname(__FILE__)}/.mdl.rb"

# MD002 - First header in file should be a top level header
# MD005 - Inconsistent indentation for list items at the same level
# MD007 - Unordered list indentation
# MD014 - Dollar signs used before commands without showing output
# MD024 - Multiple headers with the same content
# MD029 - Ordered list item prefix
# MD033 - Inline HTML
# MD041 - First line in file should be a top level header
rules "~MD002,~MD005,~MD007,~MD014,~MD024,~MD029,~MD033,~MD041"
47 changes: 47 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# To install hooks, run:
# pre-commit install --hook-type pre-commit
# pre-commit install --hook-type commit-msg

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
- id: check-added-large-files
- id: check-merge-conflict
- id: check-case-conflict

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v12.0.1
hooks:
- id: clang-format
types_or: [c]

- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.7.6.22
hooks:
- id: actionlint
types_or: [yaml]
args: [-shellcheck='' -pyflakes='']

- repo: https://github.com/markdownlint/markdownlint
rev: v0.12.0
hooks:
- id: markdownlint
types_or: [markdown]

- repo: https://github.com/PyCQA/pylint
rev: v3.3.3
hooks:
- id: pylint
language: system
types: [python]
args: ['--jobs=0', '--rcfile=tests/setup.cfg']
files: '^tests/.*$'
13 changes: 5 additions & 8 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
{
"env": {
"BOLOS_SDK": "/opt/nanosplus-secure-sdk",
"BOLOS_ENV": "/opt/bolos-devenv"
"BOLOS_SDK": "/opt/ledger-secure-sdk"
},
"configurations": [
{
"name": "Nano S+",
"includePath": [
"/usr/include",
"${workspaceFolder}/src",
"${env:BOLOS_SDK}/include/*",
"${env:BOLOS_SDK}/lib_ux/include/*"
"${workspaceFolder}/src/**",
"${env:BOLOS_SDK}/**"
],
"defines": [
"TARGET_NANOS2",
Expand All @@ -31,10 +28,10 @@
"PATCH_VERSION=0",
"IO_SEPROXYHAL_BUFFER_SIZE_B=128",
"DEBUG=1",
"HAVE_PIEZO_SOUND",
"HAVE_PRINTF",
"PRINTF=screen_printf"
],
"compilerPath": "${env:BOLOS_ENV}/gcc-arm-none-eabi-5_3-2016q1/bin/arm-none-eabi-gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-arm",
Expand All @@ -45,4 +42,4 @@
}
],
"version": 4
}
}
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
]
}
]
}
}
51 changes: 51 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"files.associations": {
"*.h": "c"
},
"ledgerDevTools.appSettings": {
"selectedUseCase": "release",
cedelavergne-ledger marked this conversation as resolved.
Show resolved Hide resolved
"selectedDevice": "Stax",
"selectedVariant": "nbgl_test",
"testsList": [
"test_app_mainmenu",
"test_generic_settings",
"test_generic_config",
"test_app_name",
"test_confirm",
"test_app_demo_flow_send_BTC",
"test_app_demo_flow_swap_1inch",
"test_app_demo_flow_BS_stake",
"test_app_demo_flow_SOL_receive",
"test_bad_cla",
"test_bad_ins",
"test_wrong_p1p2",
"test_wrong_data_length",
"test_keypad",
"test_keypad",
"test_get_app_and_version",
"test_navigation",
"test_navigation",
"test_navigation",
"test_navigation",
"test_navigation",
"test_spinner",
"test_use_case_address_review_accepted",
"test_use_case_long_address_review_accepted",
"test_use_case_long_address_review_accepted_with_tags",
"test_use_case_static_review_accepted",
"test_use_case_static_review_refused",
"test_use_case_light_review_accepted",
"test_use_case_light_review_refused",
"test_use_case_review_accepted",
"test_use_case_blind_signed_review_accepted",
"test_use_case_blind_signed_review_display_warning",
"test_use_case_review_refused",
"test_use_case_generic_review",
"test_use_case_streaming_review_accepted",
"test_use_case_blind_signed_streaming_review_accepted",
"test_use_case_streaming_review_accepted_with_more",
"test_use_case_streaming_review_refused",
"test_version"
]
}
}
7 changes: 7 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
extends: default

rules:
document-start: disable
line-length: disable
truthy: disable
Loading
Loading