Test circle

This commit is contained in:
Olivier Gambier 2015-01-02 10:14:42 -08:00
parent 1b4b67a0a5
commit 428efa04dd

View file

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