Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/_check_icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ on:
description: 'The name of the artifact containing the built manifest'
required: true
type: string
run_for_devices:
description: 'The list of device(s) on which the checking will run'
required: true
type: string

jobs:
check_icons:
name: Check icons
strategy:
fail-fast: false
matrix:
device: ${{ fromJSON(inputs.run_for_devices) }}
runs-on: ubuntu-22.04

steps:
Expand All @@ -50,5 +58,5 @@ jobs:

- name: Run script
run: |
./ledger-app-workflows/scripts/check_all.sh -c icons \
./ledger-app-workflows/scripts/check_all.sh -c icons -t ${{ matrix.device }} \
-a ./app-repository -m ${{ inputs.download_manifest_artifact_name }}
10 changes: 9 additions & 1 deletion .github/workflows/_check_makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ on:
description: 'The name of the artifact containing the built manifest'
required: true
type: string
run_for_devices:
description: 'The list of device(s) on which the checking will run'
required: true
type: string

jobs:
check_makefile:
name: Check Makefile
strategy:
fail-fast: false
matrix:
device: ${{ fromJSON(inputs.run_for_devices) }}
runs-on: ubuntu-22.04

steps:
Expand All @@ -50,5 +58,5 @@ jobs:

- name: Run script
run: |
./ledger-app-workflows/scripts/check_all.sh -c makefile \
./ledger-app-workflows/scripts/check_all.sh -c makefile -t ${{ matrix.device }} \
-a ./app-repository -m ${{ inputs.download_manifest_artifact_name }}
6 changes: 4 additions & 2 deletions .github/workflows/reusable_guidelines_enforcer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ jobs:

call_check_icons:
name: Dispatch check
needs: [call_get_workflow_version, call_get_app_manifest]
needs: [call_get_app_metadata, call_get_workflow_version, call_get_app_manifest]
uses: ./.github/workflows/_check_icons.yml
with:
app-repository: ${{ inputs.app_repository }}
download_manifest_artifact_name: manifests
ledger-app-workflows_ref: ${{ needs.call_get_workflow_version.outputs.version }}
run_for_devices: ${{ needs.call_get_app_metadata.outputs.compatible_devices }}

call_check_app_load_params:
name: Dispatch check
Expand All @@ -77,12 +78,13 @@ jobs:

call_check_makefile:
name: Dispatch check
needs: [call_get_workflow_version, call_get_app_manifest]
needs: [call_get_app_metadata, call_get_workflow_version, call_get_app_manifest]
uses: ./.github/workflows/_check_makefile.yml
with:
app-repository: ${{ inputs.app_repository }}
download_manifest_artifact_name: manifests
ledger-app-workflows_ref: ${{ needs.call_get_workflow_version.outputs.version }}
run_for_devices: ${{ needs.call_get_app_metadata.outputs.compatible_devices }}

call_check_readme:
name: Dispatch check
Expand Down
39 changes: 32 additions & 7 deletions .github/workflows/reusable_python_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,17 @@ jobs:
if: ${{ inputs.run_linter == 'pylint' }}
runs-on: ubuntu-latest
steps:
- name: Installing requiered packages
run: |
if [ -n "${{ inputs.additional_packages }}" ]; then
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_packages }}
fi

- name: Clone
uses: actions/checkout@v4

- name: Installing PIP dependencies
run: |
if [ -n "${{ inputs.additional_packages }}" ]; then
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_packages }}
fi
pip install pylint
if [ -n "${{ inputs.req_directory }}" ] && [ -f "${{ inputs.req_directory }}/requirements.txt" ]; then
pip install -r ${{ inputs.req_directory }}/requirements.txt
Expand All @@ -56,8 +59,11 @@ jobs:
- name: Lint Python code
run: |
ARGS=(-j 0)
if [ -n "${{ inputs.setup_directory }}" ] && [ -f "${{ inputs.setup_directory }}/setup.cfg" ]; then
ARGS+=(--rcfile "${{ inputs.setup_directory }}/setup.cfg")
if [ -n "${{ inputs.setup_directory }}" ]; then
cd ${{ inputs.setup_directory }}
fi
if [ -f "./setup.cfg" ]; then
ARGS+=(--rcfile "./setup.cfg")
fi
pylint "${ARGS[@]}" ${{ inputs.src_directory }}

Expand All @@ -66,6 +72,12 @@ jobs:
if: ${{ inputs.run_linter == 'flake8' }}
runs-on: ubuntu-latest
steps:
- name: Installing requiered packages
run: |
if [ -n "${{ inputs.additional_packages }}" ]; then
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_packages }}
fi

- name: Clone
uses: actions/checkout@v4

Expand All @@ -78,13 +90,22 @@ jobs:

- name: Lint Python code
run: |
cd ${{ inputs.setup_directory }} && flake8 ${{ inputs.src_directory }}
if [ -n "${{ inputs.setup_directory }}" ]; then
cd ${{ inputs.setup_directory }}
fi
flake8 ${{ inputs.src_directory }}

mypy:
name: Type checking
if: ${{ inputs.run_type_check == true }}
runs-on: ubuntu-latest
steps:
- name: Installing requiered packages
run: |
if [ -n "${{ inputs.additional_packages }}" ]; then
sudo apt-get update && sudo apt-get install -y ${{ inputs.additional_packages }}
fi

- name: Clone
uses: actions/checkout@v4

Expand All @@ -96,4 +117,8 @@ jobs:
fi

- name: Mypy type checking
run: mypy ${{ inputs.src_directory }}
run: |
if [ -n "${{ inputs.setup_directory }}" ]; then
cd ${{ inputs.setup_directory }}
fi
mypy ${{ inputs.src_directory }}
4 changes: 2 additions & 2 deletions scripts/check_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@ call_step() {
fi
;;
"icons")
COMMAND="${dirName}/check_icons.sh ${APP_DIR} ${REPO_NAME} ${MANIFEST_DIR}"
COMMAND="${dirName}/check_icons.sh ${APP_DIR} ${REPO_NAME} ${MANIFEST_DIR} ${TARGET}"
;;
"app_load_params")
COMMAND="python3 ${DATABASE_DIR}/scripts/app_load_params_check.py --database_path ${DATABASE_DIR}/app-load-params-db.json --app_manifests_path ${MANIFEST_DIR}"
;;
"makefile")
COMMAND="${dirName}/check_makefile.sh ${APP_DIR} ${REPO_NAME} ${MANIFEST_DIR}"
COMMAND="${dirName}/check_makefile.sh ${APP_DIR} ${REPO_NAME} ${MANIFEST_DIR} ${TARGET}"
;;
"readme")
COMMAND="${dirName}/check_readme.sh ${APP_DIR} ${REPO_NAME}"
Expand Down
8 changes: 7 additions & 1 deletion scripts/check_icons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ check_glyph() (
colors_nb=$(echo "$content" | grep "Colors: " | rev | cut -d' ' -f1 | rev)
if [[ "$colors_nb" -gt 16 ]]; then
log_error "4bpp glyphs can't have more than 16 colors, $colors_nb found"
error=1
fi

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

all_glyph_files=""
declare -A icons_and_devices

# Parse all manifest files
manifests_list=$(find "$manifests_dir" -type f -name "*.json")
if [[ -n "${target}" ]]; then
manifests_list="${manifests_dir}/manifest_${target}.json"
else
manifests_list=$(find "$manifests_dir" -type f -name "*.json")
fi
while IFS= read -r manifest; do
log_info "Checking manifest $manifest"

Expand Down
7 changes: 6 additions & 1 deletion scripts/check_makefile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ main() (
repo="$1"
repo_name="$2"
manifests_dir="$3"
target="$4"

declare -A variants_array
declare -A appnames_array
Expand All @@ -22,7 +23,11 @@ main() (
fi

# Parse all manifest files
manifests_list=$(find "$manifests_dir" -type f -name "*.json")
if [[ -n "${target}" ]]; then
manifests_list="${manifests_dir}/manifest_${target}.json"
else
manifests_list=$(find "$manifests_dir" -type f -name "*.json")
fi
while IFS= read -r manifest; do
log_info "Checking manifest $manifest"

Expand Down
Loading