Skip to content

Commit

Permalink
Merge pull request #4 from Solar-network/main
Browse files Browse the repository at this point in the history
chore: merge upstream 1.1.3 release
  • Loading branch information
sgliner-ledger authored Aug 23, 2023
2 parents ea8ef05 + 1ff7f87 commit b138244
Show file tree
Hide file tree
Showing 646 changed files with 3,161 additions and 7,002 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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:
- main
- develop
pull_request:
branches:
- main
- develop
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"
run_for_devices: '["nanos", "nanox", "nanosp"]'

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"
test_dir: tests/functional
run_for_devices: '["nanos", "nanox", "nanosp"]'
138 changes: 16 additions & 122 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Compilation & tests
name: Compilation of build artifacts

on:
workflow_dispatch:
Expand All @@ -16,14 +16,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Parse short sha
uses: benjlevesque/short-sha@v1.2
uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 7
outputs:
sha7: ${{ steps.short-sha.outputs.sha }}

job_nanoS_build:
job_nanos_build:
name: Build for the Nano S
runs-on: ubuntu-latest
needs: prepare
Expand All @@ -33,40 +33,18 @@ jobs:

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

- name: Build
run: |
make
- name: Upload app binary
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: app-solar-nanos-${{ needs.prepare.outputs.sha7 }}
path: bin

job_nanox_build:
name: Build for the Nano X
runs-on: ubuntu-latest
needs: prepare

container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest

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

- name: Build
run: |
make BOLOS_SDK=$NANOX_SDK
- name: Upload app binary
uses: actions/upload-artifact@v2
with:
name: app-solar-nanox-${{ needs.prepare.outputs.sha7 }}
path: bin

job_nanosp_build:
name: Build for the Nano S Plus
runs-on: ubuntu-latest
Expand All @@ -77,81 +55,20 @@ jobs:

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

- name: Build
run: |
make BOLOS_SDK=$NANOSP_SDK
- name: Upload app binary
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: app-solar-nanosp-${{ needs.prepare.outputs.sha7 }}
path: bin

job_scan_build:
name: Clang Static Analyser
runs-on: ubuntu-latest
needs: job_nanos_build

container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest

steps:
- uses: actions/checkout@v2

- name: Build with Clang Static Analyser
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

job_unit_test:
name: Unit test
runs-on: ubuntu-latest

container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest

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

- name: Build unit tests
run: |
cd tests/unit-tests/
cmake -Bbuild -H. && make -C build && make -C build test
- name: Generate code coverage
run: |
cd tests/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@v2
with:
name: code-coverage
path: tests/unit-tests/coverage

- name: Upload to codecov.io
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/unit-tests/coverage.info
flags: unittests
name: codecov-app-solar
fail_ci_if_error: true
verbose: true

job_generate_doc:
name: Generate project documentation
job_nanox_build:
name: Build for the Nano X
runs-on: ubuntu-latest
needs: prepare

Expand All @@ -160,37 +77,14 @@ jobs:

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

- name: HTML documentation
run: doxygen .doxygen/Doxyfile
uses: actions/checkout@v3

- uses: actions/upload-artifact@v2
with:
name: app-solar-docs-${{ needs.prepare.outputs.sha7 }}
path: doc/html

job_functional:
name: Functional tests using Speculos
runs-on: ubuntu-latest
needs: [prepare, job_nanos_build]

steps:
- name: Clone
uses: actions/checkout@v2
- name: Build
run: |
make BOLOS_SDK=$NANOX_SDK
- name: Download app binary
uses: actions/download-artifact@v2
- name: Upload app binary
uses: actions/upload-artifact@v3
with:
name: app-solar-nanos-${{ needs.prepare.outputs.sha7 }}
name: app-solar-nanox-${{ needs.prepare.outputs.sha7 }}
path: bin

- name: Install tests dependencies
run: |
sudo apt-get update && sudo apt-get install -y qemu-user-static
pip install --extra-index-url https://test.pypi.org/simple/ -r tests/functional/requirements.txt
- name: Run test
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: pytest tests/functional/ --headless
46 changes: 46 additions & 0 deletions .github/workflows/codeql_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "CodeQL"

on:
workflow_dispatch:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
# 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: [ "$NANOS_SDK", "$NANOX_SDK", "$NANOSP_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
26 changes: 26 additions & 0 deletions .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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 Boilerplate application.

on:
workflow_dispatch:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
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
31 changes: 31 additions & 0 deletions .github/workflows/documentation_generation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Generate project documentation

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

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: app-solar-docs
path: doc/html
26 changes: 26 additions & 0 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
with:
run_for_devices: '["nanos", "nanosp", "nanox"]'
27 changes: 0 additions & 27 deletions .github/workflows/lint-workflow.yml

This file was deleted.

Loading

0 comments on commit b138244

Please sign in to comment.