Skip to content

Commit

Permalink
Add update the CI and the Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
spalmer25 committed Oct 24, 2023
1 parent 4c046f2 commit 6f46286
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 4 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,35 @@ jobs:
path: app_${{ matrix.device }}_dbg.tgz
name: app_${{ matrix.device }}_dbg.tgz

baking_build_app:
name: Build baking application
strategy:
matrix:
device: [nanos, nanosp, nanox, stax]
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:3.8.0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
DEVICE_SDK="$(echo ${{ matrix.device }} | tr a-z A-Z)_SDK"
bash -c "make -C app_baking BOLOS_SDK=\$${DEVICE_SDK}"
tar -C app_baking/bin -czf app_baking_${{ matrix.device }}.tgz .
bash -c "make -C app_baking BOLOS_SDK=\$${DEVICE_SDK} DEBUG=1"
tar -C app_baking/bin -czf app_baking_${{ matrix.device }}_dbg.tgz .
- name: Upload
uses: actions/upload-artifact@v3
with:
path: app_baking_${{ matrix.device }}.tgz
name: app_baking_${{ matrix.device }}.tgz
- name: Upload (dbg)
uses: actions/upload-artifact@v3
with:
path: app_baking_${{ matrix.device }}_dbg.tgz
name: app_baking_${{ matrix.device }}_dbg.tgz

build_docker_integration_tests:
uses: ./.github/workflows/docker.yml
secrets: inherit
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/codeql_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,33 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

baking_analyse:
name: Analyse for the baking app
strategy:
matrix:
sdk: [ "$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_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 }} -C app_baking
make BOLOS_SDK=${{ matrix.sdk }} -C app_baking DEBUG=1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
8 changes: 8 additions & 0 deletions .github/workflows/coding_style_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ jobs:
source: './app/src'
extensions: 'h,c'
version: 15

baking_check_linting:
name: Check linting using the reusable workflow for the baking app
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
with:
source: './app_baking/src'
extensions: 'h,c'
version: 15
6 changes: 6 additions & 0 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ jobs:
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
with:
relative_app_directory: app

baking_guidelines_enforcer:
name: Call Ledger guidelines_enforcer for the baking app
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
with:
relative_app_directory: app_baking
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
/app/bin
/app/build
/app/debug
/app_baking/bin
/app_baking/build
/app_baking/debug
/app/dep
/app/obj
/app/output-scan-build/
Expand Down
39 changes: 35 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
# Makefile
#

all: app_nanos.tgz app_nanosp.tgz app_nanox.tgz
debug: app_nanos_dbg.tgz app_nanosp_dbg.tgz app_nanox_dbg.tgz
all: wallet baking
debug: wallet_debug baking_debug

wallet: app_nanos.tgz app_nanosp.tgz app_nanox.tgz app_stax.tgz
wallet_debug: app_nanos_dbg.tgz app_nanosp_dbg.tgz app_nanox_dbg.tgz app_stax_dbg.tgz

baking: app_baking_nanos.tgz app_baking_nanosp.tgz app_baking_nanox.tgz app_baking_stax.tgz
baking_debug: app_baking_nanos_dbg.tgz app_baking_nanosp_dbg.tgz app_baking_nanox_dbg.tgz app_baking_stax_dbg.tgz

.PHONY: clean all debug integration_tests unit_tests scan-build% \
integration_tests_basic integration_tests_basic_% docker_%
Expand Down Expand Up @@ -45,8 +51,18 @@ scan-build-%:
$(DOCKER_RUN_APP_BUILDER) bash -c \
"BOLOS_SDK=\$$$$SDK make -C app scan-build"

scan-build: scan-build-nanos scan-build-nanosp \
scan-build-nanox scan-build-stax
scan-build_baking-%:
SDK=$(shell echo $@ | sed 's/scan-build_baking-\(.*\)/\U\1/')_SDK; \
$(DOCKER_RUN_APP_BUILDER) bash -c \
"BOLOS_SDK=\$$$$SDK make -C app_baking scan-build"

scan-build_wallet: scan-build-nanos scan-build-nanosp \
scan-build-nanox scan-build-stax

scan-build_baking: scan-build_baking-nanos scan-build_baking-nanosp \
scan-build_baking-nanox scan-build_baking-stax

scan-build: scan-build_wallet scan-build_baking

app_%.tgz: app/src/*.[ch] \
app/src/parser/*.[ch] \
Expand All @@ -56,6 +72,13 @@ app_%.tgz: app/src/*.[ch] \
"BOLOS_SDK=\$$$$SDK make -C app"
$(DOCKER_RUN_APP_BUILDER) bash -c "cd app/bin/ && tar cz ." > $@

app_baking_%.tgz: app_baking/src/*.[ch] \
app_baking/Makefile
SDK=$(shell echo $@ | sed 's/app_baking_\(.*\).tgz/\U\1/')_SDK; \
$(DOCKER_RUN_APP_BUILDER) bash -c \
"BOLOS_SDK=\$$$$SDK make -C app_baking"
$(DOCKER_RUN_APP_BUILDER) bash -c "cd app_baking/bin/ && tar cz ." > $@

app_%_dbg.tgz: app/src/*.[ch] \
app/src/parser/*.[ch] \
app/Makefile
Expand All @@ -64,9 +87,17 @@ app_%_dbg.tgz: app/src/*.[ch] \
"BOLOS_SDK=\$$$$SDK make -C app DEBUG=1"
$(DOCKER_RUN_APP_BUILDER) bash -c "cd app/bin/ && tar cz ." > $@

app_baking_%_dbg.tgz: app_baking/src/*.[ch] \
app_baking/Makefile
SDK=$(shell echo $@ | sed 's/app_baking_\(.*\)_dbg.tgz/\U\1/')_SDK; \
$(DOCKER_RUN_APP_BUILDER) bash -c \
"BOLOS_SDK=\$$$$SDK make -C app_baking DEBUG=1"
$(DOCKER_RUN_APP_BUILDER) bash -c "cd app_baking/bin/ && tar cz ." > $@

clean:
rm -rf bin app_*.tgz
$(DOCKER_RUN_APP_BUILDER) make -C app mrproper
$(DOCKER_RUN_APP_BUILDER) make -C app_baking clean
$(DOCKER_RUN_APP_OCAML) bash -c "make -C /app/tests/generate clean && cd /app && rm -rf _build"

unit_tests: test/samples/micheline/nano/samples.hex \
Expand Down

0 comments on commit 6f46286

Please sign in to comment.