Skip to content

Commit

Permalink
feat: edit the structure of the app
Browse files Browse the repository at this point in the history
- Separate the logic from the display
- Add the structure for nbgl display
- Add some github workflows
  • Loading branch information
keiff3r committed Feb 5, 2025
1 parent 430ac3a commit a90d59c
Show file tree
Hide file tree
Showing 29 changed files with 828 additions and 549 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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.
#
# The build part of this workflow is mandatory, this ensures that the app will be deployable in the Ledger App Store.
# While the test part of 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:
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
- 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"

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"
regenerate_snapshots: ${{ inputs.golden_run == 'Open a PR' }}
100 changes: 50 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
name: CI
# name: CI

on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# on:
# # Triggers the workflow on push or pull request events but only for the master branch
# push:
# branches: [ master, develop ]
# pull_request:
# branches: [ master, develop ]
# # Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:

jobs:
nano-build:
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
strategy:
matrix:
sdk:
- path: $NANOS_SDK
name: nanos
- path: $NANOX_SDK
name: nanox
- path: $NANOSP_SDK
name: nanosp
steps:
- uses: actions/checkout@v2
- name: Build application for SDK ${{ matrix.sdk.name }}
run: |
make clean
make BOLOS_SDK=${{ matrix.sdk.path }}
- name: Upload app binary
uses: actions/upload-artifact@v2
with:
name: app
path: bin
# jobs:
# nano-build:
# runs-on: ubuntu-latest
# container:
# image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
# strategy:
# matrix:
# sdk:
# - path: $NANOS_SDK
# name: nanos
# - path: $NANOX_SDK
# name: nanox
# - path: $NANOSP_SDK
# name: nanosp
# steps:
# - uses: actions/checkout@v2
# - name: Build application for SDK ${{ matrix.sdk.name }}
# run: |
# make clean
# make BOLOS_SDK=${{ matrix.sdk.path }}
# - name: Upload app binary
# uses: actions/upload-artifact@v2
# with:
# name: app
# path: bin

scan-build:
name: Clang Static Analyzer
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
steps:
- uses: actions/checkout@v2
- name: Build with Clang Static Analyzer
run: |
make clean
scan-build --use-cc=clang -analyze-headers -enable-checker security -enable-checker unix -enable-checker valist -o scan-build --status-bugs make default
- uses: actions/upload-artifact@v2
if: failure()
with:
name: scan-build
path: scan-build
# scan-build:
# name: Clang Static Analyzer
# runs-on: ubuntu-latest
# container:
# image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
# steps:
# - uses: actions/checkout@v2
# - name: Build with Clang Static Analyzer
# run: |
# make clean
# scan-build --use-cc=clang -analyze-headers -enable-checker security -enable-checker unix -enable-checker valist -o scan-build --status-bugs make default
# - uses: actions/upload-artifact@v2
# if: failure()
# with:
# name: scan-build
# path: scan-build
44 changes: 44 additions & 0 deletions .github/workflows/codeql_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "CodeQL"

on:
workflow_dispatch:
push:
branches:
- master
- main
- develop
pull_request:
# Excluded path: add the paths you want to ignore instead of deleting the workflow
paths-ignore:
- ".github/workflows/*.yml"
- "tests/*"

jobs:
analyse:
name: Analyse
strategy:
matrix:
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

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: security-and-quality

# CodeQL will create the database during the compilation
- name: Build
run: |
make BOLOS_SDK=${{ matrix.sdk }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
25 changes: 25 additions & 0 deletions .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run coding style check through reusable workflow

# This workflow will run linting checks to ensure a level of uniformization among all Ledger applications.
#
# The presence of this workflow is mandatory as a minimal level of linting is required.
# You are however free to modify the content of the .clang-format file and thus the coding style of your application.
# We simply ask you to not diverge too much from the linting of the Concordium application.

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'
extensions: 'h,c'
version: 11
29 changes: 29 additions & 0 deletions .github/workflows/documentation_generation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Generate project documentation

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

jobs:
job_generate_doc:
name: Generate project documentation
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest

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

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

- uses: actions/upload-artifact@v3
with:
name: documentation
path: doc/html
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@v1
with:
builtin: clear,rare
check_filenames: true
skip: "*.ai,submission_graphics/*,./.git"
44 changes: 44 additions & 0 deletions .github/workflows/python_client_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Checks on the Python client

# This workflow performs some checks on the Python client used by the Concordium 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: Concordium 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/
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/
60 changes: 60 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Unit testing with Codecov coverage checking

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

jobs:
job_unit_test:
name: Unit test
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest

steps:

- name: Clone
uses: actions/checkout@v3

- name: Clone SDK
uses: actions/checkout@v3
with:
repository: ledgerHQ/ledger-secure-sdk
path: sdk

- name: Build unit tests
run: |
cd unit-tests/
export BOLOS_SDK=../sdk
cmake -Bbuild -H. && make -C build && make -C build test
- name: Generate code coverage
run: |
cd unit-tests/
lcov --directory . -b "$(realpath build/)" --capture --initial -o coverage.base && \
lcov --rc lcov_branch_coverage=1 --directory . -b "$(realpath build/)" --capture -o coverage.capture && \
lcov --directory . -b "$(realpath build/)" --add-tracefile coverage.base --add-tracefile coverage.capture -o coverage.info && \
lcov --directory . -b "$(realpath build/)" --remove coverage.info '*/unit-tests/*' -o coverage.info && \
genhtml coverage.info -o coverage
- uses: actions/upload-artifact@v3
with:
name: code-coverage
path: unit-tests/coverage

- name: Upload to codecov.io
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./unit-tests/coverage.info
flags: unittests
name: codecov-app-concordium
fail_ci_if_error: true
verbose: true
env:
CODECOV_DEBUG: true
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ endif
APP_LOAD_PARAMS += $(COMMON_LOAD_PARAMS)

# Pending review parameters
APP_LOAD_PARAMS += --tlvraw 9F:01
DEFINES += HAVE_PENDING_REVIEW_SCREEN
# APP_LOAD_PARAMS += --tlvraw 9F:01
# DEFINES += HAVE_PENDING_REVIEW_SCREEN

##################
# Define Version #
Expand Down
Loading

0 comments on commit a90d59c

Please sign in to comment.