2015-01-02 18:14:42 +00:00
|
|
|
# Pony-up!
|
2014-12-06 03:04:00 +00:00
|
|
|
machine:
|
|
|
|
pre:
|
2015-01-02 18:14:42 +00:00
|
|
|
# Install gvm
|
2014-12-16 19:38:08 +00:00
|
|
|
- bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/1.0.22/binscripts/gvm-installer)
|
2015-12-21 18:26:53 +00:00
|
|
|
# Install codecov for coverage
|
|
|
|
- pip install --user codecov
|
2014-12-16 19:38:08 +00:00
|
|
|
|
|
|
|
post:
|
2015-11-11 01:01:43 +00:00
|
|
|
# go
|
2016-10-31 17:39:09 +00:00
|
|
|
- gvm install go1.7 --prefer-binary --name=stable
|
2014-12-16 19:38:08 +00:00
|
|
|
|
|
|
|
environment:
|
2015-01-02 18:14:42 +00:00
|
|
|
# Convenient shortcuts to "common" locations
|
2014-12-16 19:38:08 +00:00
|
|
|
CHECKOUT: /home/ubuntu/$CIRCLE_PROJECT_REPONAME
|
|
|
|
BASE_DIR: src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
|
2015-01-02 18:14:42 +00:00
|
|
|
# Trick circle brainflat "no absolute path" behavior
|
2014-12-16 19:38:08 +00:00
|
|
|
BASE_STABLE: ../../../$HOME/.gvm/pkgsets/stable/global/$BASE_DIR
|
2016-03-11 00:46:43 +00:00
|
|
|
DOCKER_BUILDTAGS: "include_oss include_gcs"
|
2015-01-02 18:14:42 +00:00
|
|
|
# Workaround Circle parsing dumb bugs and/or YAML wonkyness
|
2014-12-16 19:38:08 +00:00
|
|
|
CIRCLE_PAIN: "mode: set"
|
2014-12-06 03:04:00 +00:00
|
|
|
|
|
|
|
hosts:
|
2015-01-02 18:14:42 +00:00
|
|
|
# Not used yet
|
2014-12-06 03:04:00 +00:00
|
|
|
fancy: 127.0.0.1
|
|
|
|
|
|
|
|
dependencies:
|
2014-12-16 19:38:08 +00:00
|
|
|
pre:
|
2015-01-02 18:14:42 +00:00
|
|
|
# Copy the code to the gopath of all go versions
|
2014-12-16 19:38:08 +00:00
|
|
|
- >
|
|
|
|
gvm use stable &&
|
|
|
|
mkdir -p "$(dirname $BASE_STABLE)" &&
|
|
|
|
cp -R "$CHECKOUT" "$BASE_STABLE"
|
|
|
|
|
|
|
|
override:
|
2015-01-02 18:14:42 +00:00
|
|
|
# Install dependencies for every copied clone/go version
|
2016-11-23 23:45:04 +00:00
|
|
|
- gvm use stable && go get github.com/lk4d4/vndr:
|
2014-12-16 19:38:08 +00:00
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2014-12-06 03:04:00 +00:00
|
|
|
post:
|
2015-01-02 18:14:42 +00:00
|
|
|
# For the stable go version, additionally install linting tools
|
2014-12-16 19:38:08 +00:00
|
|
|
- >
|
|
|
|
gvm use stable &&
|
2015-06-01 17:40:52 +00:00
|
|
|
go get github.com/axw/gocov/gocov github.com/golang/lint/golint
|
2015-12-21 18:26:53 +00:00
|
|
|
|
2014-12-06 03:04:00 +00:00
|
|
|
test:
|
|
|
|
pre:
|
2015-01-02 18:14:42 +00:00
|
|
|
# Output the go versions we are going to test
|
2015-04-22 19:54:01 +00:00
|
|
|
# - gvm use old && go version
|
2014-12-16 19:38:08 +00:00
|
|
|
- gvm use stable && go version
|
|
|
|
|
2016-03-22 01:04:27 +00:00
|
|
|
# Ensure validation of dependencies
|
2017-03-20 17:53:40 +00:00
|
|
|
- gvm use stable && if test -n "`git diff --stat=1000 origin/master | grep -E \"^[[:space:]]*vendor\"`"; then make dep-validate; fi:
|
2016-11-23 23:45:04 +00:00
|
|
|
pwd: $BASE_STABLE
|
2016-03-22 01:04:27 +00:00
|
|
|
|
2015-08-03 18:24:44 +00:00
|
|
|
# First thing: build everything. This will catch compile errors, and it's
|
|
|
|
# also necessary for go vet to work properly (see #807).
|
2016-11-23 23:45:04 +00:00
|
|
|
- gvm use stable && go install $(go list ./... | grep -v "/vendor/"):
|
2015-08-03 18:24:44 +00:00
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2015-01-02 18:14:42 +00:00
|
|
|
# FMT
|
2016-03-18 21:07:13 +00:00
|
|
|
- gvm use stable && make fmt:
|
2014-12-16 19:38:08 +00:00
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2015-11-11 01:01:43 +00:00
|
|
|
# VET
|
2016-03-18 21:07:13 +00:00
|
|
|
- gvm use stable && make vet:
|
2014-12-16 19:38:08 +00:00
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2015-01-02 18:14:42 +00:00
|
|
|
# LINT
|
2016-03-18 21:07:13 +00:00
|
|
|
- gvm use stable && make lint:
|
2014-12-16 19:38:08 +00:00
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2014-12-06 03:04:00 +00:00
|
|
|
override:
|
2015-01-02 18:14:42 +00:00
|
|
|
# Test stable, and report
|
2016-11-23 23:45:04 +00:00
|
|
|
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; go test -tags "$DOCKER_BUILDTAGS" -test.short -coverprofile=$GOPATH/src/$PACKAGE/coverage.out -coverpkg=$(./coverpkg.sh $PACKAGE $ROOT_PACKAGE) $PACKAGE':
|
2016-08-09 18:22:58 +00:00
|
|
|
timeout: 1000
|
2015-11-11 01:01:43 +00:00
|
|
|
pwd: $BASE_STABLE
|
2014-12-06 03:04:00 +00:00
|
|
|
|
2016-08-24 00:31:40 +00:00
|
|
|
# Test stable with race
|
2016-11-23 23:45:04 +00:00
|
|
|
- gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | grep -v "registry/handlers" | grep -v "registry/storage/driver" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; go test -race -tags "$DOCKER_BUILDTAGS" -test.short $PACKAGE':
|
2016-08-24 00:31:40 +00:00
|
|
|
timeout: 1000
|
|
|
|
pwd: $BASE_STABLE
|
2014-12-16 19:38:08 +00:00
|
|
|
post:
|
2015-12-21 20:35:33 +00:00
|
|
|
# Report to codecov
|
2015-12-21 18:26:53 +00:00
|
|
|
- bash <(curl -s https://codecov.io/bash):
|
2014-12-17 19:55:24 +00:00
|
|
|
pwd: $BASE_STABLE
|
2014-12-16 19:38:08 +00:00
|
|
|
|
2015-01-02 18:14:42 +00:00
|
|
|
## Notes
|
|
|
|
# Do we want these as well?
|
|
|
|
# - go get code.google.com/p/go.tools/cmd/goimports
|
|
|
|
# - test -z "$(goimports -l -w ./... | tee /dev/stderr)"
|
|
|
|
# http://labix.org/gocheck
|