Update CI to separate linting and testing

This commit is contained in:
Joel Speed 2018-11-27 11:55:56 +00:00
parent 847cf25228
commit bc93198aa7
No known key found for this signature in database
GPG Key ID: 6E80578D6751DEFB
4 changed files with 24 additions and 15 deletions

View File

@ -2,10 +2,18 @@ language: go
go: go:
- 1.8.x - 1.8.x
- 1.9.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 - wget -O dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64
- chmod +x dep - 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 - ./test.sh
sudo: false sudo: false
notifications: notifications:

View File

@ -2,6 +2,8 @@
## Changes since v2.2: ## 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` - Move Go import path from `github.com/bitly/oauth2_proxy` to `github.com/pusher/oauth2_proxy`
- Repository forked on 27/11/18 - Repository forked on 27/11/18
- README updated to include note that this repository is forked - README updated to include note that this repository is forked

11
lint.sh Executable file
View File

@ -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 ./...

14
test.sh
View File

@ -1,14 +1,2 @@
#!/bin/bash #!/bin/bash
EXIT_CODE=0 go test -v -race $(go list ./... | grep -v /vendor/)
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