Skip to content

Commit 526edf9

Browse files
authored
Merge pull request #516 from bpickard22/makefile-updates
Skip Static test
2 parents 5d5a98d + a7ae952 commit 526edf9

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ COMPUTE_NODES ?= 2
99

1010
OCI_BIN ?= docker
1111

12+
1213
build:
1314
hack/build-go.sh
1415

@@ -23,7 +24,10 @@ install-tools:
2324
hack/install-kubebuilder-tools.sh
2425

2526
test: build install-tools
26-
hack/test-go.sh
27+
hack/test-go.sh
28+
29+
test-skip-static: build
30+
hack/test-go.sh --skip-static-check
2731

2832
kind:
2933
hack/e2e-setup-kind-cluster.sh -n $(COMPUTE_NODES)

hack/test-go.sh

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
11
#!/usr/bin/env bash
22
# single test: go test -v ./pkg/storage/
33
# without cache: go test -count=1 -v ./pkg/storage/
4-
set -e -x
4+
set -eox pipefail
55

66
GO=${GO:-go}
7+
SKIP_STATIC_CHECK=$false
8+
#parse args
9+
while [[ $# -gt 0 ]]; do
10+
case "$1" in
11+
-s|--skip-static-check)
12+
SKIP_STATIC_CHECK=true
13+
shift
14+
;;
15+
*)
16+
echo "Invalid arguement: $1"
17+
echo "Usage: $0 [-s|--skip-static-check]"
18+
exit 1
19+
esac
20+
done
721

822
echo "Running go vet ..."
923
${GO} vet --tags=test ./cmd/... ./pkg/...
1024

1125
BASEDIR=$(pwd)
1226

13-
echo "Installing golang staticcheck ..."
14-
GOBIN=${BASEDIR}/bin go install honnef.co/go/tools/cmd/staticcheck@latest
15-
16-
echo "Running golang staticcheck ..."
17-
${BASEDIR}/bin/staticcheck --tags=test ./...
27+
if [ $SKIP_STATIC_CHECK ]
28+
then
29+
echo "Skipped golang staticcheck"
30+
else
31+
echo "Installing golang staticcheck ..."
32+
GOBIN=${BASEDIR}/bin go install honnef.co/go/tools/cmd/staticcheck@latest
33+
echo "Running golang staticcheck ..."
34+
${BASEDIR}/bin/staticcheck --tags=test ./...
35+
fi
1836

1937
echo "Running go tests..."
2038
KUBEBUILDER_ASSETS="$(pwd)/bin" ${GO} test \

0 commit comments

Comments
 (0)