From edeee480411b0e66fce968f647f22b199860b691 Mon Sep 17 00:00:00 2001 From: Rebecca Roberts Date: Thu, 11 Apr 2024 17:53:08 +0000 Subject: [PATCH 1/3] feat: Add scripts for testing and linting Signed-off-by: Carson Long <12767276+ctlong@users.noreply.github.com> --- scripts/subtests/lint | 18 ++++++++++++++++++ scripts/subtests/unit-test | 11 +++++++++++ scripts/test | 10 ++++++++++ 3 files changed, 39 insertions(+) create mode 100755 scripts/subtests/lint create mode 100755 scripts/subtests/unit-test create mode 100755 scripts/test diff --git a/scripts/subtests/lint b/scripts/subtests/lint new file mode 100755 index 000000000..7b3a8d08a --- /dev/null +++ b/scripts/subtests/lint @@ -0,0 +1,18 @@ +#!/bin/bash + +set -eux +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +set +e +golangci_lint_executable=$(which golangci-lint) +set +e +if [ -z "${golangci_lint_executable}" ] || [ ! -x "${golangci_lint_executable}" ]; then + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest +fi + +pushd "${SCRIPT_DIR}/../../src" > /dev/null + golangci-lint run ./... +popd > /dev/null + diff --git a/scripts/subtests/unit-test b/scripts/subtests/unit-test new file mode 100755 index 000000000..1d50d7eea --- /dev/null +++ b/scripts/subtests/unit-test @@ -0,0 +1,11 @@ +#!/bin/bash + +set -eux +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +pushd "${SCRIPT_DIR}/../../src" > /dev/null + go run github.com/onsi/ginkgo/v2/ginkgo -r -p --randomize-all --randomize-suites --fail-on-pending --keep-going --race --trace +popd > /dev/null + diff --git a/scripts/test b/scripts/test new file mode 100755 index 000000000..382cecd0a --- /dev/null +++ b/scripts/test @@ -0,0 +1,10 @@ +#!/bin/bash + +set -eux +set -o pipefail + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +"${SCRIPT_DIR}/subtests/lint" +"${SCRIPT_DIR}/subtests/unit-test" + From 24a0a0883de683bb3f7217b78faea740917ac956 Mon Sep 17 00:00:00 2001 From: Carson Long <12767276+ctlong@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:53:35 +0000 Subject: [PATCH 2/3] fix: Remove unused .envrc Signed-off-by: Rebecca Roberts --- .envrc | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .envrc diff --git a/.envrc b/.envrc deleted file mode 100644 index e04b6ccce..000000000 --- a/.envrc +++ /dev/null @@ -1,2 +0,0 @@ -export PROJECT_DIR=$PWD -export GO111MODULE=on From 804418c647abc104358b15ea18477bb3992f6507 Mon Sep 17 00:00:00 2001 From: Rebecca Roberts Date: Thu, 11 Apr 2024 18:17:19 +0000 Subject: [PATCH 3/3] fix: scripts/subtests/lint errors on failure Signed-off-by: Carson Long <12767276+ctlong@users.noreply.github.com> --- scripts/subtests/lint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/subtests/lint b/scripts/subtests/lint index 7b3a8d08a..bb8f5c95b 100755 --- a/scripts/subtests/lint +++ b/scripts/subtests/lint @@ -7,7 +7,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" set +e golangci_lint_executable=$(which golangci-lint) -set +e +set -e if [ -z "${golangci_lint_executable}" ] || [ ! -x "${golangci_lint_executable}" ]; then go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest fi