diff --git a/.github/workflows/check-clang-format.yml b/.github/workflows/check-clang-format.yml index 5afd6804..cf8600d8 100644 --- a/.github/workflows/check-clang-format.yml +++ b/.github/workflows/check-clang-format.yml @@ -84,7 +84,6 @@ jobs: 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" - name: Download ClangFormat @@ -108,26 +107,6 @@ jobs: # See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#adding-a-system-path echo "${{ env.CLANG_FORMAT_INSTALL_PATH }}/clang_Linux_64bit" >>"$GITHUB_PATH" - - name: Download yq - id: download-yq - uses: MrOctopus/download-asset-action@1.0 - with: - repository: mikefarah/yq - asset: yq_linux_amd64.tar.gz - target: ${{ env.YQ_INSTALL_PATH }} - - - name: Install yq - run: | - cd "${{ env.YQ_INSTALL_PATH }}" - - tar \ - --extract \ - --file="${{ steps.download-yq.outputs.name }}" - - # Add installation to PATH: - # See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#adding-a-system-path - echo "${{ env.YQ_INSTALL_PATH }}/yq" >>"$GITHUB_PATH" - - name: Check ClangFormat configuration file id: check run: | diff --git a/.github/workflows/check-poetry-task.yml b/.github/workflows/check-poetry-task.yml index dd66c838..f3dfea7a 100644 --- a/.github/workflows/check-poetry-task.yml +++ b/.github/workflows/check-poetry-task.yml @@ -6,12 +6,16 @@ on: push: paths: - ".github/workflows/check-poetry-task.ya?ml" + - "go.mod" + - "go.sum" - "poetry.lock" - "pyproject.toml" - "Taskfile.ya?ml" pull_request: paths: - ".github/workflows/check-poetry-task.ya?ml" + - "go.mod" + - "go.sum" - "poetry.lock" - "pyproject.toml" - "Taskfile.ya?ml" @@ -57,6 +61,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Python uses: actions/setup-python@v5 with: diff --git a/.github/workflows/check-python-task.yml b/.github/workflows/check-python-task.yml index f375d421..c666ffbe 100644 --- a/.github/workflows/check-python-task.yml +++ b/.github/workflows/check-python-task.yml @@ -11,6 +11,8 @@ on: - "**/poetry.lock" - "**/pyproject.toml" - "**/setup.cfg" + - "go.mod" + - "go.sum" - "Taskfile.ya?ml" - "**/tox.ini" - "**.py" @@ -21,6 +23,8 @@ on: - "**/poetry.lock" - "**/pyproject.toml" - "**/setup.cfg" + - "go.mod" + - "go.sum" - "Taskfile.ya?ml" - "**/tox.ini" - "**.py" @@ -66,6 +70,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Python uses: actions/setup-python@v5 with: diff --git a/.github/workflows/check-yaml-task.yml b/.github/workflows/check-yaml-task.yml index b58e1dc4..737c7173 100644 --- a/.github/workflows/check-yaml-task.yml +++ b/.github/workflows/check-yaml-task.yml @@ -6,6 +6,8 @@ on: create: push: paths: + - "go.mod" + - "go.sum" - ".yamllint*" - "poetry.lock" - "pyproject.toml" @@ -22,6 +24,8 @@ on: - "**.syntax" pull_request: paths: + - "go.mod" + - "go.sum" - ".yamllint*" - "poetry.lock" - "pyproject.toml" @@ -94,6 +98,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Python uses: actions/setup-python@v5 with: diff --git a/.github/workflows/test-python-poetry-task.yml b/.github/workflows/test-python-poetry-task.yml index 5966cfe2..461c7c27 100644 --- a/.github/workflows/test-python-poetry-task.yml +++ b/.github/workflows/test-python-poetry-task.yml @@ -7,6 +7,8 @@ on: push: paths: - ".github/workflows/test-python-poetry-task.ya?ml" + - "go.mod" + - "go.sum" - "Taskfile.ya?ml" - "poetry.lock" - "pyproject.toml" @@ -15,6 +17,8 @@ on: pull_request: paths: - ".github/workflows/test-python-poetry-task.ya?ml" + - "go.mod" + - "go.sum" - "Taskfile.ya?ml" - "poetry.lock" - "pyproject.toml" @@ -62,6 +66,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Python uses: actions/setup-python@v5 with: diff --git a/Taskfile.yml b/Taskfile.yml index 99db7ab9..50b935aa 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -259,10 +259,11 @@ tasks: cmds: - | if - ! which yq \ + ! which go \ &>/dev/null then - echo "ec not found or not in PATH. Please install: https://github.com/mikefarah/yq/#install" + echo "Go not found or not in PATH." + echo "Please install: https://go.dev/doc/install" exit 1 fi @@ -282,22 +283,25 @@ tasks: # 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}}" + go tool \ + github.com/mikefarah/yq/v4 \ + --inplace \ + 'del(.BasedOnStyle)' \ + "{{.TARGET_PATH}}" - yq \ - --inplace \ - '.BasedOnStyle = "LLVM"' \ - "{{.TARGET_PATH}}" + go tool \ + github.com/mikefarah/yq/v4 \ + --inplace \ + '.BasedOnStyle = "LLVM"' \ + "{{.TARGET_PATH}}" - | # Fix the inconsistent key order - yq \ - --inplace \ - 'sort_keys(.)' \ - "{{.TARGET_PATH}}" + go tool \ + github.com/mikefarah/yq/v4 \ + --inplace \ + 'sort_keys(.)' \ + "{{.TARGET_PATH}}" # Use ClangFormat to format the files under the path specified by TARGET_FOLDER recursively clang-format:format: @@ -964,11 +968,11 @@ tasks: cmds: - | if - ! which yq \ + ! which go \ &>/dev/null then - echo "yq not found or not in PATH." - echo "Please install: https://github.com/mikefarah/yq/#install" + echo "Go not found or not in PATH." + echo "Please install: https://go.dev/doc/install" exit 1 fi - | @@ -977,10 +981,11 @@ tasks: &>/dev/null then python_constraint="$( \ - yq \ - --input-format toml \ - --output-format yaml \ - '.tool.poetry.dependencies.python' \ + go tool \ + github.com/mikefarah/yq/v4 \ + --input-format toml \ + --output-format yaml \ + '.tool.poetry.dependencies.python' \ /dev/null then - echo "yq not found or not in PATH." - echo "Please install: https://github.com/mikefarah/yq/#install" + echo "Go not found or not in PATH." + echo "Please install: https://go.dev/doc/install" exit 1 fi - | @@ -22,10 +22,11 @@ tasks: &>/dev/null then python_constraint="$( \ - yq \ - --input-format toml \ - --output-format yaml \ - '.tool.poetry.dependencies.python' \ + go tool \ + github.com/mikefarah/yq/v4 \ + --input-format toml \ + --output-format yaml \ + '.tool.poetry.dependencies.python' \ +``` + +(where `` is the URL of the project repository without the scheme e.g., `github.com/foo/bar`) + +Add the tool dependencies by running the following command: + +``` +go get -tool github.com/mikefarah/yq/v4@v4.47.2 +``` + +Commit the resulting changes to the `go.mod` and `go.sum` files. + ## Readme badge Markdown badge: diff --git a/workflow-templates/check-poetry-task.yml b/workflow-templates/check-poetry-task.yml index dd66c838..f3dfea7a 100644 --- a/workflow-templates/check-poetry-task.yml +++ b/workflow-templates/check-poetry-task.yml @@ -6,12 +6,16 @@ on: push: paths: - ".github/workflows/check-poetry-task.ya?ml" + - "go.mod" + - "go.sum" - "poetry.lock" - "pyproject.toml" - "Taskfile.ya?ml" pull_request: paths: - ".github/workflows/check-poetry-task.ya?ml" + - "go.mod" + - "go.sum" - "poetry.lock" - "pyproject.toml" - "Taskfile.ya?ml" @@ -57,6 +61,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Python uses: actions/setup-python@v5 with: diff --git a/workflow-templates/check-python-task.md b/workflow-templates/check-python-task.md index 049cef6d..605e07e5 100644 --- a/workflow-templates/check-python-task.md +++ b/workflow-templates/check-python-task.md @@ -25,6 +25,26 @@ The code style defined in `pyproject.toml` and `.flake8` is the official standar ### Dependencies +#### Go Module-Managed Dependencies + +If the project does not already have a `go.mod` file, [install **Go**](https://go.dev/doc/install) and then run the following command: + +```text +go mod init +``` + +(where `` is the URL of the project repository without the scheme e.g., `github.com/foo/bar`) + +Add the tool dependencies by running the following command: + +``` +go get -tool github.com/mikefarah/yq/v4@v4.47.2 +``` + +Commit the resulting changes to the `go.mod` and `go.sum` files. + +#### Poetry-Managed Dependencies + Add the tool dependencies using this command: ``` diff --git a/workflow-templates/check-python-task.yml b/workflow-templates/check-python-task.yml index f375d421..c666ffbe 100644 --- a/workflow-templates/check-python-task.yml +++ b/workflow-templates/check-python-task.yml @@ -11,6 +11,8 @@ on: - "**/poetry.lock" - "**/pyproject.toml" - "**/setup.cfg" + - "go.mod" + - "go.sum" - "Taskfile.ya?ml" - "**/tox.ini" - "**.py" @@ -21,6 +23,8 @@ on: - "**/poetry.lock" - "**/pyproject.toml" - "**/setup.cfg" + - "go.mod" + - "go.sum" - "Taskfile.ya?ml" - "**/tox.ini" - "**.py" @@ -66,6 +70,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Python uses: actions/setup-python@v5 with: diff --git a/workflow-templates/check-yaml-task.md b/workflow-templates/check-yaml-task.md index 074b56ce..d8e88845 100644 --- a/workflow-templates/check-yaml-task.md +++ b/workflow-templates/check-yaml-task.md @@ -27,6 +27,26 @@ The code style defined in this file is the official standardized style to be use ### Dependencies +#### Go Module-Managed Dependencies + +If the project does not already have a `go.mod` file, [install **Go**](https://go.dev/doc/install) and then run the following command: + +```text +go mod init +``` + +(where `` is the URL of the project repository without the scheme e.g., `github.com/foo/bar`) + +Add the tool dependencies by running the following command: + +``` +go get -tool github.com/mikefarah/yq/v4@v4.47.2 +``` + +Commit the resulting changes to the `go.mod` and `go.sum` files. + +#### Poetry-Managed Dependencies + Add the tool dependency using this command: ``` diff --git a/workflow-templates/check-yaml-task.yml b/workflow-templates/check-yaml-task.yml index b58e1dc4..737c7173 100644 --- a/workflow-templates/check-yaml-task.yml +++ b/workflow-templates/check-yaml-task.yml @@ -6,6 +6,8 @@ on: create: push: paths: + - "go.mod" + - "go.sum" - ".yamllint*" - "poetry.lock" - "pyproject.toml" @@ -22,6 +24,8 @@ on: - "**.syntax" pull_request: paths: + - "go.mod" + - "go.sum" - ".yamllint*" - "poetry.lock" - "pyproject.toml" @@ -94,6 +98,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Python uses: actions/setup-python@v5 with: diff --git a/workflow-templates/deploy-mkdocs-poetry.md b/workflow-templates/deploy-mkdocs-poetry.md index 77761eeb..be83db45 100644 --- a/workflow-templates/deploy-mkdocs-poetry.md +++ b/workflow-templates/deploy-mkdocs-poetry.md @@ -23,6 +23,26 @@ Install the [`deploy-mkdocs-poetry.yml`](deploy-mkdocs-poetry.yml) GitHub Action ### Dependencies +#### Go Module-Managed Dependencies + +If the project does not already have a `go.mod` file, [install **Go**](https://go.dev/doc/install) and then run the following command: + +```text +go mod init +``` + +(where `` is the URL of the project repository without the scheme e.g., `github.com/foo/bar`) + +Add the tool dependencies by running the following command: + +``` +go get -tool github.com/mikefarah/yq/v4@v4.47.2 +``` + +Commit the resulting changes to the `go.mod` and `go.sum` files. + +#### Poetry-Managed Dependencies + Add the tool dependencies using this command: ``` diff --git a/workflow-templates/deploy-mkdocs-poetry.yml b/workflow-templates/deploy-mkdocs-poetry.yml index 3634fac6..401d6542 100644 --- a/workflow-templates/deploy-mkdocs-poetry.yml +++ b/workflow-templates/deploy-mkdocs-poetry.yml @@ -9,6 +9,8 @@ on: - main paths: - ".github/workflows/deploy-mkdocs-poetry.ya?ml" + - "go.mod" + - "go.sum" - "mkdocs.ya?ml" - "poetry.lock" - "pyproject.toml" diff --git a/workflow-templates/spell-check-task.md b/workflow-templates/spell-check-task.md index 959011c9..ce2d5f7e 100644 --- a/workflow-templates/spell-check-task.md +++ b/workflow-templates/spell-check-task.md @@ -21,6 +21,26 @@ Install the [spell-check-task.yml](spell-check-task.yml) GitHub Actions workflow ### Dependencies +#### Go Module-Managed Dependencies + +If the project does not already have a `go.mod` file, [install **Go**](https://go.dev/doc/install) and then run the following command: + +```text +go mod init +``` + +(where `` is the URL of the project repository without the scheme e.g., `github.com/foo/bar`) + +Add the tool dependencies by running the following command: + +``` +go get -tool github.com/mikefarah/yq/v4@v4.47.2 +``` + +Commit the resulting changes to the `go.mod` and `go.sum` files. + +#### Poetry-Managed Dependencies + The `codespell` tool dependency is managed by [Poetry](https://python-poetry.org/). Install Poetry by following these instructions:
diff --git a/workflow-templates/test-go-integration-task.md b/workflow-templates/test-go-integration-task.md index 433cd43c..cc7c53f9 100644 --- a/workflow-templates/test-go-integration-task.md +++ b/workflow-templates/test-go-integration-task.md @@ -29,6 +29,26 @@ Install the [`test-go-integration-task.yml`](test-go-integration-task.yml) GitHu ### Dependencies +#### Go Module-Managed Dependencies + +If the project does not already have a `go.mod` file, [install **Go**](https://go.dev/doc/install) and then run the following command: + +```text +go mod init +``` + +(where `` is the URL of the project repository without the scheme e.g., `github.com/foo/bar`) + +Add the tool dependencies by running the following command: + +``` +go get -tool github.com/mikefarah/yq/v4@v4.47.2 +``` + +Commit the resulting changes to the `go.mod` and `go.sum` files. + +#### Poetry-Managed Dependencies + Add the tool dependencies using this command: ``` diff --git a/workflow-templates/test-python-poetry-task.md b/workflow-templates/test-python-poetry-task.md index bf9ada6d..7dc82461 100644 --- a/workflow-templates/test-python-poetry-task.md +++ b/workflow-templates/test-python-poetry-task.md @@ -27,6 +27,26 @@ Install the [`test-python-poetry-task.yml`](test-python-poetry-task.yml) GitHub ### Dependencies +#### Go Module-Managed Dependencies + +If the project does not already have a `go.mod` file, [install **Go**](https://go.dev/doc/install) and then run the following command: + +```text +go mod init +``` + +(where `` is the URL of the project repository without the scheme e.g., `github.com/foo/bar`) + +Add the tool dependencies by running the following command: + +``` +go get -tool github.com/mikefarah/yq/v4@v4.47.2 +``` + +Commit the resulting changes to the `go.mod` and `go.sum` files. + +#### Poetry-Managed Dependencies + Add the tool dependency using this command: ``` diff --git a/workflow-templates/test-python-poetry-task.yml b/workflow-templates/test-python-poetry-task.yml index 5966cfe2..461c7c27 100644 --- a/workflow-templates/test-python-poetry-task.yml +++ b/workflow-templates/test-python-poetry-task.yml @@ -7,6 +7,8 @@ on: push: paths: - ".github/workflows/test-python-poetry-task.ya?ml" + - "go.mod" + - "go.sum" - "Taskfile.ya?ml" - "poetry.lock" - "pyproject.toml" @@ -15,6 +17,8 @@ on: pull_request: paths: - ".github/workflows/test-python-poetry-task.ya?ml" + - "go.mod" + - "go.sum" - "Taskfile.ya?ml" - "poetry.lock" - "pyproject.toml" @@ -62,6 +66,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v5 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - name: Install Python uses: actions/setup-python@v5 with: