From 9267425add9189716edbd663f144b19c73aec0c1 Mon Sep 17 00:00:00 2001 From: sbp-bvanb Date: Mon, 2 Dec 2024 21:02:44 +0100 Subject: [PATCH] fix: Install Regal on Linux --- Taskfile.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 3fec7d5..3dc80d4 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -4,6 +4,9 @@ --- version: "3" vars: + # Variables that have to be defined first as they are used in other variables + OS_TYPE_MAC: Darwin + # Variables that are sorted alphabetically and are used in the tasks BUILD_TAGS: component,e2e,integration COVERPROFILE: profile.cov GCI: "{{.GOBIN}}/gci" @@ -13,7 +16,7 @@ vars: GOLANGCI_LINT_VERSION: 1.61.0 GOLANG_PARALLEL_TESTS: sh: | - if [ "$(uname -s)" = "Darwin" ]; then + if [ "$(uname -s)" = "{{.OS_TYPE_MAC}}" ]; then sysctl -n hw.ncpu else nproc @@ -26,11 +29,16 @@ vars: MOCKERY_VERSION: "{{.MOCKERY_MAJOR_VERSION}}.46.0" OPA_FMT: "{{.GOBIN}}/opa fmt ." OPA_VERSION: v0.70.0 + OS_COMMAND: uname + OS_COMMAND_TYPE: + sh: "{{.OS_COMMAND}} -s" + OS_COMMAND_TYPE_ARCHITECTURE: + sh: "{{.OS_COMMAND}} -m" REGAL: "{{.GOBIN}}/regal" REGAL_VERSION: 0.29.2 SED_INSERT_ADDITION: sh: | - if [ "$(uname -s)" = "Darwin" ]; then + if [ "{{.OS_COMMAND}}" = "{{.OS_TYPE_MAC}}" ]; then echo "\"\"" fi YQ_MAJOR_VERSION: v4 @@ -241,7 +249,7 @@ tasks: if ! regal version | grep -q {{.REGAL_VERSION}}; then # regal version installed using `go install` does not include # version, see: https://github.com/StyraInc/regal/issues/1275 - curl -L -o {{.REGAL}} https://github.com/StyraInc/regal/releases/download/v{{.REGAL_VERSION}}/regal_Darwin_arm64 + curl -L -o {{.REGAL}} https://github.com/StyraInc/regal/releases/download/v{{.REGAL_VERSION}}/regal_{{.OS_COMMAND_TYPE}}_{{.OS_COMMAND_TYPE_ARCHITECTURE}} chmod +x {{.REGAL}} fi regal-run: