Skip to content

Commit bca308c

Browse files
Merge pull request #141 from LedgerHQ/cev/icon_matrix
Small improvements
2 parents 7e08867 + a42d392 commit bca308c

File tree

7 files changed

+69
-15
lines changed

7 files changed

+69
-15
lines changed

.github/workflows/_check_icons.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ on:
2121
description: 'The name of the artifact containing the built manifest'
2222
required: true
2323
type: string
24+
run_for_devices:
25+
description: 'The list of device(s) on which the checking will run'
26+
required: true
27+
type: string
2428

2529
jobs:
2630
check_icons:
2731
name: Check icons
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
device: ${{ fromJSON(inputs.run_for_devices) }}
2836
runs-on: ubuntu-22.04
2937

3038
steps:
@@ -50,5 +58,5 @@ jobs:
5058

5159
- name: Run script
5260
run: |
53-
./ledger-app-workflows/scripts/check_all.sh -c icons \
61+
./ledger-app-workflows/scripts/check_all.sh -c icons -t ${{ matrix.device }} \
5462
-a ./app-repository -m ${{ inputs.download_manifest_artifact_name }}

.github/workflows/_check_makefile.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ on:
2121
description: 'The name of the artifact containing the built manifest'
2222
required: true
2323
type: string
24+
run_for_devices:
25+
description: 'The list of device(s) on which the checking will run'
26+
required: true
27+
type: string
2428

2529
jobs:
2630
check_makefile:
2731
name: Check Makefile
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
device: ${{ fromJSON(inputs.run_for_devices) }}
2836
runs-on: ubuntu-22.04
2937

3038
steps:
@@ -50,5 +58,5 @@ jobs:
5058

5159
- name: Run script
5260
run: |
53-
./ledger-app-workflows/scripts/check_all.sh -c makefile \
61+
./ledger-app-workflows/scripts/check_all.sh -c makefile -t ${{ matrix.device }} \
5462
-a ./app-repository -m ${{ inputs.download_manifest_artifact_name }}

.github/workflows/reusable_guidelines_enforcer.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ jobs:
6060

6161
call_check_icons:
6262
name: Dispatch check
63-
needs: [call_get_workflow_version, call_get_app_manifest]
63+
needs: [call_get_app_metadata, call_get_workflow_version, call_get_app_manifest]
6464
uses: ./.github/workflows/_check_icons.yml
6565
with:
6666
app-repository: ${{ inputs.app_repository }}
6767
download_manifest_artifact_name: manifests
6868
ledger-app-workflows_ref: ${{ needs.call_get_workflow_version.outputs.version }}
69+
run_for_devices: ${{ needs.call_get_app_metadata.outputs.compatible_devices }}
6970

7071
call_check_app_load_params:
7172
name: Dispatch check
@@ -77,12 +78,13 @@ jobs:
7778

7879
call_check_makefile:
7980
name: Dispatch check
80-
needs: [call_get_workflow_version, call_get_app_manifest]
81+
needs: [call_get_app_metadata, call_get_workflow_version, call_get_app_manifest]
8182
uses: ./.github/workflows/_check_makefile.yml
8283
with:
8384
app-repository: ${{ inputs.app_repository }}
8485
download_manifest_artifact_name: manifests
8586
ledger-app-workflows_ref: ${{ needs.call_get_workflow_version.outputs.version }}
87+
run_for_devices: ${{ needs.call_get_app_metadata.outputs.compatible_devices }}
8688

8789
call_check_readme:
8890
name: Dispatch check

.github/workflows/reusable_python_checks.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,17 @@ jobs:
4040
if: ${{ inputs.run_linter == 'pylint' }}
4141
runs-on: ubuntu-latest
4242
steps:
43+
- name: Installing requiered packages
44+
run: |
45+
if [ -n "${{ inputs.additional_packages }}" ]; then
46+
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_packages }}
47+
fi
48+
4349
- name: Clone
4450
uses: actions/checkout@v4
4551

4652
- name: Installing PIP dependencies
4753
run: |
48-
if [ -n "${{ inputs.additional_packages }}" ]; then
49-
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_packages }}
50-
fi
5154
pip install pylint
5255
if [ -n "${{ inputs.req_directory }}" ] && [ -f "${{ inputs.req_directory }}/requirements.txt" ]; then
5356
pip install -r ${{ inputs.req_directory }}/requirements.txt
@@ -56,8 +59,11 @@ jobs:
5659
- name: Lint Python code
5760
run: |
5861
ARGS=(-j 0)
59-
if [ -n "${{ inputs.setup_directory }}" ] && [ -f "${{ inputs.setup_directory }}/setup.cfg" ]; then
60-
ARGS+=(--rcfile "${{ inputs.setup_directory }}/setup.cfg")
62+
if [ -n "${{ inputs.setup_directory }}" ]; then
63+
cd ${{ inputs.setup_directory }}
64+
fi
65+
if [ -f "./setup.cfg" ]; then
66+
ARGS+=(--rcfile "./setup.cfg")
6167
fi
6268
pylint "${ARGS[@]}" ${{ inputs.src_directory }}
6369
@@ -66,6 +72,12 @@ jobs:
6672
if: ${{ inputs.run_linter == 'flake8' }}
6773
runs-on: ubuntu-latest
6874
steps:
75+
- name: Installing requiered packages
76+
run: |
77+
if [ -n "${{ inputs.additional_packages }}" ]; then
78+
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_packages }}
79+
fi
80+
6981
- name: Clone
7082
uses: actions/checkout@v4
7183

@@ -78,13 +90,22 @@ jobs:
7890
7991
- name: Lint Python code
8092
run: |
81-
cd ${{ inputs.setup_directory }} && flake8 ${{ inputs.src_directory }}
93+
if [ -n "${{ inputs.setup_directory }}" ]; then
94+
cd ${{ inputs.setup_directory }}
95+
fi
96+
flake8 ${{ inputs.src_directory }}
8297
8398
mypy:
8499
name: Type checking
85100
if: ${{ inputs.run_type_check == true }}
86101
runs-on: ubuntu-latest
87102
steps:
103+
- name: Installing requiered packages
104+
run: |
105+
if [ -n "${{ inputs.additional_packages }}" ]; then
106+
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_packages }}
107+
fi
108+
88109
- name: Clone
89110
uses: actions/checkout@v4
90111

@@ -96,4 +117,8 @@ jobs:
96117
fi
97118
98119
- name: Mypy type checking
99-
run: mypy ${{ inputs.src_directory }}
120+
run: |
121+
if [ -n "${{ inputs.setup_directory }}" ]; then
122+
cd ${{ inputs.setup_directory }}
123+
fi
124+
mypy ${{ inputs.src_directory }}

scripts/check_all.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,13 @@ call_step() {
198198
fi
199199
;;
200200
"icons")
201-
COMMAND="${dirName}/check_icons.sh ${APP_DIR} ${REPO_NAME} ${MANIFEST_DIR}"
201+
COMMAND="${dirName}/check_icons.sh ${APP_DIR} ${REPO_NAME} ${MANIFEST_DIR} ${TARGET}"
202202
;;
203203
"app_load_params")
204204
COMMAND="python3 ${DATABASE_DIR}/scripts/app_load_params_check.py --database_path ${DATABASE_DIR}/app-load-params-db.json --app_manifests_path ${MANIFEST_DIR}"
205205
;;
206206
"makefile")
207-
COMMAND="${dirName}/check_makefile.sh ${APP_DIR} ${REPO_NAME} ${MANIFEST_DIR}"
207+
COMMAND="${dirName}/check_makefile.sh ${APP_DIR} ${REPO_NAME} ${MANIFEST_DIR} ${TARGET}"
208208
;;
209209
"readme")
210210
COMMAND="${dirName}/check_readme.sh ${APP_DIR} ${REPO_NAME}"

scripts/check_icons.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ check_glyph() (
9191
colors_nb=$(echo "$content" | grep "Colors: " | rev | cut -d' ' -f1 | rev)
9292
if [[ "$colors_nb" -gt 16 ]]; then
9393
log_error "4bpp glyphs can't have more than 16 colors, $colors_nb found"
94+
error=1
9495
fi
9596

9697
# Be somewhat tolerant to different possible wordings for depth "8 bit" "8-bit" "8/8 bit" etc
@@ -155,12 +156,17 @@ main() (
155156
repo="$1"
156157
repo_name="$2"
157158
manifests_dir="$3"
159+
target="$4"
158160

159161
all_glyph_files=""
160162
declare -A icons_and_devices
161163

162164
# Parse all manifest files
163-
manifests_list=$(find "$manifests_dir" -type f -name "*.json")
165+
if [[ -n "${target}" ]]; then
166+
manifests_list="${manifests_dir}/manifest_${target}.json"
167+
else
168+
manifests_list=$(find "$manifests_dir" -type f -name "*.json")
169+
fi
164170
while IFS= read -r manifest; do
165171
log_info "Checking manifest $manifest"
166172

scripts/check_makefile.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ main() (
1010
repo="$1"
1111
repo_name="$2"
1212
manifests_dir="$3"
13+
target="$4"
1314

1415
declare -A variants_array
1516
declare -A appnames_array
@@ -22,7 +23,11 @@ main() (
2223
fi
2324

2425
# Parse all manifest files
25-
manifests_list=$(find "$manifests_dir" -type f -name "*.json")
26+
if [[ -n "${target}" ]]; then
27+
manifests_list="${manifests_dir}/manifest_${target}.json"
28+
else
29+
manifests_list=$(find "$manifests_dir" -type f -name "*.json")
30+
fi
2631
while IFS= read -r manifest; do
2732
log_info "Checking manifest $manifest"
2833

0 commit comments

Comments
 (0)