From 5be552bb85b2a9ece17816a98d5512ed165fa980 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Mon, 24 Sep 2018 10:03:24 -0700 Subject: [PATCH] Add linters to CI --- .circleci/config.yml | 28 +++++++++++++++++++++++----- .golangci.yml | 13 +++++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 .golangci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 183f9bee0..886666bfb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,10 +1,24 @@ version: 2 jobs: - build: + validate: docker: - # specify the version - image: circleci/golang:1.10 + working_directory: /go/src/github.com/virtual-kubelet/virtual-kubelet + steps: + - checkout + - run: + name: Install linters + command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.10.2 && mv ./bin/* /go/bin/ + - run: + name: Lint + command: golangci-lint run --new-from-rev "HEAD~$(git rev-list master.. --count)" ./... + - run: + name: Dependencies + command: scripts/validate/dep.sh + test: + docker: + - image: circleci/golang:1.10 working_directory: /go/src/github.com/virtual-kubelet/virtual-kubelet steps: - checkout @@ -15,12 +29,16 @@ jobs: echo 'export AZURE_AUTH_LOCATION=${outputPathCredsfile}' >> $BASH_ENV - run: | echo 'export KUBECONFIG=${outputPathKubeConfigFile}' >> $BASH_ENV - - run: - name: Dependencies - command: scripts/validate/dep.sh - run: name: Build command: V=1 make build - run: name: Tests command: V=1 CI=1 SKIP_AWS_E2E=1 make test + +workflows: + version: 2 + validate_and_test: + jobs: + - validate + - test diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 000000000..b73925141 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,13 @@ +linter-settings: + lll: + line-length: 200 + +linters: + disable-all: true + enable: + - errcheck + - govet + - ineffassign + - golint + - goconst + - goimports