From 480e40ae28999ed40e092ca53d9efeb8f7276061 Mon Sep 17 00:00:00 2001 From: Francois Beutin Date: Thu, 9 Nov 2023 14:34:08 +0100 Subject: [PATCH 1/2] Rationalize CI --- .github/workflows/auto-author-assign.yml | 1 + .github/workflows/build-workflow.yml | 34 ---------- .github/workflows/ci-workflow.yml | 84 +++++++++++++++--------- .github/workflows/lint-workflow.yml | 36 +++++----- .github/workflows/sdk-generation.yml | 1 + .github/workflows/swap-ci-workflow.yml | 5 +- 6 files changed, 75 insertions(+), 86 deletions(-) delete mode 100644 .github/workflows/build-workflow.yml diff --git a/.github/workflows/auto-author-assign.yml b/.github/workflows/auto-author-assign.yml index a6255c9ef..82adf1738 100644 --- a/.github/workflows/auto-author-assign.yml +++ b/.github/workflows/auto-author-assign.yml @@ -1,3 +1,4 @@ +--- name: 'Auto Author Assign' on: diff --git a/.github/workflows/build-workflow.yml b/.github/workflows/build-workflow.yml deleted file mode 100644 index 1eb105d87..000000000 --- a/.github/workflows/build-workflow.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Compilation - -on: - push: - branches: - - master - pull_request: - branches: - - master - - develop - workflow_dispatch: - -jobs: - nano_release_build: - name: Build release application for NanoS, X and S+ - strategy: - matrix: - sdk: ["$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK"] - 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: Build Ethereum - run: | - make -j BOLOS_SDK=${{ matrix.sdk }} - - - name: Build an altcoin - run: | - make clean - make -j BOLOS_SDK=${{ matrix.sdk }} CHAIN=polygon diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 4700a0cb5..a15a89615 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -1,39 +1,19 @@ +--- name: Tests on: + workflow_dispatch: push: - branches: - - master - pull_request: branches: - master - develop - workflow_dispatch: + pull_request: jobs: - scan-build: - name: Clang Static Analyzer - runs-on: ubuntu-latest - container: - image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-lite:latest - steps: - - uses: actions/checkout@v3 - - - 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@v3 - if: failure() - with: - name: scan-build - path: scan-build - -# ===================================================== -# ZEMU TESTS -# ===================================================== + # ===================================================== + # ZEMU TESTS + # ===================================================== building_for_e2e_zemu_tests: name: Building binaries for E2E Zemu tests @@ -97,9 +77,9 @@ jobs: - name: Run zemu tests run: cd tests/zemu/ && yarn test -# ===================================================== -# SPECULOS TESTS -# ===================================================== + # ===================================================== + # SPECULOS TESTS + # ===================================================== building_for_e2e_speculos_tests: @@ -162,9 +142,9 @@ jobs: pytest --model ${{ matrix.model }} --path ./elfs/${{ matrix.model }}.elf --display headless -# ===================================================== -# RAGGER TESTS -# ===================================================== + # ===================================================== + # RAGGER TESTS + # ===================================================== build_ragger_elfs: name: Build app for Ragger tests @@ -180,3 +160,43 @@ jobs: with: download_app_binaries_artifact: "ragger_elfs" test_dir: tests/ragger + + # ===================================================== + # STATIC ANALYSIS + # ===================================================== + + # Static analysis on the main ETH chain is covered by the guidelines enforcer + scan-build: + name: Clang Static Analyzer on altcoin + runs-on: ubuntu-latest + container: + image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest + strategy: + fail-fast: false + matrix: + device: ["nanos", "nanos2", "nanox", "stax"] + + steps: + - name: Clone + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Build with Clang Static Analyzer + run: | + eval "BOLOS_SDK=\$$(echo ${{ matrix.device }} | tr [:lower:] [:upper:])_SDK" && \ + echo "BOLOS_SDK value will be: ${BOLOS_SDK}" && \ + make -j ENABLE_SDK_WERROR=1 BOLOS_SDK=${BOLOS_SDK} CHAIN=polygon scan-build + + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: scan-build + path: scan-build + + - name: Upload scan result + if: failure() + uses: actions/upload-artifact@v3 + with: + name: scan-build + path: scan-build diff --git a/.github/workflows/lint-workflow.yml b/.github/workflows/lint-workflow.yml index 7b980758e..ca32687e5 100644 --- a/.github/workflows/lint-workflow.yml +++ b/.github/workflows/lint-workflow.yml @@ -1,26 +1,26 @@ +--- name: Code style check +# 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: - - master + - master + - main + - develop pull_request: - branches: - - master - - develop jobs: - job_lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - name: Clone - uses: actions/checkout@v3 - - - name: Lint - uses: DoozyX/clang-format-lint-action@v0.14 - with: - source: "./" - extensions: "h,c" - clangFormatVersion: 12.0.1 + check_linting: + name: Check linting using the reusable workflow + uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1 + with: + source: './' + extensions: 'h,c' + version: 12 diff --git a/.github/workflows/sdk-generation.yml b/.github/workflows/sdk-generation.yml index 9d26eb31a..b563e0f7c 100644 --- a/.github/workflows/sdk-generation.yml +++ b/.github/workflows/sdk-generation.yml @@ -1,3 +1,4 @@ +--- name: Updating the SDK on: diff --git a/.github/workflows/swap-ci-workflow.yml b/.github/workflows/swap-ci-workflow.yml index 3999224cf..022fe5a02 100644 --- a/.github/workflows/swap-ci-workflow.yml +++ b/.github/workflows/swap-ci-workflow.yml @@ -1,11 +1,12 @@ +--- name: Swap functional tests on: workflow_dispatch: push: branches: - - master - - develop + - master + - develop pull_request: jobs: From e45a0f7eb569d3c224dc5767066f60b1c7bf37f6 Mon Sep 17 00:00:00 2001 From: Francois Beutin Date: Thu, 9 Nov 2023 14:35:33 +0100 Subject: [PATCH 2/2] Fix lint issue --- src/eth_plugin_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eth_plugin_internal.h b/src/eth_plugin_internal.h index 956cec4b8..f7031eca5 100644 --- a/src/eth_plugin_internal.h +++ b/src/eth_plugin_internal.h @@ -21,7 +21,7 @@ bool U2BE_from_parameter(const uint8_t* parameter, uint16_t* value); bool U4BE_from_parameter(const uint8_t* parameter, uint32_t* value); typedef bool (*PluginAvailableCheck)(void); -typedef void (*PluginCall)(int, void *); +typedef void (*PluginCall)(int, void*); typedef struct internalEthPlugin_t { PluginAvailableCheck availableCheck;