diff --git a/.github/workflows/check-ci-sync.yml b/.github/workflows/check-ci-sync.yml index 0a0234a0..eccbc93e 100644 --- a/.github/workflows/check-ci-sync.yml +++ b/.github/workflows/check-ci-sync.yml @@ -40,12 +40,21 @@ jobs: version: 3.x - name: Sync files - run: task --silent ci:sync + run: | + task \ + --silent \ + ci:sync - name: Check file duplicates sync run: | git add . - if ! git diff --color --exit-code HEAD; then + + if + ! git diff \ + --color \ + --exit-code \ + HEAD + then echo "::error::File duplicates are out of sync. Please run \"task fix\"" exit 1 fi diff --git a/.github/workflows/check-clang-format.yml b/.github/workflows/check-clang-format.yml index fc8e3e5e..1cd410eb 100644 --- a/.github/workflows/check-clang-format.yml +++ b/.github/workflows/check-clang-format.yml @@ -55,7 +55,10 @@ jobs: version: 3.x - name: Validate ClangFormat configuration files - run: task --silent clang-format:validate + run: | + task \ + --silent \ + clang-format:validate check-config: runs-on: ubuntu-latest @@ -79,6 +82,7 @@ jobs: else echo "CLANG_FORMAT_VERSION=${{ github.event.inputs.clang-format-version }}" >> "$GITHUB_ENV" fi + echo "CLANG_FORMAT_INSTALL_PATH=${{ runner.temp }}/clang-format" >> "$GITHUB_ENV" echo "YQ_INSTALL_PATH=${{ runner.temp }}/yq" >> "$GITHUB_ENV" echo "WORKING_FOLDER=${{ runner.temp }}" >> "$GITHUB_ENV" @@ -95,7 +99,11 @@ jobs: - name: Install ClangFormat run: | cd "${{ env.CLANG_FORMAT_INSTALL_PATH }}" - tar --extract --file="${{ steps.download-clang-format.outputs.name }}" + + tar \ + --extract \ + --file="${{ steps.download-clang-format.outputs.name }}" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >> "$GITHUB_PATH" @@ -111,7 +119,11 @@ jobs: - name: Install yq run: | cd "${{ env.YQ_INSTALL_PATH }}" - tar --extract --file="${{ steps.download-yq.outputs.name }}" + + tar \ + --extract \ + --file="${{ steps.download-yq.outputs.name }}" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.YQ_INSTALL_PATH }}/yq" >> "$GITHUB_PATH" @@ -156,6 +168,7 @@ jobs: else echo "CLANG_FORMAT_VERSION=${{ github.event.inputs.clang-format-version }}" >> "$GITHUB_ENV" fi + echo "CLANG_FORMAT_INSTALL_PATH=${{ runner.temp }}/clang-format" >> "$GITHUB_ENV" echo "WORKING_FOLDER=${{ runner.temp }}" >> "$GITHUB_ENV" @@ -171,7 +184,11 @@ jobs: - name: Install ClangFormat run: | cd "${{ env.CLANG_FORMAT_INSTALL_PATH }}" - tar --extract --file="${{ steps.download.outputs.name }}" + + tar \ + --extract \ + --file="${{ steps.download.outputs.name }}" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >> "$GITHUB_PATH" @@ -209,7 +226,10 @@ jobs: version: 3.x - name: Check ClangFormat test data - run: task --silent clang-format:check-testdata + run: | + task \ + --silent \ + clang-format:check-testdata convert: runs-on: ubuntu-latest diff --git a/.github/workflows/check-community-health-sync.yml b/.github/workflows/check-community-health-sync.yml index 9ce4e6f0..dd19182e 100644 --- a/.github/workflows/check-community-health-sync.yml +++ b/.github/workflows/check-community-health-sync.yml @@ -46,12 +46,21 @@ jobs: version: 3.x - name: Sync files - run: task --silent github:sync + run: | + task \ + --silent \ + github:sync - name: Check file duplicates sync run: | git add . - if ! git diff --color --exit-code HEAD; then + + if + ! git diff \ + --color \ + --exit-code \ + HEAD + then echo "::error::File duplicates are out of sync. Please run \"task fix\"" exit 1 fi diff --git a/.github/workflows/check-config-sync.yml b/.github/workflows/check-config-sync.yml index d6eec459..a34669fa 100644 --- a/.github/workflows/check-config-sync.yml +++ b/.github/workflows/check-config-sync.yml @@ -32,12 +32,21 @@ jobs: version: 3.x - name: Sync files - run: task --silent config:sync + run: | + task \ + --silent \ + config:sync - name: Check file duplicates sync run: | git add . - if ! git diff --color --exit-code HEAD; then + + if + ! git diff \ + --color \ + --exit-code \ + HEAD + then echo "::error::File duplicates are out of sync. Please run \"task fix\"" exit 1 fi diff --git a/.github/workflows/check-eslint.yml b/.github/workflows/check-eslint.yml index 82672d95..aa243efe 100644 --- a/.github/workflows/check-eslint.yml +++ b/.github/workflows/check-eslint.yml @@ -45,4 +45,7 @@ jobs: version: 3.x - name: Validate workflows - run: task --silent eslint:validate + run: | + task \ + --silent \ + eslint:validate diff --git a/.github/workflows/check-files-task.yml b/.github/workflows/check-files-task.yml index 5edbc626..e737c6f6 100644 --- a/.github/workflows/check-files-task.yml +++ b/.github/workflows/check-files-task.yml @@ -55,7 +55,10 @@ jobs: version: 3.x - name: Check filenames - run: task --silent general:check-filenames + run: | + task \ + --silent \ + general:check-filenames check-symlinks: needs: run-determination @@ -75,4 +78,7 @@ jobs: version: 3.x - name: Check symlinks - run: task --silent general:check-symlinks + run: | + task \ + --silent \ + general:check-symlinks diff --git a/.github/workflows/check-general-formatting-task.yml b/.github/workflows/check-general-formatting-task.yml index 6658d67f..a8e2d798 100644 --- a/.github/workflows/check-general-formatting-task.yml +++ b/.github/workflows/check-general-formatting-task.yml @@ -71,12 +71,22 @@ jobs: - name: Install editorconfig-checker run: | cd "${{ env.EC_INSTALL_PATH }}" - tar --extract --file="${{ steps.download.outputs.name }}" + + tar \ + --extract \ + --file="${{ steps.download.outputs.name }}" + # Give the binary a standard name - mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec" + mv \ + "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" \ + "${{ env.EC_INSTALL_PATH }}/bin/ec" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH" - name: Check formatting - run: task --silent general:check-formatting + run: | + task \ + --silent \ + general:check-formatting diff --git a/.github/workflows/check-license.yml b/.github/workflows/check-license.yml index cfa24bc1..698cdae7 100644 --- a/.github/workflows/check-license.yml +++ b/.github/workflows/check-license.yml @@ -83,7 +83,9 @@ jobs: ruby-version: ruby # Install latest version - name: Install licensee - run: gem install licensee + run: | + gem install \ + licensee - name: Check license file for ${{ matrix.check-license.path }} run: | @@ -95,14 +97,26 @@ jobs: # See: https://github.com/licensee/licensee LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)" - DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')" + DETECTED_LICENSE_FILE="$( + echo "$LICENSEE_OUTPUT" \ + | \ + jq .matched_files[0].filename \ + | \ + tr --delete '\r' + )" echo "Detected license file: $DETECTED_LICENSE_FILE" if [ "$DETECTED_LICENSE_FILE" != "\"${{ matrix.check-license.expected-filename }}\"" ]; then echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: ${{ matrix.check-license.expected-filename }}" EXIT_STATUS=1 fi - DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')" + DETECTED_LICENSE_TYPE="$( + echo "$LICENSEE_OUTPUT" \ + | \ + jq .matched_files[0].matched_license \ + | \ + tr --delete '\r' + )" echo "Detected license type: $DETECTED_LICENSE_TYPE" if [ "$DETECTED_LICENSE_TYPE" != "\"${{ matrix.check-license.expected-type }}\"" ]; then echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${{ matrix.check-license.expected-type }}\"" diff --git a/.github/workflows/check-markdown-task.yml b/.github/workflows/check-markdown-task.yml index 05e1649d..6e9a25c9 100644 --- a/.github/workflows/check-markdown-task.yml +++ b/.github/workflows/check-markdown-task.yml @@ -112,4 +112,7 @@ jobs: version: 3.x - name: Check links - run: task --silent markdown:check-links + run: | + task \ + --silent \ + markdown:check-links diff --git a/.github/workflows/check-npm-task.yml b/.github/workflows/check-npm-task.yml index 6573d007..1a0e43fb 100644 --- a/.github/workflows/check-npm-task.yml +++ b/.github/workflows/check-npm-task.yml @@ -80,7 +80,11 @@ jobs: version: 3.x - name: Validate package.json - run: task --silent npm:validate PROJECT_PATH="${{ matrix.project.path }}" + run: | + task \ + --silent \ + npm:validate \ + PROJECT_PATH="${{ matrix.project.path }}" check-sync: name: check-sync (${{ matrix.project.path }}) @@ -113,10 +117,16 @@ jobs: version: 3.x - name: Install npm dependencies - run: task npm:install-deps PROJECT_PATH="${{ matrix.project.path }}" + run: | + task npm:install-deps \ + PROJECT_PATH="${{ matrix.project.path }}" - name: Check package-lock.json - run: git diff --color --exit-code "${{ matrix.project.path }}/package-lock.json" + run: | + git diff \ + --color \ + --exit-code \ + "${{ matrix.project.path }}/package-lock.json" check-config: name: check-config (${{ matrix.project.path }}) @@ -150,14 +160,12 @@ jobs: - name: Fix problems in npm configuration file run: | - task \ - npm:fix-config \ + task npm:fix-config \ PROJECT_PATH="${{ matrix.project.path }}" - name: Check if fixes are needed in npm configuration file run: | - git \ - diff \ - --color \ - --exit-code \ - "${{ matrix.project.path }}/.npmrc" + git diff \ + --color \ + --exit-code \ + "${{ matrix.project.path }}/.npmrc" diff --git a/.github/workflows/check-prettier-formatting-task.yml b/.github/workflows/check-prettier-formatting-task.yml index b5e188a0..05712981 100644 --- a/.github/workflows/check-prettier-formatting-task.yml +++ b/.github/workflows/check-prettier-formatting-task.yml @@ -271,4 +271,7 @@ jobs: run: task general:format-prettier - name: Check formatting - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code diff --git a/.github/workflows/check-python-task.yml b/.github/workflows/check-python-task.yml index 721b36d5..600dc020 100644 --- a/.github/workflows/check-python-task.yml +++ b/.github/workflows/check-python-task.yml @@ -109,4 +109,7 @@ jobs: run: task python:format - name: Check formatting - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code diff --git a/.github/workflows/check-shell-task.yml b/.github/workflows/check-shell-task.yml index ffd9dd79..950e3301 100644 --- a/.github/workflows/check-shell-task.yml +++ b/.github/workflows/check-shell-task.yml @@ -105,12 +105,17 @@ jobs: - name: Install ShellCheck run: | cd "${{ env.INSTALL_PATH }}" - tar --extract --file="${{ steps.download.outputs.name }}" + + tar \ + --extract \ + --file="${{ steps.download.outputs.name }}" + EXTRACTION_FOLDER="$( basename \ "${{ steps.download.outputs.name }}" \ "${{ env.SHELLCHECK_RELEASE_ASSET_SUFFIX }}" )" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.INSTALL_PATH }}/$EXTRACTION_FOLDER" >> "$GITHUB_PATH" @@ -164,9 +169,15 @@ jobs: - name: Install shfmt run: | # Executable permissions of release assets are lost - chmod +x "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" + chmod \ + +x \ + "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" + # Standardize binary name - mv "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" "${{ env.SHFMT_INSTALL_PATH }}/shfmt" + mv \ + "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" \ + "${{ env.SHFMT_INSTALL_PATH }}/shfmt" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.SHFMT_INSTALL_PATH }}" >> "$GITHUB_PATH" @@ -179,7 +190,10 @@ jobs: SCRIPT_PATH="${{ matrix.script }}" - name: Check formatting - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code executable: name: executable (${{ matrix.script }}) diff --git a/.github/workflows/check-workflows-task.yml b/.github/workflows/check-workflows-task.yml index a7090d34..43012cef 100644 --- a/.github/workflows/check-workflows-task.yml +++ b/.github/workflows/check-workflows-task.yml @@ -43,4 +43,7 @@ jobs: version: 3.x - name: Validate workflows - run: task --silent ci:validate + run: | + task \ + --silent \ + ci:validate diff --git a/.github/workflows/check-yaml-task.yml b/.github/workflows/check-yaml-task.yml index e43519af..43cf05db 100644 --- a/.github/workflows/check-yaml-task.yml +++ b/.github/workflows/check-yaml-task.yml @@ -107,4 +107,6 @@ jobs: - name: Check YAML continue-on-error: ${{ matrix.configuration.continue-on-error }} - run: task yaml:lint YAMLLINT_FORMAT=${{ matrix.configuration.format }} + run: | + task yaml:lint \ + YAMLLINT_FORMAT=${{ matrix.configuration.format }} diff --git a/.github/workflows/test-install-script.yml b/.github/workflows/test-install-script.yml index 8929bb0d..85aea998 100644 --- a/.github/workflows/test-install-script.yml +++ b/.github/workflows/test-install-script.yml @@ -47,6 +47,7 @@ jobs: --in-place \ 's/PROJECT_OWNER="${{ env.PROJECT_OWNER_PLACEHOLDER }}"/PROJECT_OWNER="${{ env.PROJECT_OWNER }}"/' \ "${{ env.SCRIPT_FOLDER }}/${{ env.SCRIPT_NAME }}" + sed \ --in-place \ 's/PROJECT_NAME="${{ env.PROJECT_NAME_PLACEHOLDER }}"/PROJECT_NAME="${{ env.PROJECT_NAME }}"/' \ @@ -80,7 +81,11 @@ jobs: name: ${{ env.SCRIPT_ARTIFACT_NAME }} - name: Make script executable - run: chmod u+x "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" + shell: bash + run: | + chmod \ + u+x \ + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" - name: Run script with defaults shell: sh @@ -90,7 +95,8 @@ jobs: - name: Verify installation shell: bash run: | - "${PWD}/bin/${{ env.TOOL_NAME }}" --version + "${PWD}/bin/${{ env.TOOL_NAME }}" \ + --version bindir: needs: configure @@ -119,18 +125,26 @@ jobs: name: ${{ env.SCRIPT_ARTIFACT_NAME }} - name: Make script executable - run: chmod u+x "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" + shell: bash + run: | + chmod \ + u+x \ + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" - name: Run script with custom install location shell: sh run: | - mkdir -p "${{ env.BINDIR }}" + mkdir \ + -p \ + "${{ env.BINDIR }}" + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" - name: Verify installation shell: bash run: | - "${{ env.BINDIR }}/${{ env.TOOL_NAME }}" --version + "${{ env.BINDIR }}/${{ env.TOOL_NAME }}" \ + --version version: needs: configure @@ -156,7 +170,11 @@ jobs: name: ${{ env.SCRIPT_ARTIFACT_NAME }} - name: Make script executable - run: chmod u+x "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" + shell: bash + run: | + chmod \ + u+x \ + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" - name: Run script with version argument shell: sh @@ -166,7 +184,12 @@ jobs: - name: Verify installation shell: bash run: | - "${PWD}/bin/${{ env.TOOL_NAME }}" --version | grep --fixed-strings "${{ env.VERSION }}" + "${PWD}/bin/${{ env.TOOL_NAME }}" \ + --version \ + | \ + grep \ + --fixed-strings \ + "${{ env.VERSION }}" nightly: needs: configure @@ -189,17 +212,26 @@ jobs: name: ${{ env.SCRIPT_ARTIFACT_NAME }} - name: Make script executable - run: chmod u+x "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" + shell: bash + run: | + chmod \ + u+x \ + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" - name: Run script with nightly build version argument shell: sh run: | - "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" "nightly-latest" + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" \ + "nightly-latest" - name: Verify installation shell: bash run: | - "${PWD}/bin/${{ env.TOOL_NAME }}" --version | grep "^nightly-" + "${PWD}/bin/${{ env.TOOL_NAME }}" \ + --version \ + | \ + grep \ + "^nightly-" path-suggestions: needs: configure @@ -233,18 +265,26 @@ jobs: name: ${{ env.SCRIPT_ARTIFACT_NAME }} - name: Make script executable - run: chmod u+x "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" + shell: bash + run: | + chmod \ + u+x \ + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" - name: Check script output without previous installation in PATH shell: sh env: BINDIR: ${{ env.FIRST_BINDIR }} run: | - mkdir -p "${{ env.BINDIR }}" - "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" | \ - grep \ - -F \ - '${{ env.TOOL_NAME }} not found. You might want to add "${{ env.FIRST_BINDIR }}" to your $PATH' + mkdir \ + -p \ + "${{ env.BINDIR }}" + + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" \ + | \ + grep \ + -F \ + '${{ env.TOOL_NAME }} not found. You might want to add "${{ env.FIRST_BINDIR }}" to your $PATH' - name: Add first installation to PATH shell: bash @@ -258,11 +298,15 @@ jobs: env: BINDIR: ${{ env.SECOND_BINDIR }} run: | - mkdir -p "${{ env.BINDIR }}" - "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" | \ - grep \ - -F \ - '${{ env.TOOL_NAME }} was found at ${{ env.FIRST_BINDIR }}/${{ env.TOOL_NAME }}. Please prepend "${{ env.BINDIR }}" to your $PATH' + mkdir \ + -p \ + "${{ env.BINDIR }}" + + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" \ + | \ + grep \ + -F \ + '${{ env.TOOL_NAME }} was found at ${{ env.FIRST_BINDIR }}/${{ env.TOOL_NAME }}. Please prepend "${{ env.BINDIR }}" to your $PATH' # ${{ runner.temp }} is a Windows style path on the windows runner, but the script output uses the equivalent # POSIX style path. @@ -273,7 +317,11 @@ jobs: env: BINDIR: ${{ env.SECOND_BINDIR }} run: | - mkdir -p "${{ env.BINDIR }}" - "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" | \ - grep \ - '${{ env.TOOL_NAME }} was found at .*/${{ env.FIRST_INSTALLATION_FOLDER }}/${{ env.TOOL_NAME }}\. Please prepend ".*/${{ env.SECOND_INSTALLATION_FOLDER }}" to your \$PATH' + mkdir \ + -p \ + "${{ env.BINDIR }}" + + "${{ github.workspace }}/${{ env.SCRIPT_NAME }}" \ + | \ + grep \ + '${{ env.TOOL_NAME }} was found at .*/${{ env.FIRST_INSTALLATION_FOLDER }}/${{ env.TOOL_NAME }}\. Please prepend ".*/${{ env.SECOND_INSTALLATION_FOLDER }}" to your \$PATH' diff --git a/Taskfile.yml b/Taskfile.yml index 73b476bc..c4067fe3 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -156,7 +156,10 @@ tasks: EXPECTED_CLANG_FORMAT_VERSION: "{{default .DEFAULT_CLANG_FORMAT_VERSION .CLANG_FORMAT_VERSION}}" cmds: - | - if ! which clang-format &>/dev/null; then + if + ! which clang-format \ + &>/dev/null + then echo "clang-format not found or not in PATH." echo "Please install: https://github.com/arduino/clang-static-binaries/releases" exit 1 @@ -200,13 +203,22 @@ tasks: mv "{{.WORKING_FOLDER}}/input/" "{{.WORKING_FOLDER}}/output/" - | cd "{{.WORKING_FOLDER}}" - diff --color=always --recursive --unified "golden/" "output/" + + diff \ + --color=always \ + --recursive \ + --unified \ + "golden/" \ + "output/" clang-format:check-testdata: desc: Check whether the targeted test data C++ code for the ClangFormat configuration is valid and correct cmds: - | - if ! which g++ &>/dev/null; then + if + ! which g++ \ + &>/dev/null + then echo "GCC not found or not in PATH." exit 1 fi @@ -246,7 +258,10 @@ tasks: - task: clang-format:check-installed cmds: - | - if ! which yq &>/dev/null; then + if + ! which yq \ + &>/dev/null + then echo "ec not found or not in PATH. Please install: https://github.com/mikefarah/yq/#install" exit 1 fi @@ -254,25 +269,35 @@ tasks: - | # Add source comment echo \ - "# Source: https://github.com/arduino/tooling-project-assets/tree/main/other/clang-format-configuration" > \ - "{{.TARGET_PATH}}" + "# Source: https://github.com/arduino/tooling-project-assets/tree/main/other/clang-format-configuration" \ + > "{{.TARGET_PATH}}" # Dump the effective configuration to the target file clang-format \ --dump-config \ - --style=file:"{{.CLANG_FORMAT_CONFIGURATION_PATH}}" >> \ - "{{.TARGET_PATH}}" + --style=file:"{{.CLANG_FORMAT_CONFIGURATION_PATH}}" \ + >> "{{.TARGET_PATH}}" - | # Correct invalid `BasedOnStyle` key value # The existing key is deleted before assigning it to a valid value in order to achieve consistent quoting style # (updating the empty string value in place causes the assigned value to be wrapped in quotes) - yq --inplace 'del(.BasedOnStyle)' "{{.TARGET_PATH}}" - yq --inplace '.BasedOnStyle = "LLVM"' "{{.TARGET_PATH}}" + yq \ + --inplace \ + 'del(.BasedOnStyle)' \ + "{{.TARGET_PATH}}" + + yq \ + --inplace \ + '.BasedOnStyle = "LLVM"' \ + "{{.TARGET_PATH}}" - | # Fix the inconsistent key order - yq --inplace 'sort_keys(.)' "{{.TARGET_PATH}}" + yq \ + --inplace \ + 'sort_keys(.)' \ + "{{.TARGET_PATH}}" # Use ClangFormat to format the files under the path specified by TARGET_FOLDER recursively clang-format:format: @@ -311,15 +336,26 @@ tasks: - task: clang-format:dump-config vars: TARGET_PATH: "{{.WORKING_PATH}}" - - mv --force "{{.WORKING_PATH}}" "{{.CLANG_FORMAT_CONFIGURATION_PATH}}" + - | + mv \ + --force \ + "{{.WORKING_PATH}}" \ + "{{.CLANG_FORMAT_CONFIGURATION_PATH}}" clang-format:update-golden: desc: Update golden master test data for current configuration deps: - task: clang-format:check-installed cmds: - - rm --recursive "{{.CLANG_FORMAT_GOLDEN_TEST_DATA_FOLDER}}/" - - cp --recursive "{{.CLANG_FORMAT_INPUT_TEST_DATA_FOLDER}}/" "{{.CLANG_FORMAT_GOLDEN_TEST_DATA_FOLDER}}/" + - | + rm \ + --recursive \ + "{{.CLANG_FORMAT_GOLDEN_TEST_DATA_FOLDER}}/" + - | + cp \ + --recursive \ + "{{.CLANG_FORMAT_INPUT_TEST_DATA_FOLDER}}/" \ + "{{.CLANG_FORMAT_GOLDEN_TEST_DATA_FOLDER}}/" - task: clang-format:format vars: TARGET_FOLDER: "{{.CLANG_FORMAT_GOLDEN_TEST_DATA_FOLDER}}/" @@ -335,11 +371,17 @@ tasks: # ajv-cli identifies YAML-format data files by their file extension, so renaming is required: # https://github.com/ajv-validator/ajv-cli/issues/117 DATA_PATH: - sh: task utility:mktemp-file TEMPLATE=".clang-format-XXXXXXXXXX.yml" + sh: | + task utility:mktemp-file \ + TEMPLATE=".clang-format-XXXXXXXXXX.yml" deps: - task: npm:install-deps cmds: - - wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}} + - | + wget \ + --quiet \ + --output-document="{{.SCHEMA_PATH}}" \ + {{.SCHEMA_URL}} - cp "{{.DATA_SOURCE_PATH}}" "{{.DATA_PATH}}" - | npx \ @@ -379,14 +421,24 @@ tasks: # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/base.json BASE_SCHEMA_URL: https://json.schemastore.org/base.json BASE_SCHEMA_PATH: - sh: task utility:mktemp-file TEMPLATE="base-schema-XXXXXXXXXX.json" + sh: | + task utility:mktemp-file \ + TEMPLATE="base-schema-XXXXXXXXXX.json" # The Dependabot configuration file for the repository. DATA_PATH: ".github/dependabot.yml" # The asset Dependabot configuration files. ASSETS_DATA_PATH: "workflow-templates/assets/dependabot/**/dependabot.yml" cmds: - - wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}} - - wget --quiet --output-document="{{.BASE_SCHEMA_PATH}}" {{.BASE_SCHEMA_URL}} + - | + wget \ + --quiet \ + --output-document="{{.SCHEMA_PATH}}" \ + {{.SCHEMA_URL}} + - | + wget \ + --quiet \ + --output-document="{{.BASE_SCHEMA_PATH}}" \ + {{.BASE_SCHEMA_URL}} - | npx \ --package=ajv-cli \ @@ -425,13 +477,23 @@ tasks: # Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/partial-eslint-plugins.json PARTIAL_ESLINT_PLUGINS_SCHEMA_URL: https://json.schemastore.org/partial-eslint-plugins.json PARTIAL_ESLINT_PLUGINS_PATH: - sh: task utility:mktemp-file TEMPLATE="partial-eslint-plugins-schema-XXXXXXXXXX.json" + sh: | + task utility:mktemp-file \ + TEMPLATE="partial-eslint-plugins-schema-XXXXXXXXXX.json" DATA_PATH: workflow-templates/assets/check-javascript/.eslintrc.yml # ajv-cli identifies YAML-format data files by their file extension, so renaming is required: # https://github.com/ajv-validator/ajv-cli/issues/117 cmds: - - wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}} - - wget --quiet --output-document="{{.PARTIAL_ESLINT_PLUGINS_PATH}}" {{.PARTIAL_ESLINT_PLUGINS_SCHEMA_URL}} + - | + wget \ + --quiet \ + --output-document="{{.SCHEMA_PATH}}" \ + {{.SCHEMA_URL}} + - | + wget \ + --quiet \ + --output-document="{{.PARTIAL_ESLINT_PLUGINS_PATH}}" \ + {{.PARTIAL_ESLINT_PLUGINS_SCHEMA_URL}} - | npx \ --package=ajv-cli \ @@ -457,11 +519,12 @@ tasks: sh \ -c \ ' \ - basename "$0" | \ - grep \ - --extended-regexp \ - --regexp='"'"'([<>:"/\\|?*'"'"'"$(printf "\001-\037")"'"'"'])|(.+\.$)'"'"' \ - --silent \ + basename "$0" \ + | \ + grep \ + --extended-regexp \ + --regexp='"'"'([<>:"/\\|?*'"'"'"$(printf "\001-\037")"'"'"'])|(.+\.$)'"'"' \ + --silent \ && \ echo "$0" ' \ @@ -489,12 +552,13 @@ tasks: sh \ -c \ ' \ - basename "$0" | \ - grep \ - --ignore-case \ - --extended-regexp \ - --regexp='"'"'^(con|prn|aux|nul|com[0-9]+|lpt[0-9]+)$'"'"' \ - --silent \ + basename "$0" \ + | \ + grep \ + --ignore-case \ + --extended-regexp \ + --regexp='"'"'^(con|prn|aux|nul|com[0-9]+|lpt[0-9]+)$'"'"' \ + --silent \ && \ echo "$0" ' \ @@ -518,7 +582,10 @@ tasks: desc: Check basic formatting style of all files cmds: - | - if ! which ec &>/dev/null; then + if + ! which ec \ + &>/dev/null + then echo "ec not found or not in PATH. Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation" exit 1 fi @@ -569,7 +636,10 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run codespell --write-changes + - | + poetry run \ + codespell \ + --write-changes # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml general:format-prettier: @@ -579,7 +649,11 @@ tasks: vars: PROJECT_PATH: ./ cmds: - - npx prettier --write . + - | + npx \ + prettier \ + --write \ + . github:sync: desc: Sync GitHub community health files @@ -614,7 +688,11 @@ tasks: deps: - task: npm:install-deps cmds: - - wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}} + - | + wget \ + --quiet \ + --output-document="{{.SCHEMA_PATH}}" \ + {{.SCHEMA_URL}} - | npx \ --package=ajv-cli \ @@ -630,14 +708,23 @@ tasks: deps: - task: npm:install-deps cmds: - - npx eslint --ext .js,.jsx --fix . + - | + npx \ + eslint \ + --ext .js,.jsx \ + --fix \ + . js:lint: desc: Lint JavaScript code deps: - task: npm:install-deps cmds: - - npx eslint --ext .js,.jsx . + - | + npx \ + eslint \ + --ext .js,.jsx \ + . labels:validate: desc: Validate GitHub repository label configuration files against their JSON schema @@ -707,7 +794,11 @@ tasks: vars: PROJECT_PATH: ./ cmds: - - npx markdownlint-cli --fix "**/*.md" + - | + npx \ + markdownlint-cli \ + --fix \ + "**/*.md" # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml markdown:lint: @@ -717,7 +808,10 @@ tasks: vars: PROJECT_PATH: ./ cmds: - - npx markdownlint-cli "**/*.md" + - | + npx \ + markdownlint-cli \ + "**/*.md" markdownlint:validate: desc: Validate markdownlint configuration files against their JSON schema @@ -730,7 +824,11 @@ tasks: deps: - task: npm:install-deps cmds: - - wget --quiet --output-document="{{.SCHEMA_PATH}}" {{.SCHEMA_URL}} + - | + wget \ + --quiet \ + --output-document="{{.SCHEMA_PATH}}" \ + {{.SCHEMA_URL}} - | npx \ --package=ajv-cli \ @@ -765,10 +863,9 @@ tasks: "{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}" cmds: - | - npm \ - config \ - --location project \ - fix + npm config \ + --location project \ + fix # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-task/Taskfile.yml npm:validate: @@ -857,19 +954,25 @@ tasks: run: when_changed cmds: - | - if ! which yq &>/dev/null; then + if + ! which yq \ + &>/dev/null + then echo "yq not found or not in PATH." echo "Please install: https://github.com/mikefarah/yq/#install" exit 1 fi - | - if ! which python &>/dev/null; then + if + ! which python \ + &>/dev/null + then python_constraint="$( \ yq \ --input-format toml \ --output-format yaml \ '.tool.poetry.dependencies.python' \ - < pyproject.toml + < pyproject.toml )" echo "Python not found or not in PATH." @@ -878,7 +981,10 @@ tasks: exit 1 fi - | - if ! which pipx &>/dev/null; then + if + ! which pipx \ + &>/dev/null + then echo "pipx not found or not in PATH." echo "Please install: https://pipx.pypa.io/stable/installation/#installing-pipx" exit 1 @@ -894,7 +1000,7 @@ tasks: --input-format toml \ --output-format yaml \ '.tool.poetry.group.pipx.dependencies.poetry' \ - < pyproject.toml + < pyproject.toml )" pipx install \ @@ -952,7 +1058,10 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run black . + - | + poetry run \ + black \ + . # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml python:lint: @@ -962,14 +1071,20 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run flake8 --show-source + - | + poetry run \ + flake8 \ + --show-source python:test: desc: Run Python tests deps: - task: poetry:install-deps cmds: - - poetry run pytest workflow-templates/assets/deploy-mkdocs-versioned/siteversion/tests + - | + poetry run \ + pytest \ + workflow-templates/assets/deploy-mkdocs-versioned/siteversion/tests # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-shell-task/Taskfile.yml shell:check: @@ -985,7 +1100,10 @@ tasks: exit 1 fi - | - if ! which shellcheck &>/dev/null; then + if + ! which shellcheck \ + &>/dev/null + then echo "shellcheck not installed or not in PATH." echo "Please install: https://github.com/koalaman/shellcheck#installing" exit 1 @@ -1025,7 +1143,10 @@ tasks: exit 1 fi - | - if ! which shfmt &>/dev/null; then + if + ! which shfmt \ + &>/dev/null + then echo "shfmt not installed or not in PATH. Please install: https://github.com/mvdan/sh#shfmt" exit 1 fi @@ -1079,4 +1200,9 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run yamllint --format {{default "colored" .YAMLLINT_FORMAT}} . + - | + poetry run \ + yamllint \ + --format \ + {{default "colored" .YAMLLINT_FORMAT}} \ + . diff --git a/workflow-templates/assets/check-action-metadata-task/Taskfile.yml b/workflow-templates/assets/check-action-metadata-task/Taskfile.yml index 954d3065..3b48f828 100644 --- a/workflow-templates/assets/check-action-metadata-task/Taskfile.yml +++ b/workflow-templates/assets/check-action-metadata-task/Taskfile.yml @@ -7,7 +7,9 @@ tasks: desc: Validate GitHub Actions metadata against JSON schema vars: ACTION_METADATA_SCHEMA_PATH: - sh: task utility:mktemp-file TEMPLATE="github-action-schema-XXXXXXXXXX.json" + sh: | + task utility:mktemp-file \ + TEMPLATE="github-action-schema-XXXXXXXXXX.json" deps: - task: npm:install-deps vars: @@ -20,8 +22,7 @@ tasks: https://json.schemastore.org/github-action - | npx \ - ajv-cli \ - validate \ + ajv-cli validate \ --strict=false \ -s "{{.ACTION_METADATA_SCHEMA_PATH}}" \ -d "action.yml" diff --git a/workflow-templates/assets/check-dependencies-task/Taskfile.yml b/workflow-templates/assets/check-dependencies-task/Taskfile.yml index 1fef4dae..c1007d73 100644 --- a/workflow-templates/assets/check-dependencies-task/Taskfile.yml +++ b/workflow-templates/assets/check-dependencies-task/Taskfile.yml @@ -9,7 +9,10 @@ tasks: - task: general:prepare-deps cmds: - | - if ! which licensed &>/dev/null; then + if + ! which licensed \ + &>/dev/null + then if [[ {{OS}} == "windows" ]]; then echo "Licensed does not have Windows support." echo "Please use Linux/macOS or download the dependencies cache from the GitHub Actions workflow artifact." diff --git a/workflow-templates/assets/check-files-task/Taskfile.yml b/workflow-templates/assets/check-files-task/Taskfile.yml index 6540de20..becc3356 100644 --- a/workflow-templates/assets/check-files-task/Taskfile.yml +++ b/workflow-templates/assets/check-files-task/Taskfile.yml @@ -16,11 +16,12 @@ tasks: sh \ -c \ ' \ - basename "$0" | \ - grep \ - --extended-regexp \ - --regexp='"'"'([<>:"/\\|?*'"'"'"$(printf "\001-\037")"'"'"'])|(.+\.$)'"'"' \ - --silent \ + basename "$0" \ + | \ + grep \ + --extended-regexp \ + --regexp='"'"'([<>:"/\\|?*'"'"'"$(printf "\001-\037")"'"'"'])|(.+\.$)'"'"' \ + --silent \ && \ echo "$0" ' \ @@ -48,12 +49,13 @@ tasks: sh \ -c \ ' \ - basename "$0" | \ - grep \ - --ignore-case \ - --extended-regexp \ - --regexp='"'"'^(con|prn|aux|nul|com[0-9]+|lpt[0-9]+)$'"'"' \ - --silent \ + basename "$0" \ + | \ + grep \ + --ignore-case \ + --extended-regexp \ + --regexp='"'"'^(con|prn|aux|nul|com[0-9]+|lpt[0-9]+)$'"'"' \ + --silent \ && \ echo "$0" ' \ diff --git a/workflow-templates/assets/check-general-formatting-task/Taskfile.yml b/workflow-templates/assets/check-general-formatting-task/Taskfile.yml index 073f98c1..01b1f32c 100644 --- a/workflow-templates/assets/check-general-formatting-task/Taskfile.yml +++ b/workflow-templates/assets/check-general-formatting-task/Taskfile.yml @@ -7,7 +7,10 @@ tasks: desc: Check basic formatting style of all files cmds: - | - if ! which ec &>/dev/null; then + if + ! which ec \ + &>/dev/null + then echo "ec not found or not in PATH." echo "Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation" exit 1 diff --git a/workflow-templates/assets/check-go-task/Taskfile.yml b/workflow-templates/assets/check-go-task/Taskfile.yml index f2181f1f..0df462fe 100644 --- a/workflow-templates/assets/check-go-task/Taskfile.yml +++ b/workflow-templates/assets/check-go-task/Taskfile.yml @@ -33,7 +33,10 @@ tasks: dir: "{{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}" cmds: - | - if ! which golangci-lint &>/dev/null; then + if + ! which golangci-lint \ + &>/dev/null + then echo "golangci-lint not installed or not in PATH." echo "Please install: https://golangci-lint.run/usage/install/#local-installation" exit 1 diff --git a/workflow-templates/assets/check-javascript-task/Taskfile.yml b/workflow-templates/assets/check-javascript-task/Taskfile.yml index 791bdae1..59d68d07 100644 --- a/workflow-templates/assets/check-javascript-task/Taskfile.yml +++ b/workflow-templates/assets/check-javascript-task/Taskfile.yml @@ -8,7 +8,12 @@ tasks: deps: - task: npm:install-deps cmds: - - npx eslint --ext .js,.jsx --fix . + - | + npx \ + eslint \ + --ext .js,.jsx \ + --fix \ + . # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-javascript-task/Taskfile.yml js:lint: @@ -16,4 +21,8 @@ tasks: deps: - task: npm:install-deps cmds: - - npx eslint --ext .js,.jsx . + - | + npx \ + eslint \ + --ext .js,.jsx \ + . diff --git a/workflow-templates/assets/check-markdown-task/Taskfile.yml b/workflow-templates/assets/check-markdown-task/Taskfile.yml index be5bd56a..33ac05ea 100644 --- a/workflow-templates/assets/check-markdown-task/Taskfile.yml +++ b/workflow-templates/assets/check-markdown-task/Taskfile.yml @@ -55,7 +55,11 @@ tasks: vars: PROJECT_PATH: ./ cmds: - - npx markdownlint-cli --fix "**/*.md" + - | + npx \ + markdownlint-cli \ + --fix \ + "**/*.md" # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-markdown-task/Taskfile.yml markdown:lint: @@ -65,4 +69,7 @@ tasks: vars: PROJECT_PATH: ./ cmds: - - npx markdownlint-cli "**/*.md" + - | + npx \ + markdownlint-cli \ + "**/*.md" diff --git a/workflow-templates/assets/check-mkdocs-task/Taskfile.yml b/workflow-templates/assets/check-mkdocs-task/Taskfile.yml index 42fd5050..144ec362 100644 --- a/workflow-templates/assets/check-mkdocs-task/Taskfile.yml +++ b/workflow-templates/assets/check-mkdocs-task/Taskfile.yml @@ -17,7 +17,10 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run mkdocs build --strict + - | + poetry run \ + mkdocs build \ + --strict # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-mkdocs-task/Taskfile.yml website:serve: @@ -28,4 +31,6 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run mkdocs serve + - | + poetry run \ + mkdocs serve diff --git a/workflow-templates/assets/check-npm-task/Taskfile.yml b/workflow-templates/assets/check-npm-task/Taskfile.yml index 71daea24..da08ce7e 100644 --- a/workflow-templates/assets/check-npm-task/Taskfile.yml +++ b/workflow-templates/assets/check-npm-task/Taskfile.yml @@ -12,10 +12,9 @@ tasks: "{{default .DEFAULT_NPM_PROJECT_PATH .PROJECT_PATH}}" cmds: - | - npm \ - config \ - --location project \ - fix + npm config \ + --location project \ + fix # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-npm-task/Taskfile.yml npm:validate: diff --git a/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml b/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml index 03b48061..32a3ea24 100644 --- a/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml +++ b/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml @@ -10,4 +10,8 @@ tasks: vars: PROJECT_PATH: ./ cmds: - - npx prettier --write . + - | + npx \ + prettier \ + --write \ + . diff --git a/workflow-templates/assets/check-python-task/Taskfile.yml b/workflow-templates/assets/check-python-task/Taskfile.yml index 0171ed11..1268ea1f 100644 --- a/workflow-templates/assets/check-python-task/Taskfile.yml +++ b/workflow-templates/assets/check-python-task/Taskfile.yml @@ -10,7 +10,10 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run black . + - | + poetry run \ + black \ + . # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-python-task/Taskfile.yml python:lint: @@ -20,4 +23,7 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run flake8 --show-source + - | + poetry run \ + flake8 \ + --show-source diff --git a/workflow-templates/assets/check-shell-task/Taskfile.yml b/workflow-templates/assets/check-shell-task/Taskfile.yml index 6998e50d..622b05e5 100644 --- a/workflow-templates/assets/check-shell-task/Taskfile.yml +++ b/workflow-templates/assets/check-shell-task/Taskfile.yml @@ -16,7 +16,10 @@ tasks: exit 1 fi - | - if ! which shellcheck &>/dev/null; then + if + ! which shellcheck \ + &>/dev/null + then echo "shellcheck not installed or not in PATH." echo "Please install: https://github.com/koalaman/shellcheck#installing" exit 1 @@ -56,7 +59,10 @@ tasks: exit 1 fi - | - if ! which shfmt &>/dev/null; then + if + ! which shfmt \ + &>/dev/null + then echo "shfmt not installed or not in PATH. Please install: https://github.com/mvdan/sh#shfmt" exit 1 fi diff --git a/workflow-templates/assets/check-toc-task/Taskfile.yml b/workflow-templates/assets/check-toc-task/Taskfile.yml index 481986c9..40337dba 100644 --- a/workflow-templates/assets/check-toc-task/Taskfile.yml +++ b/workflow-templates/assets/check-toc-task/Taskfile.yml @@ -15,7 +15,8 @@ tasks: PROJECT_PATH: ./ cmds: - | - npx markdown-toc \ + npx \ + markdown-toc \ --bullets=- \ --maxdepth={{.MAX_DEPTH}} \ -i \ diff --git a/workflow-templates/assets/check-yaml-task/Taskfile.yml b/workflow-templates/assets/check-yaml-task/Taskfile.yml index d0dcf5a2..88ddb913 100644 --- a/workflow-templates/assets/check-yaml-task/Taskfile.yml +++ b/workflow-templates/assets/check-yaml-task/Taskfile.yml @@ -12,4 +12,9 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run yamllint --format {{default "colored" .YAMLLINT_FORMAT}} . + - | + poetry run \ + yamllint \ + --format \ + {{default "colored" .YAMLLINT_FORMAT}} \ + . diff --git a/workflow-templates/assets/go-task/Taskfile.yml b/workflow-templates/assets/go-task/Taskfile.yml index b1f9fe69..990f1694 100644 --- a/workflow-templates/assets/go-task/Taskfile.yml +++ b/workflow-templates/assets/go-task/Taskfile.yml @@ -22,4 +22,7 @@ tasks: desc: Build the Go code dir: "{{.DEFAULT_GO_MODULE_PATH}}" cmds: - - go build -v {{.LDFLAGS}} + - | + go build \ + -v \ + {{.LDFLAGS}} diff --git a/workflow-templates/assets/poetry-task/Taskfile.yml b/workflow-templates/assets/poetry-task/Taskfile.yml index c3914122..e6817e74 100644 --- a/workflow-templates/assets/poetry-task/Taskfile.yml +++ b/workflow-templates/assets/poetry-task/Taskfile.yml @@ -8,19 +8,25 @@ tasks: run: when_changed cmds: - | - if ! which yq &>/dev/null; then + if + ! which yq \ + &>/dev/null + then echo "yq not found or not in PATH." echo "Please install: https://github.com/mikefarah/yq/#install" exit 1 fi - | - if ! which python &>/dev/null; then + if + ! which python \ + &>/dev/null + then python_constraint="$( \ yq \ --input-format toml \ --output-format yaml \ '.tool.poetry.dependencies.python' \ - < pyproject.toml + < pyproject.toml )" echo "Python not found or not in PATH." @@ -29,7 +35,10 @@ tasks: exit 1 fi - | - if ! which pipx &>/dev/null; then + if + ! which pipx \ + &>/dev/null + then echo "pipx not found or not in PATH." echo "Please install: https://pipx.pypa.io/stable/installation/#installing-pipx" exit 1 @@ -45,7 +54,7 @@ tasks: --input-format toml \ --output-format yaml \ '.tool.poetry.group.pipx.dependencies.poetry' \ - < pyproject.toml + < pyproject.toml )" pipx install \ diff --git a/workflow-templates/assets/release-go-crosscompile-task/DistTasks.yml b/workflow-templates/assets/release-go-crosscompile-task/DistTasks.yml index 9274993a..94a002ae 100644 --- a/workflow-templates/assets/release-go-crosscompile-task/DistTasks.yml +++ b/workflow-templates/assets/release-go-crosscompile-task/DistTasks.yml @@ -26,9 +26,15 @@ tasks: GO386: "softfloat" cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - zip {{.PACKAGE_NAME}} {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe ../LICENSE.txt -j + zip \ + {{.PACKAGE_NAME}} \ + {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe \ + ../LICENSE.txt \ + -j vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_386" PACKAGE_PLATFORM: "Windows_32bit" @@ -41,9 +47,15 @@ tasks: GOARCH: "amd64" cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - zip {{.PACKAGE_NAME}} {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe ../LICENSE.txt -j + zip \ + {{.PACKAGE_NAME}} \ + {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe \ + ../LICENSE.txt \ + -j vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_amd64" PACKAGE_PLATFORM: "Windows_64bit" @@ -57,9 +69,16 @@ tasks: GO386: "softfloat" cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_amd32" PACKAGE_PLATFORM: "Linux_32bit" @@ -72,9 +91,15 @@ tasks: GOARCH: "amd64" cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_amd64" PACKAGE_PLATFORM: "Linux_64bit" @@ -88,9 +113,16 @@ tasks: GOARM: 7 cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_7" PACKAGE_PLATFORM: "Linux_ARMv7" @@ -104,9 +136,16 @@ tasks: GOARM: 6 cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_6" PACKAGE_PLATFORM: "Linux_ARMv6" @@ -119,9 +158,16 @@ tasks: GOARCH: "arm64" cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_64" PACKAGE_PLATFORM: "Linux_ARM64" @@ -134,9 +180,16 @@ tasks: GOARCH: "amd64" cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_amd64" PACKAGE_PLATFORM: "macOS_64bit" @@ -149,9 +202,16 @@ tasks: GOARCH: "arm64" cmds: - | - go build -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} {{.LDFLAGS}} + go build \ + -o {{.DIST_DIR}}/{{.PLATFORM_DIR}}/{{.PROJECT_NAME}} \ + {{.LDFLAGS}} cd {{.DIST_DIR}} - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_arm64" PACKAGE_PLATFORM: "macOS_ARM64" diff --git a/workflow-templates/assets/release-go-task/DistTasks.yml b/workflow-templates/assets/release-go-task/DistTasks.yml index 307cdca9..c6bc3889 100644 --- a/workflow-templates/assets/release-go-task/DistTasks.yml +++ b/workflow-templates/assets/release-go-task/DistTasks.yml @@ -27,13 +27,18 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - zip {{.PACKAGE_NAME}} {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe ../LICENSE.txt -j + zip \ + {{.PACKAGE_NAME}} \ + {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe ../LICENSE.txt \ + -j vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_386" @@ -48,13 +53,18 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - zip {{.PACKAGE_NAME}} {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe ../LICENSE.txt -j + zip \ + {{.PACKAGE_NAME}} \ + {{.PLATFORM_DIR}}/{{.PROJECT_NAME}}.exe ../LICENSE.txt \ + -j vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_windows_amd64" @@ -69,13 +79,20 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_amd32" @@ -90,13 +107,20 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_amd64" @@ -111,13 +135,20 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_7" @@ -132,13 +163,20 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_6" @@ -181,13 +219,20 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_linux_arm_64" @@ -202,13 +247,20 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_amd64" @@ -236,13 +288,20 @@ tasks: dir: "{{.DIST_DIR}}" cmds: - | - docker run -v `pwd`/..:/home/build -w /home/build \ - -e CGO_ENABLED=1 \ - {{.CONTAINER}}:{{.CONTAINER_TAG}} \ - --build-cmd "{{.BUILD_COMMAND}}" \ - -p "{{.BUILD_PLATFORM}}" + docker run \ + -v `pwd`/..:/home/build \ + -w /home/build \ + -e CGO_ENABLED=1 \ + {{.CONTAINER}}:{{.CONTAINER_TAG}} \ + --build-cmd "{{.BUILD_COMMAND}}" \ + -p "{{.BUILD_PLATFORM}}" - tar cz -C {{.PLATFORM_DIR}} {{.PROJECT_NAME}} -C ../.. LICENSE.txt -f {{.PACKAGE_NAME}} + tar cz \ + -C {{.PLATFORM_DIR}} \ + {{.PROJECT_NAME}} \ + -C ../.. \ + LICENSE.txt \ + -f {{.PACKAGE_NAME}} vars: PLATFORM_DIR: "{{.PROJECT_NAME}}_osx_darwin_arm64" diff --git a/workflow-templates/assets/release-go-task/Taskfile.yml b/workflow-templates/assets/release-go-task/Taskfile.yml index 59cc117b..0295be45 100644 --- a/workflow-templates/assets/release-go-task/Taskfile.yml +++ b/workflow-templates/assets/release-go-task/Taskfile.yml @@ -10,13 +10,34 @@ vars: DIST_DIR: "dist" # build vars COMMIT: - sh: echo "$(git log --no-show-signature -n 1 --format=%h)" + sh: | + echo \ + "$( + git log \ + --no-show-signature \ + -n 1 \ + --format=%h + )" TIMESTAMP: - sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" + sh: | + echo \ + "$( + date \ + -u \ + +"%Y-%m-%dT%H:%M:%SZ" + )" TIMESTAMP_SHORT: sh: echo "{{now | date "20060102"}}" TAG: - sh: echo "$(git tag --points-at=HEAD 2> /dev/null | head -n1)" + sh: | + echo \ + "$( + git tag \ + --points-at=HEAD \ + 2>/dev/null \ + | \ + head -n1 + )" VERSION: "{{if .NIGHTLY}}nightly-{{.TIMESTAMP_SHORT}}{{else if .TAG}}{{.TAG}}{{else}}{{.PACKAGE_NAME_PREFIX}}git-snapshot{{end}}" CONFIGURATION_PACKAGE: TODO LDFLAGS: >- diff --git a/workflow-templates/assets/spell-check-task/Taskfile.yml b/workflow-templates/assets/spell-check-task/Taskfile.yml index 2aacbde6..566d8218 100644 --- a/workflow-templates/assets/spell-check-task/Taskfile.yml +++ b/workflow-templates/assets/spell-check-task/Taskfile.yml @@ -20,4 +20,7 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run codespell --write-changes + - | + poetry run \ + codespell \ + --write-changes diff --git a/workflow-templates/assets/test-go-integration-task/Taskfile.yml b/workflow-templates/assets/test-go-integration-task/Taskfile.yml index e66707bf..4e8ea506 100644 --- a/workflow-templates/assets/test-go-integration-task/Taskfile.yml +++ b/workflow-templates/assets/test-go-integration-task/Taskfile.yml @@ -11,4 +11,7 @@ tasks: vars: POETRY_GROUPS: dev cmds: - - poetry run pytest tests + - | + poetry run \ + pytest \ + tests diff --git a/workflow-templates/assets/test-python-poetry-task/Taskfile.yml b/workflow-templates/assets/test-python-poetry-task/Taskfile.yml index 2f845133..a59110d6 100644 --- a/workflow-templates/assets/test-python-poetry-task/Taskfile.yml +++ b/workflow-templates/assets/test-python-poetry-task/Taskfile.yml @@ -8,4 +8,7 @@ tasks: deps: - task: poetry:install-deps cmds: - - poetry run pytest tests + - | + poetry run \ + pytest \ + tests diff --git a/workflow-templates/assets/windows-task/Taskfile.yml b/workflow-templates/assets/windows-task/Taskfile.yml index 8d507f90..ff683a65 100644 --- a/workflow-templates/assets/windows-task/Taskfile.yml +++ b/workflow-templates/assets/windows-task/Taskfile.yml @@ -22,10 +22,17 @@ tasks: utility:normalize-path: cmds: - | - if [[ "{{.OS}}" == "Windows_NT" ]] && which cygpath &>/dev/null; then - # Even though the shell handles POSIX format absolute paths as expected, external applications do not. - # So paths passed to such applications must first be converted to Windows format. - cygpath -w "{{.RAW_PATH}}" + if + [[ "{{.OS}}" == "Windows_NT" ]] \ + && \ + which cygpath \ + &>/dev/null + then + # Even though the shell handles POSIX format absolute paths as expected, external applications do not. + # So paths passed to such applications must first be converted to Windows format. + cygpath \ + -w \ + "{{.RAW_PATH}}" else echo "{{.RAW_PATH}}" fi diff --git a/workflow-templates/check-action-metadata-task.yml b/workflow-templates/check-action-metadata-task.yml index fdbdfcb2..16b0bc02 100644 --- a/workflow-templates/check-action-metadata-task.yml +++ b/workflow-templates/check-action-metadata-task.yml @@ -74,4 +74,7 @@ jobs: version: 3.x - name: Validate action.yml - run: task --silent action:validate + run: | + task \ + --silent \ + action:validate diff --git a/workflow-templates/check-certificates.yml b/workflow-templates/check-certificates.yml index ae5b18e8..aaf647fe 100644 --- a/workflow-templates/check-certificates.yml +++ b/workflow-templates/check-certificates.yml @@ -89,7 +89,11 @@ jobs: env: CERTIFICATE: ${{ secrets[matrix.certificate.certificate-secret] }} run: | - echo "${{ env.CERTIFICATE }}" | base64 --decode > "${{ env.CERTIFICATE_PATH }}" + echo "${{ env.CERTIFICATE }}" \ + | \ + base64 \ + --decode \ + >"${{ env.CERTIFICATE_PATH }}" - name: Verify certificate env: @@ -101,7 +105,9 @@ jobs: -legacy \ -noout \ -passin env:CERTIFICATE_PASSWORD - ) || ( + ) \ + || \ + ( echo "::error::Verification of ${{ matrix.certificate.identifier }} failed!!!" exit 1 ) @@ -125,43 +131,51 @@ jobs: run: | if [[ ${{ matrix.certificate.type }} == "pkcs12" ]]; then EXPIRATION_DATE="$( - ( + ( openssl pkcs12 \ - -in ${{ env.CERTIFICATE_PATH }} \ - -clcerts \ - -legacy \ - -nodes \ - -passin env:CERTIFICATE_PASSWORD - ) | ( + -in ${{ env.CERTIFICATE_PATH }} \ + -clcerts \ + -legacy \ + -nodes \ + -passin env:CERTIFICATE_PASSWORD + ) \ + | \ + ( openssl x509 \ - -noout \ - -enddate - ) | ( + -noout \ + -enddate + ) \ + | \ + ( grep \ - --max-count=1 \ - --only-matching \ - --perl-regexp \ - 'notAfter=(\K.*)' - ) + --max-count=1 \ + --only-matching \ + --perl-regexp \ + 'notAfter=(\K.*)' + ) )" elif [[ ${{ matrix.certificate.type }} == "x509" ]]; then EXPIRATION_DATE="$( - ( + ( openssl x509 \ - -in ${{ env.CERTIFICATE_PATH }} \ - -noout \ - -enddate - ) | ( + -in ${{ env.CERTIFICATE_PATH }} \ + -noout \ + -enddate + ) \ + | \ + ( grep \ - --max-count=1 \ - --only-matching \ - --perl-regexp \ - 'notAfter=(\K.*)' - ) + --max-count=1 \ + --only-matching \ + --perl-regexp \ + 'notAfter=(\K.*)' + ) )" fi - DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))" + DAYS_BEFORE_EXPIRATION="$(( + ($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24 + ))" # Display the expiration information in the log. echo "Certificate expiration date: $EXPIRATION_DATE" diff --git a/workflow-templates/check-files-task.yml b/workflow-templates/check-files-task.yml index 16647543..9e795315 100644 --- a/workflow-templates/check-files-task.yml +++ b/workflow-templates/check-files-task.yml @@ -55,7 +55,10 @@ jobs: version: 3.x - name: Check filenames - run: task --silent general:check-filenames + run: | + task \ + --silent \ + general:check-filenames check-symlinks: needs: run-determination @@ -75,4 +78,7 @@ jobs: version: 3.x - name: Check symlinks - run: task --silent general:check-symlinks + run: | + task \ + --silent \ + general:check-symlinks diff --git a/workflow-templates/check-general-formatting-task.yml b/workflow-templates/check-general-formatting-task.yml index 6658d67f..a8e2d798 100644 --- a/workflow-templates/check-general-formatting-task.yml +++ b/workflow-templates/check-general-formatting-task.yml @@ -71,12 +71,22 @@ jobs: - name: Install editorconfig-checker run: | cd "${{ env.EC_INSTALL_PATH }}" - tar --extract --file="${{ steps.download.outputs.name }}" + + tar \ + --extract \ + --file="${{ steps.download.outputs.name }}" + # Give the binary a standard name - mv "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" "${{ env.EC_INSTALL_PATH }}/bin/ec" + mv \ + "${{ env.EC_INSTALL_PATH }}/bin/ec-linux-amd64" \ + "${{ env.EC_INSTALL_PATH }}/bin/ec" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.EC_INSTALL_PATH }}/bin" >> "$GITHUB_PATH" - name: Check formatting - run: task --silent general:check-formatting + run: | + task \ + --silent \ + general:check-formatting diff --git a/workflow-templates/check-go-dependencies-task.yml b/workflow-templates/check-go-dependencies-task.yml index 0759726c..b9c1a10b 100644 --- a/workflow-templates/check-go-dependencies-task.yml +++ b/workflow-templates/check-go-dependencies-task.yml @@ -92,13 +92,21 @@ jobs: version: 3.x - name: Update dependencies license metadata cache - run: task --silent general:cache-dep-licenses + run: | + task \ + --silent \ + general:cache-dep-licenses - name: Check for outdated cache id: diff run: | git add . - if ! git diff --cached --color --exit-code; then + if + ! git diff \ + --cached \ + --color \ + --exit-code + then echo echo "::error::Dependency license metadata out of sync. See: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md#metadata-cache" exit 1 @@ -151,4 +159,7 @@ jobs: version: 3.x - name: Check for dependencies with unapproved licenses - run: task --silent general:check-dep-licenses + run: | + task \ + --silent \ + general:check-dep-licenses diff --git a/workflow-templates/check-go-task.yml b/workflow-templates/check-go-task.yml index 4dce0dc7..748e9f43 100644 --- a/workflow-templates/check-go-task.yml +++ b/workflow-templates/check-go-task.yml @@ -88,7 +88,10 @@ jobs: run: task go:fix - name: Check if any fixes were needed - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code check-style: name: check-style (${{ matrix.module.path }}) @@ -129,7 +132,10 @@ jobs: - name: Check style env: GO_MODULE_PATH: ${{ matrix.module.path }} - run: task --silent go:lint + run: | + task \ + --silent \ + go:lint check-formatting: name: check-formatting (${{ matrix.module.path }}) @@ -168,7 +174,10 @@ jobs: run: task go:format - name: Check formatting - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code check-config: name: check-config (${{ matrix.module.path }}) @@ -200,4 +209,7 @@ jobs: run: go mod tidy - name: Check whether any tidying was needed - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code diff --git a/workflow-templates/check-license.yml b/workflow-templates/check-license.yml index dfcb63bf..c1e3c345 100644 --- a/workflow-templates/check-license.yml +++ b/workflow-templates/check-license.yml @@ -83,7 +83,9 @@ jobs: ruby-version: ruby # Install latest version - name: Install licensee - run: gem install licensee + run: | + gem install \ + licensee - name: Check license file for ${{ matrix.check-license.path }} run: | @@ -95,14 +97,26 @@ jobs: # See: https://github.com/licensee/licensee LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)" - DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')" + DETECTED_LICENSE_FILE="$( + echo "$LICENSEE_OUTPUT" \ + | \ + jq .matched_files[0].filename \ + | \ + tr --delete '\r' + )" echo "Detected license file: $DETECTED_LICENSE_FILE" if [ "$DETECTED_LICENSE_FILE" != "\"${{ matrix.check-license.expected-filename }}\"" ]; then echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: ${{ matrix.check-license.expected-filename }}" EXIT_STATUS=1 fi - DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')" + DETECTED_LICENSE_TYPE="$( + echo "$LICENSEE_OUTPUT" \ + | \ + jq .matched_files[0].matched_license \ + | \ + tr --delete '\r' + )" echo "Detected license type: $DETECTED_LICENSE_TYPE" if [ "$DETECTED_LICENSE_TYPE" != "\"${{ matrix.check-license.expected-type }}\"" ]; then echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${{ matrix.check-license.expected-type }}\"" diff --git a/workflow-templates/check-markdown-task.yml b/workflow-templates/check-markdown-task.yml index 05e1649d..6e9a25c9 100644 --- a/workflow-templates/check-markdown-task.yml +++ b/workflow-templates/check-markdown-task.yml @@ -112,4 +112,7 @@ jobs: version: 3.x - name: Check links - run: task --silent markdown:check-links + run: | + task \ + --silent \ + markdown:check-links diff --git a/workflow-templates/check-npm-dependencies-task.yml b/workflow-templates/check-npm-dependencies-task.yml index 7b0d21b8..0fab08cf 100644 --- a/workflow-templates/check-npm-dependencies-task.yml +++ b/workflow-templates/check-npm-dependencies-task.yml @@ -94,13 +94,21 @@ jobs: version: 3.x - name: Update dependencies license metadata cache - run: task --silent general:cache-dep-licenses + run: | + task \ + --silent \ + general:cache-dep-licenses - name: Check for outdated cache id: diff run: | git add . - if ! git diff --cached --color --exit-code; then + if + ! git diff \ + --cached \ + --color \ + --exit-code + then echo echo "::error::Dependency license metadata out of sync. See: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md#metadata-cache" exit 1 @@ -153,4 +161,7 @@ jobs: version: 3.x - name: Check for dependencies with unapproved licenses - run: task --silent general:check-dep-licenses + run: | + task \ + --silent \ + general:check-dep-licenses diff --git a/workflow-templates/check-npm-task.yml b/workflow-templates/check-npm-task.yml index 6573d007..1a0e43fb 100644 --- a/workflow-templates/check-npm-task.yml +++ b/workflow-templates/check-npm-task.yml @@ -80,7 +80,11 @@ jobs: version: 3.x - name: Validate package.json - run: task --silent npm:validate PROJECT_PATH="${{ matrix.project.path }}" + run: | + task \ + --silent \ + npm:validate \ + PROJECT_PATH="${{ matrix.project.path }}" check-sync: name: check-sync (${{ matrix.project.path }}) @@ -113,10 +117,16 @@ jobs: version: 3.x - name: Install npm dependencies - run: task npm:install-deps PROJECT_PATH="${{ matrix.project.path }}" + run: | + task npm:install-deps \ + PROJECT_PATH="${{ matrix.project.path }}" - name: Check package-lock.json - run: git diff --color --exit-code "${{ matrix.project.path }}/package-lock.json" + run: | + git diff \ + --color \ + --exit-code \ + "${{ matrix.project.path }}/package-lock.json" check-config: name: check-config (${{ matrix.project.path }}) @@ -150,14 +160,12 @@ jobs: - name: Fix problems in npm configuration file run: | - task \ - npm:fix-config \ + task npm:fix-config \ PROJECT_PATH="${{ matrix.project.path }}" - name: Check if fixes are needed in npm configuration file run: | - git \ - diff \ - --color \ - --exit-code \ - "${{ matrix.project.path }}/.npmrc" + git diff \ + --color \ + --exit-code \ + "${{ matrix.project.path }}/.npmrc" diff --git a/workflow-templates/check-prettier-formatting-task.yml b/workflow-templates/check-prettier-formatting-task.yml index b5e188a0..05712981 100644 --- a/workflow-templates/check-prettier-formatting-task.yml +++ b/workflow-templates/check-prettier-formatting-task.yml @@ -271,4 +271,7 @@ jobs: run: task general:format-prettier - name: Check formatting - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code diff --git a/workflow-templates/check-python-task.yml b/workflow-templates/check-python-task.yml index 721b36d5..600dc020 100644 --- a/workflow-templates/check-python-task.yml +++ b/workflow-templates/check-python-task.yml @@ -109,4 +109,7 @@ jobs: run: task python:format - name: Check formatting - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code diff --git a/workflow-templates/check-shell-task.yml b/workflow-templates/check-shell-task.yml index b8a4844b..7f426170 100644 --- a/workflow-templates/check-shell-task.yml +++ b/workflow-templates/check-shell-task.yml @@ -106,12 +106,17 @@ jobs: - name: Install ShellCheck run: | cd "${{ env.INSTALL_PATH }}" - tar --extract --file="${{ steps.download.outputs.name }}" + + tar \ + --extract \ + --file="${{ steps.download.outputs.name }}" + EXTRACTION_FOLDER="$( basename \ "${{ steps.download.outputs.name }}" \ "${{ env.SHELLCHECK_RELEASE_ASSET_SUFFIX }}" )" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.INSTALL_PATH }}/$EXTRACTION_FOLDER" >> "$GITHUB_PATH" @@ -121,12 +126,7 @@ jobs: continue-on-error: ${{ matrix.configuration.continue-on-error }} with: linters: gcc - run: | - task \ - --silent \ - shell:check \ - SCRIPT_PATH="${{ matrix.script }}" \ - SHELLCHECK_FORMAT=${{ matrix.configuration.format }} + run: task --silent shell:check SCRIPT_PATH="${{ matrix.script }}" SHELLCHECK_FORMAT=${{ matrix.configuration.format }} formatting: name: formatting (${{ matrix.script }}) @@ -171,9 +171,15 @@ jobs: - name: Install shfmt run: | # Executable permissions of release assets are lost - chmod +x "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" + chmod \ + +x \ + "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" + # Standardize binary name - mv "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" "${{ env.SHFMT_INSTALL_PATH }}/shfmt" + mv \ + "${{ env.SHFMT_INSTALL_PATH }}/${{ steps.download.outputs.name }}" \ + "${{ env.SHFMT_INSTALL_PATH }}/shfmt" + # Add installation to PATH: # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path echo "${{ env.SHFMT_INSTALL_PATH }}" >> "$GITHUB_PATH" @@ -186,7 +192,10 @@ jobs: SCRIPT_PATH="${{ matrix.script }}" - name: Check formatting - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code executable: name: executable (${{ matrix.script }}) diff --git a/workflow-templates/check-toc-task.yml b/workflow-templates/check-toc-task.yml index 7da949e2..40b85962 100644 --- a/workflow-templates/check-toc-task.yml +++ b/workflow-templates/check-toc-task.yml @@ -91,4 +91,7 @@ jobs: MAX_DEPTH=${{ matrix.file.maxdepth }} - name: Check ToC - run: git diff --color --exit-code + run: | + git diff \ + --color \ + --exit-code diff --git a/workflow-templates/check-workflows-task.yml b/workflow-templates/check-workflows-task.yml index 612db0b6..f05a5e2e 100644 --- a/workflow-templates/check-workflows-task.yml +++ b/workflow-templates/check-workflows-task.yml @@ -45,4 +45,7 @@ jobs: version: 3.x - name: Validate workflows - run: task --silent ci:validate + run: | + task \ + --silent \ + ci:validate diff --git a/workflow-templates/check-yaml-task.yml b/workflow-templates/check-yaml-task.yml index e43519af..43cf05db 100644 --- a/workflow-templates/check-yaml-task.yml +++ b/workflow-templates/check-yaml-task.yml @@ -107,4 +107,6 @@ jobs: - name: Check YAML continue-on-error: ${{ matrix.configuration.continue-on-error }} - run: task yaml:lint YAMLLINT_FORMAT=${{ matrix.configuration.format }} + run: | + task yaml:lint \ + YAMLLINT_FORMAT=${{ matrix.configuration.format }} diff --git a/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml b/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml index f27da384..19bd135f 100644 --- a/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml +++ b/workflow-templates/deploy-cobra-mkdocs-versioned-poetry.yml @@ -90,17 +90,25 @@ jobs: if: fromJson(steps.determine-versioning.outputs.data).version != null run: | # Publishing implies creating a git commit on the gh-pages branch, we let @ArduinoBot own these commits. - git config --global user.email "bot@arduino.cc" - git config --global user.name "ArduinoBot" + git config \ + --global \ + user.email "bot@arduino.cc" + + git config \ + --global \ + user.name "ArduinoBot" + git fetch \ --no-tags \ --prune \ --depth=1 \ origin \ +refs/heads/gh-pages:refs/remotes/origin/gh-pages - poetry run mike deploy \ - --update-aliases \ - --push \ - --remote origin \ - ${{ fromJson(steps.determine-versioning.outputs.data).version }} \ - ${{ fromJson(steps.determine-versioning.outputs.data).alias }} + + poetry run \ + mike deploy \ + --update-aliases \ + --push \ + --remote origin \ + ${{ fromJson(steps.determine-versioning.outputs.data).version }} \ + ${{ fromJson(steps.determine-versioning.outputs.data).alias }} diff --git a/workflow-templates/deploy-mkdocs-poetry.yml b/workflow-templates/deploy-mkdocs-poetry.yml index 06549af4..0a42e1b7 100644 --- a/workflow-templates/deploy-mkdocs-poetry.yml +++ b/workflow-templates/deploy-mkdocs-poetry.yml @@ -44,4 +44,6 @@ jobs: poetry:install-deps - name: Deploy website - run: poetry run mkdocs gh-deploy + run: | + poetry run \ + mkdocs gh-deploy diff --git a/workflow-templates/deploy-mkdocs-versioned-poetry.yml b/workflow-templates/deploy-mkdocs-versioned-poetry.yml index 80273511..9fcaa03e 100644 --- a/workflow-templates/deploy-mkdocs-versioned-poetry.yml +++ b/workflow-templates/deploy-mkdocs-versioned-poetry.yml @@ -78,17 +78,25 @@ jobs: if: fromJson(steps.determine-versioning.outputs.data).version != null run: | # Publishing implies creating a git commit on the gh-pages branch, we let @ArduinoBot own these commits. - git config --global user.email "bot@arduino.cc" - git config --global user.name "ArduinoBot" + git config \ + --global \ + user.email "bot@arduino.cc" + + git config \ + --global \ + user.name "ArduinoBot" + git fetch \ --no-tags \ --prune \ --depth=1 \ origin \ +refs/heads/gh-pages:refs/remotes/origin/gh-pages - poetry run mike deploy \ - --update-aliases \ - --push \ - --remote origin \ - ${{ fromJson(steps.determine-versioning.outputs.data).version }} \ - ${{ fromJson(steps.determine-versioning.outputs.data).alias }} + + poetry run \ + mike deploy \ + --update-aliases \ + --push \ + --remote origin \ + ${{ fromJson(steps.determine-versioning.outputs.data).version }} \ + ${{ fromJson(steps.determine-versioning.outputs.data).alias }} diff --git a/workflow-templates/publish-go-nightly-task.yml b/workflow-templates/publish-go-nightly-task.yml index 5709ad9c..7a29dbd1 100644 --- a/workflow-templates/publish-go-nightly-task.yml +++ b/workflow-templates/publish-go-nightly-task.yml @@ -111,10 +111,19 @@ jobs: # Arbitrary password for a keychain that exists only for the duration of the job, so not secret KEYCHAIN_PASSWORD: keychainpassword run: | - echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}" - security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" - security default-keychain -s "${{ env.KEYCHAIN }}" - security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" + echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode >"${{ env.INSTALLER_CERT_MAC_PATH }}" + + security create-keychain \ + -p "${{ env.KEYCHAIN_PASSWORD }}" \ + "${{ env.KEYCHAIN }}" + + security default-keychain \ + -s "${{ env.KEYCHAIN }}" + + security unlock-keychain \ + -p "${{ env.KEYCHAIN_PASSWORD }}" \ + "${{ env.KEYCHAIN }}" + security import \ "${{ env.INSTALLER_CERT_MAC_PATH }}" \ -k "${{ env.KEYCHAIN }}" \ @@ -122,6 +131,7 @@ jobs: -A \ -T /usr/bin/codesign \ -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}" + security set-key-partition-list \ -S apple-tool:,apple: \ -s \ @@ -130,13 +140,19 @@ jobs: - name: Install gon for code signing and app notarization run: | - wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip - unzip gon_macos.zip -d /usr/local/bin + wget \ + -q \ + https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip + + unzip \ + gon_macos.zip \ + -d /usr/local/bin - name: Write gon config to file # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) run: | - cat > "${{ env.GON_CONFIG_PATH }}" <"${{ env.GON_CONFIG_PATH }}" \ + <> $GITHUB_ENV + + tar \ + -czvf "$PACKAGE_FILENAME" \ + -C "${{ env.BUILD_FOLDER }}/" \ + "${{ env.PROJECT_NAME }}" \ + -C ../../ \ + LICENSE.txt + + echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >>$GITHUB_ENV - name: Replace artifact with notarized build uses: actions/upload-artifact@v4 @@ -211,7 +235,10 @@ jobs: aws-region: ${{ env.AWS_REGION }} - name: Upload release files on Arduino downloads servers - run: aws s3 sync ${{ env.DIST_DIR }} s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }}nightly + run: | + aws s3 sync \ + ${{ env.DIST_DIR }} \ + s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }}nightly report: runs-on: ubuntu-latest diff --git a/workflow-templates/publish-go-tester-task.yml b/workflow-templates/publish-go-tester-task.yml index 78e6c4c9..157c0cee 100644 --- a/workflow-templates/publish-go-tester-task.yml +++ b/workflow-templates/publish-go-tester-task.yml @@ -151,7 +151,11 @@ jobs: - name: Create checksum file run: | TAG="${{ needs.package-name-prefix.outputs.prefix }}git-snapshot" - declare -a artifacts=($(ls -d */)) + + declare \ + -a \ + artifacts=($(ls -d */)) + for artifact in ${artifacts[@]} do cd $artifact diff --git a/workflow-templates/release-go-crosscompile-task.yml b/workflow-templates/release-go-crosscompile-task.yml index dace9eda..037d0b24 100644 --- a/workflow-templates/release-go-crosscompile-task.yml +++ b/workflow-templates/release-go-crosscompile-task.yml @@ -106,6 +106,7 @@ jobs: run: | # See: https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable echo "BUILD_FOLDER=${{ env.PROJECT_NAME }}_osx_${{ matrix.build.folder-suffix }}" >> "$GITHUB_ENV" + TAG="${GITHUB_REF/refs\/tags\//}" echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}_${TAG}_${{ matrix.build.package-suffix }}" >> $GITHUB_ENV @@ -125,10 +126,19 @@ jobs: # Arbitrary password for a keychain that exists only for the duration of the job, so not secret KEYCHAIN_PASSWORD: keychainpassword run: | - echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}" - security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" - security default-keychain -s "${{ env.KEYCHAIN }}" - security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" + echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode >"${{ env.INSTALLER_CERT_MAC_PATH }}" + + security create-keychain \ + -p "${{ env.KEYCHAIN_PASSWORD }}" \ + "${{ env.KEYCHAIN }}" + + security default-keychain \ + -s "${{ env.KEYCHAIN }}" + + security unlock-keychain \ + -p "${{ env.KEYCHAIN_PASSWORD }}" \ + "${{ env.KEYCHAIN }}" + security import \ "${{ env.INSTALLER_CERT_MAC_PATH }}" \ -k "${{ env.KEYCHAIN }}" \ @@ -136,6 +146,7 @@ jobs: -A \ -T "/usr/bin/codesign" \ -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}" + security set-key-partition-list \ -S apple-tool:,apple: \ -s \ @@ -144,13 +155,19 @@ jobs: - name: Install gon for code signing and app notarization run: | - wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip - unzip gon_macos.zip -d /usr/local/bin + wget \ + -q \ + https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip + + unzip \ + gon_macos.zip \ + -d /usr/local/bin - name: Write gon config to file # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) run: | - cat > "${{ env.GON_CONFIG_PATH }}" <"${{ env.GON_CONFIG_PATH }}" \ + </tmp/semver && chmod +x /tmp/semver - if [[ "$(/tmp/semver get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then echo "IS_PRE=true" >> $GITHUB_OUTPUT; fi + wget \ + -q \ + -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.2.0.zip + + unzip \ + -p /tmp/3.2.0.zip semver-tool-3.2.0/src/semver \ + >/tmp/semver + + chmod \ + +x \ + /tmp/semver + + if [[ "$(/tmp/semver get prerel "${GITHUB_REF/refs\/tags\//}")" ]]; then + echo "IS_PRE=true" >>$GITHUB_OUTPUT + fi - name: Create Github Release and upload artifacts uses: ncipollo/release-action@v1 @@ -243,4 +276,7 @@ jobs: aws-region: ${{ env.AWS_REGION }} - name: Upload release files on Arduino downloads servers - run: aws s3 sync ${{ env.DIST_DIR }} s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }} + run: | + aws s3 sync \ + ${{ env.DIST_DIR }} \ + s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }} diff --git a/workflow-templates/release-go-task.yml b/workflow-templates/release-go-task.yml index 12689911..93067248 100644 --- a/workflow-templates/release-go-task.yml +++ b/workflow-templates/release-go-task.yml @@ -121,9 +121,17 @@ jobs: KEYCHAIN_PASSWORD: keychainpassword run: | echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}" - security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" - security default-keychain -s "${{ env.KEYCHAIN }}" - security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" + security create-keychain \ + -p "${{ env.KEYCHAIN_PASSWORD }}" \ + "${{ env.KEYCHAIN }}" + + security default-keychain \ + -s "${{ env.KEYCHAIN }}" + + security unlock-keychain \ + -p "${{ env.KEYCHAIN_PASSWORD }}" \ + "${{ env.KEYCHAIN }}" + security import \ "${{ env.INSTALLER_CERT_MAC_PATH }}" \ -k "${{ env.KEYCHAIN }}" \ @@ -131,6 +139,7 @@ jobs: -A \ -T "/usr/bin/codesign" \ -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}" + security set-key-partition-list \ -S apple-tool:,apple: \ -s \ @@ -139,13 +148,18 @@ jobs: - name: Install gon for code signing and app notarization run: | - wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip - unzip gon_macos.zip -d /usr/local/bin + wget \ + -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip + + unzip \ + gon_macos.zip \ + -d /usr/local/bin - name: Write gon config to file # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) run: | - cat > "${{ env.GON_CONFIG_PATH }}" <"${{ env.GON_CONFIG_PATH }}" \ + </tmp/semver && chmod +x /tmp/semver + wget \ + -q \ + -P /tmp \ + https://github.com/fsaintjacques/semver-tool/archive/3.2.0.zip + + unzip \ + -p \ + /tmp/3.2.0.zip \ + semver-tool-3.2.0/src/semver \ + >/tmp/semver + + chmod \ + +x \ + /tmp/semver + if [[ \ "$( /tmp/semver get prerel \ @@ -246,4 +278,7 @@ jobs: aws-region: ${{ env.AWS_REGION }} - name: Upload release files on Arduino downloads servers - run: aws s3 sync ${{ env.DIST_DIR }} s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }} + run: | + aws s3 sync \ + ${{ env.DIST_DIR }} \ + s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }} diff --git a/workflow-templates/release-tag.yml b/workflow-templates/release-tag.yml index f9015c20..16ee2ac5 100644 --- a/workflow-templates/release-tag.yml +++ b/workflow-templates/release-tag.yml @@ -48,9 +48,12 @@ jobs: unzip \ -p \ "${{ steps.download-semver-tool.outputs.file-path }}" \ - semver-tool-${{ env.SEMVER_TOOL_VERSION }}/src/semver > \ - "${{ env.SEMVER_TOOL_PATH }}" - chmod +x "${{ env.SEMVER_TOOL_PATH }}" + semver-tool-${{ env.SEMVER_TOOL_VERSION }}/src/semver \ + >"${{ env.SEMVER_TOOL_PATH }}" + + chmod \ + +x \ + "${{ env.SEMVER_TOOL_PATH }}" - name: Identify Prerelease id: prerelease