restructuring logic and adding more inputs #2
@@ -3,7 +3,7 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
version=$(go version);
|
version=$(go version);
|
||||||
if [[ -z "$version" ]]; then
|
if [ -z "$version" ]; then
|
||||||
echo "[FATAL] golang is not installed";
|
echo "[FATAL] golang is not installed";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
@@ -13,6 +13,6 @@ echo "[DEBUG] $version found in install.sh";
|
|||||||
go install golang.org/x/vuln/cmd/govulncheck@latest
|
go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
go install github.com/securego/gosec/v2/cmd/gosec@latest
|
go install github.com/securego/gosec/v2/cmd/gosec@latest
|
||||||
|
|
||||||
if [[ "$TEST_LIBRARY" == "ginkgo" ]]; then
|
if [ "$TEST_LIBRARY" == "ginkgo" ]; then
|
||||||
go install github.com/onsi/ginkgo/v2/ginkgo@$TEST_VERSION
|
go install github.com/onsi/ginkgo/v2/ginkgo@$TEST_VERSION
|
||||||
fi
|
fi
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
if [[ "$STATIC_FLAG" == "no" && "$VULN_CHECK" == "no" ]]; then
|
if [ "$STATIC_FLAG" == "no" && "$VULN_CHECK" == "no" ]; then
|
||||||
echo "[INFO] no security flags set, skipping!";
|
echo "[INFO] no security flags set, skipping!";
|
||||||
exit 0;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
@@ -13,15 +13,16 @@ echo "[DEBUG] $toolchain found in go.mod";
|
|||||||
version=$(go env -json | jq -r ".GOVERSION");
|
version=$(go env -json | jq -r ".GOVERSION");
|
||||||
echo "[DEBUG] $version found in go env";
|
echo "[DEBUG] $version found in go env";
|
||||||
|
|
||||||
if [[ ! -z "$toolchain" ]]; then
|
if [ ! -z "$toolchain" ]; then
|
||||||
|
echo "[DEBUG] overwriting version with toolchain";
|
||||||
version=$toolchain;
|
version=$toolchain;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$STATIC_FLAG" == "yes" ]]; then
|
if [ "$STATIC_FLAG" == "yes" ]; then
|
||||||
if GOTOOLCHAIN=$version gosec ./...; then
|
if GOTOOLCHAIN=$version gosec ./...; then
|
||||||
echo "[INFO] gosec passed!";
|
echo "[INFO] gosec passed!";
|
||||||
else
|
else
|
||||||
if [[ "$STATIC_FAIL" == "yes" ]]; then
|
if [ "$STATIC_FAIL" == "yes" ]; then
|
||||||
echo "[FATAL] gosec failed!";
|
echo "[FATAL] gosec failed!";
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
else
|
||||||
@@ -30,11 +31,11 @@ if [[ "$STATIC_FLAG" == "yes" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$VULN_CHECK" == "yes" ]]; then
|
if [ "$VULN_CHECK" == "yes" ]; then
|
||||||
if GOTOOLCHAIN=$version govulncheck ./...; then
|
if GOTOOLCHAIN=$version govulncheck ./...; then
|
||||||
echo "[INFO] govulncheck passed!";
|
echo "[INFO] govulncheck passed!";
|
||||||
else
|
else
|
||||||
if [[ "$VULN_FAIL" == "yes" ]]; then
|
if [ "$VULN_FAIL" == "yes" ]; then
|
||||||
echo "[FATAL] govulncheck failed!"
|
echo "[FATAL] govulncheck failed!"
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
else
|
||||||
|
|||||||
10
src/test.sh
10
src/test.sh
@@ -2,18 +2,18 @@
|
|||||||
|
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
if [[ "$TEST_LIBRARY" == "none" ]]; then
|
if [ "$TEST_LIBRARY" == "none" ]; then
|
||||||
echo "[INFO] test-library input not set, skipping unit tests.";
|
echo "[INFO] test-library input not set, skipping unit tests.";
|
||||||
exit 0;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[INFO] running unit tests";
|
echo "[INFO] running unit tests";
|
||||||
if [[ "$TEST_LIBRARY" == "standard" ]]; then
|
if [ "$TEST_LIBRARY" == "standard" ]; then
|
||||||
if go test ./...; then
|
if go test ./...; then
|
||||||
echo "[INFO] unit tests passed!";
|
echo "[INFO] unit tests passed!";
|
||||||
exit 0;
|
exit 0;
|
||||||
else
|
else
|
||||||
if [[ "$TEST_FAIL" == "yes" ]]; then
|
if [ "$TEST_FAIL" == "yes" ]; then
|
||||||
echo "[FATAL] unit tests failed!";
|
echo "[FATAL] unit tests failed!";
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
else
|
||||||
@@ -22,12 +22,12 @@ if [[ "$TEST_LIBRARY" == "standard" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$TEST_LIBRARY" == "ginkgo" ]]; then
|
if [ "$TEST_LIBRARY" == "ginkgo" ]; then
|
||||||
if ginkgo ./...; then
|
if ginkgo ./...; then
|
||||||
echo "[INFO] unit tests passed!";
|
echo "[INFO] unit tests passed!";
|
||||||
exit 0;
|
exit 0;
|
||||||
else
|
else
|
||||||
if [[ "$TEST_FAIL" == "yes" ]]; then
|
if [ "$TEST_FAIL" == "yes" ]; then
|
||||||
echo "[FATAL] unit tests failed!";
|
echo "[FATAL] unit tests failed!";
|
||||||
exit 1;
|
exit 1;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user