2015-01-02 19:14:42 +01:00
|
|
|
# Pony-up!
|
2014-12-06 04:04:00 +01:00
|
|
|
machine:
|
|
|
|
pre:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Install gvm
|
2014-12-16 20:38:08 +01:00
|
|
|
- bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/1.0.22/binscripts/gvm-installer)
|
|
|
|
|
|
|
|
post:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Install many go versions
|
2014-12-16 20:38:08 +01:00
|
|
|
- gvm install go1.3.3 -B --name=old
|
|
|
|
- gvm install go1.4 -B --name=stable
|
2015-01-02 19:14:42 +01:00
|
|
|
# - gvm install tip --name=bleed
|
2014-12-16 20:38:08 +01:00
|
|
|
|
|
|
|
environment:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Convenient shortcuts to "common" locations
|
2014-12-16 20:38:08 +01:00
|
|
|
CHECKOUT: /home/ubuntu/$CIRCLE_PROJECT_REPONAME
|
|
|
|
BASE_DIR: src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
|
2015-01-02 19:14:42 +01:00
|
|
|
# Trick circle brainflat "no absolute path" behavior
|
2014-12-16 20:38:08 +01:00
|
|
|
BASE_OLD: ../../../$HOME/.gvm/pkgsets/old/global/$BASE_DIR
|
|
|
|
BASE_STABLE: ../../../$HOME/.gvm/pkgsets/stable/global/$BASE_DIR
|
2015-01-02 19:14:42 +01:00
|
|
|
# BASE_BLEED: ../../../$HOME/.gvm/pkgsets/bleed/global/$BASE_DIR
|
|
|
|
# Workaround Circle parsing dumb bugs and/or YAML wonkyness
|
2014-12-16 20:38:08 +01:00
|
|
|
CIRCLE_PAIN: "mode: set"
|
2014-12-06 04:04:00 +01:00
|
|
|
|
|
|
|
hosts:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Not used yet
|
2014-12-06 04:04:00 +01:00
|
|
|
fancy: 127.0.0.1
|
|
|
|
|
|
|
|
dependencies:
|
2014-12-16 20:38:08 +01:00
|
|
|
pre:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Copy the code to the gopath of all go versions
|
2014-12-16 20:38:08 +01:00
|
|
|
- >
|
|
|
|
gvm use old &&
|
|
|
|
mkdir -p "$(dirname $BASE_OLD)" &&
|
|
|
|
cp -R "$CHECKOUT" "$BASE_OLD"
|
|
|
|
|
|
|
|
- >
|
|
|
|
gvm use stable &&
|
|
|
|
mkdir -p "$(dirname $BASE_STABLE)" &&
|
|
|
|
cp -R "$CHECKOUT" "$BASE_STABLE"
|
|
|
|
|
2015-01-02 19:14:42 +01:00
|
|
|
# - >
|
|
|
|
# gvm use bleed &&
|
|
|
|
# mkdir -p "$(dirname $BASE_BLEED)" &&
|
|
|
|
# cp -R "$CHECKOUT" "$BASE_BLEED"
|
|
|
|
|
2014-12-16 20:38:08 +01:00
|
|
|
override:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Install dependencies for every copied clone/go version
|
2014-12-16 20:38:08 +01:00
|
|
|
- gvm use old && go get -t -d -v ./...:
|
|
|
|
pwd: $BASE_OLD
|
|
|
|
|
|
|
|
- gvm use stable && go get -t -d -v ./...:
|
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2015-01-02 19:14:42 +01:00
|
|
|
# - gvm use bleed && go get -t -d -v ./...:
|
|
|
|
# pwd: $BASE_BLEED
|
|
|
|
|
2014-12-06 04:04:00 +01:00
|
|
|
post:
|
2015-01-02 19:14:42 +01:00
|
|
|
# For the stable go version, additionally install linting tools
|
2014-12-16 20:38:08 +01:00
|
|
|
- >
|
|
|
|
gvm use stable &&
|
|
|
|
go get github.com/axw/gocov/gocov github.com/mattn/goveralls github.com/golang/lint/golint
|
2014-12-06 04:04:00 +01:00
|
|
|
|
|
|
|
test:
|
|
|
|
pre:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Output the go versions we are going to test
|
2014-12-16 20:38:08 +01:00
|
|
|
- gvm use old && go version
|
|
|
|
- gvm use stable && go version
|
2015-01-02 19:14:42 +01:00
|
|
|
# - gvm use bleed && go version
|
2014-12-16 20:38:08 +01:00
|
|
|
|
2015-01-02 19:14:42 +01:00
|
|
|
# FMT
|
2015-01-12 22:59:50 +01:00
|
|
|
- gvm use stable && test -z "$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)":
|
2014-12-16 20:38:08 +01:00
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2015-01-02 19:14:42 +01:00
|
|
|
# VET
|
2014-12-16 20:38:08 +01:00
|
|
|
- gvm use stable && go vet ./...:
|
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2015-01-02 19:14:42 +01:00
|
|
|
# LINT
|
2015-01-12 22:59:50 +01:00
|
|
|
- gvm use stable && test -z "$(golint ./... | grep -v Godeps/_workspace/src/ | tee /dev/stderr)":
|
2014-12-16 20:38:08 +01:00
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2014-12-06 04:04:00 +01:00
|
|
|
override:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Test every version we have (but stable)
|
2014-12-16 20:38:08 +01:00
|
|
|
- gvm use old; go test -test.v -test.short ./...:
|
|
|
|
timeout: 600
|
|
|
|
pwd: $BASE_OLD
|
2014-12-06 05:20:01 +01:00
|
|
|
|
2015-01-02 19:14:42 +01:00
|
|
|
# - gvm use bleed; go test -test.v -test.short ./...:
|
|
|
|
# timeout: 600
|
|
|
|
# pwd: $BASE_BLEED
|
|
|
|
|
|
|
|
# Test stable, and report
|
|
|
|
# Preset the goverall report file
|
2014-12-17 20:55:24 +01:00
|
|
|
- echo "$CIRCLE_PAIN" > ~/goverage.report
|
|
|
|
- gvm use stable; go list ./... | xargs -L 1 -I{} rm -f $GOPATH/src/{}/coverage.out:
|
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
|
|
|
- gvm use stable; go list ./... | xargs -L 1 -I{} go test -test.short -coverprofile=$GOPATH/src/{}/coverage.out {}:
|
2014-12-16 20:38:08 +01:00
|
|
|
timeout: 600
|
|
|
|
pwd: $BASE_STABLE
|
2014-12-06 04:04:00 +01:00
|
|
|
|
2014-12-16 20:38:08 +01:00
|
|
|
post:
|
2015-01-02 19:14:42 +01:00
|
|
|
# Aggregate and report to coveralls
|
2014-12-17 20:55:24 +01:00
|
|
|
- gvm use stable; go list ./... | xargs -L 1 -I{} cat "$GOPATH/src/{}/coverage.out" | grep -v "$CIRCLE_PAIN" >> ~/goverage.report:
|
|
|
|
pwd: $BASE_STABLE
|
2014-12-16 20:38:08 +01:00
|
|
|
- gvm use stable; goveralls -service circleci -coverprofile=/home/ubuntu/goverage.report -repotoken $COVERALLS_TOKEN:
|
|
|
|
pwd: $BASE_STABLE
|
|
|
|
|
2015-01-02 19:14:42 +01:00
|
|
|
## Notes
|
|
|
|
# Disabled the -race detector due to massive memory usage.
|
|
|
|
# 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
|
|
|
|
|
2014-12-06 04:04:00 +01:00
|
|
|
general:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- master
|
|
|
|
- 0.7
|
|
|
|
- 0.8
|
|
|
|
- 0.9
|
|
|
|
- 1.0
|