diff --git a/Dockerfile.dapper b/Dockerfile.dapper index 158a099..4561f45 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -14,6 +14,8 @@ RUN export K8S_VERSION=1.24.2 && \ mkdir /usr/local/kubebuilder && \ tar -C /usr/local/kubebuilder --strip-components=1 -zvxf envtest-bins.tar.gz +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2 + ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS ENV DAPPER_SOURCE /go/src/github.com/harvester/vm-import-controller ENV DAPPER_OUTPUT ./bin diff --git a/scripts/ci b/scripts/ci index 6607ef3..0be4c44 100755 --- a/scripts/ci +++ b/scripts/ci @@ -3,5 +3,6 @@ set -e cd $(dirname $0) +./validate ./build ./test diff --git a/scripts/validate b/scripts/validate new file mode 100644 index 0000000..c5cb8a9 --- /dev/null +++ b/scripts/validate @@ -0,0 +1,18 @@ +#!/bin/bash +set -e + +cd $(dirname $0)/.. + +echo "Running validation" + +if [[ -z "$(command -v golangci-lint)" ]]; then + echo "no golangci-lint available, using go fmt/vet instead" + echo "Running: go fmt" + go fmt ./... + echo "Running: go vet" + go vet -tags=test ./... + exit +fi + +echo "Running: golangci-lint run" +golangci-lint run