From 250a880c8221f43f13a3d0a9d3cdbe48d0b5e59f Mon Sep 17 00:00:00 2001 From: sbp-bvanb <126502840+sbp-bvanb@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:32:14 +0100 Subject: [PATCH] fix: Omit ~/go/bin from task (#151) --- Taskfile.yml | 14 ++++++++++++-- action.yml | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 863171d..e720f3c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -15,6 +15,11 @@ vars: GOBIN: sh: | if [ -z "${GOBIN}" ]; then + if [ -n "${GITHUB_ACTIONS}" ]; then + echo /home/runner/go/bin + exit 0 + fi + echo "GOBIN has not been not set. Ensure that it has been set on the system." exit 1 fi @@ -157,6 +162,11 @@ tasks: cmds: - task: gci-install - "{{.GCI}} write --skip-generated {{.GCI_SECTIONS}} ." + golang-log: + cmds: + - | + echo "GOBIN: {{.GOBIN}}" + echo "GOLANG_PARALLEL_TESTS: {{.GOLANG_PARALLEL_TESTS}}" golangci-lint-install: silent: true cmds: @@ -169,8 +179,8 @@ tasks: golangci-lint-run: silent: true cmds: + - task: golang-log - | - echo "GOLANG_PARALLEL_TESTS: {{.GOLANG_PARALLEL_TESTS}}" golangci-lint run \ --build-tags {{.BUILD_TAGS}} \ --concurrency {{.GOLANG_PARALLEL_TESTS}} \ @@ -325,8 +335,8 @@ tasks: desc: run unit tests silent: true cmds: + - task: golang-log - | - echo "GOLANG_PARALLEL_TESTS: {{.GOLANG_PARALLEL_TESTS}}" go test \ -p {{.GOLANG_PARALLEL_TESTS}} \ -race \ diff --git a/action.yml b/action.yml index 292cb10..ead606f 100644 --- a/action.yml +++ b/action.yml @@ -54,7 +54,7 @@ runs: if: inputs.testing-type == 'component' || inputs.testing-type == 'coverage' || inputs.testing-type == 'integration' || inputs.testing-type == 'lint' || inputs.testing-type == 'unit' shell: bash run: | - if ! ~/go/bin/task --version | grep -q "Task version: ${{ inputs.task-version }}"; then + if ! task --version | grep -q "Task version: ${{ inputs.task-version }}"; then major_version=$(echo "${{ inputs.task-version }}" | sed -E 's/^v([0-9]+).*/\1/') go install github.com/go-task/task/v${major_version}/cmd/task@${{ inputs.task-version }} fi