diff --git a/.github/workflows/_check_icons.yml b/.github/workflows/_check_icons.yml index 858a96e..2d7020d 100644 --- a/.github/workflows/_check_icons.yml +++ b/.github/workflows/_check_icons.yml @@ -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: @@ -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 }} diff --git a/.github/workflows/_check_makefile.yml b/.github/workflows/_check_makefile.yml index 0f0df26..346ccd9 100644 --- a/.github/workflows/_check_makefile.yml +++ b/.github/workflows/_check_makefile.yml @@ -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: @@ -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 }} diff --git a/.github/workflows/reusable_guidelines_enforcer.yml b/.github/workflows/reusable_guidelines_enforcer.yml index 16bf144..e3f20ad 100644 --- a/.github/workflows/reusable_guidelines_enforcer.yml +++ b/.github/workflows/reusable_guidelines_enforcer.yml @@ -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 @@ -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 diff --git a/.github/workflows/reusable_python_checks.yml b/.github/workflows/reusable_python_checks.yml index 19ef535..b41b6c8 100644 --- a/.github/workflows/reusable_python_checks.yml +++ b/.github/workflows/reusable_python_checks.yml @@ -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 @@ -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 }} @@ -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 @@ -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 @@ -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 }} diff --git a/scripts/check_all.sh b/scripts/check_all.sh index d21183f..2dd9054 100755 --- a/scripts/check_all.sh +++ b/scripts/check_all.sh @@ -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}" diff --git a/scripts/check_icons.sh b/scripts/check_icons.sh index c7a65f2..4e52c88 100755 --- a/scripts/check_icons.sh +++ b/scripts/check_icons.sh @@ -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 @@ -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" diff --git a/scripts/check_makefile.sh b/scripts/check_makefile.sh index 82c99b6..e8b80ff 100755 --- a/scripts/check_makefile.sh +++ b/scripts/check_makefile.sh @@ -10,6 +10,7 @@ main() ( repo="$1" repo_name="$2" manifests_dir="$3" + target="$4" declare -A variants_array declare -A appnames_array @@ -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"