From bc93198aa7c312a6dc73a1322abbc6d99f4db7a7 Mon Sep 17 00:00:00 2001 From: Joel Speed Date: Tue, 27 Nov 2018 11:55:56 +0000 Subject: [PATCH] Update CI to separate linting and testing --- .travis.yml | 12 ++++++++++-- CHANGELOG.md | 2 ++ lint.sh | 11 +++++++++++ test.sh | 14 +------------- 4 files changed, 24 insertions(+), 15 deletions(-) create mode 100755 lint.sh diff --git a/.travis.yml b/.travis.yml index da7885a..1102252 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,18 @@ language: go go: - 1.8.x - 1.9.x -script: + - 1.10.x +install: + # Fetch dependencies - wget -O dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 - chmod +x dep - - ./dep ensure + - ./dep ensure --vendor-only +script: + # Lint + - go get -u github.com/alecthomas/gometalinter + - gometalinter --install + - ./lint.sh + # Run tests - ./test.sh sudo: false notifications: diff --git a/CHANGELOG.md b/CHANGELOG.md index d8445f9..9c01f40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Changes since v2.2: +- Update CI scripts to separate linting and testing + - Now using `gometalinter` for linting - Move Go import path from `github.com/bitly/oauth2_proxy` to `github.com/pusher/oauth2_proxy` - Repository forked on 27/11/18 - README updated to include note that this repository is forked diff --git a/lint.sh b/lint.sh new file mode 100755 index 0000000..0fa9f5a --- /dev/null +++ b/lint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +gometalinter --vendor --disable-all \ +--enable=vet \ +--enable=vetshadow \ +--enable=golint \ +--enable=ineffassign \ +--enable=goconst \ +--enable=deadcode \ +--enable=gofmt \ +--enable=goimports \ +--tests ./... diff --git a/test.sh b/test.sh index acc17a2..c99556a 100755 --- a/test.sh +++ b/test.sh @@ -1,14 +1,2 @@ #!/bin/bash -EXIT_CODE=0 -echo "gofmt" -diff -u <(echo -n) <(gofmt -d $(find . -type f -name '*.go' -not -path "./vendor/*")) || EXIT_CODE=1 -for pkg in $(go list ./... | grep -v '/vendor/' ); do - echo "testing $pkg" - echo "go vet $pkg" - go vet "$pkg" || EXIT_CODE=1 - echo "go test -v $pkg" - go test -v -timeout 90s "$pkg" || EXIT_CODE=1 - echo "go test -v -race $pkg" - GOMAXPROCS=4 go test -v -timeout 90s0s -race "$pkg" || EXIT_CODE=1 -done -exit $EXIT_CODE \ No newline at end of file +go test -v -race $(go list ./... | grep -v /vendor/)