circle.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Pony-up!
  2. machine:
  3. pre:
  4. # Install gvm
  5. - bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/1.0.22/binscripts/gvm-installer)
  6. # Install codecov for coverage
  7. - pip install --user codecov
  8. post:
  9. # go
  10. - gvm install go1.6 --prefer-binary --name=stable
  11. environment:
  12. # Convenient shortcuts to "common" locations
  13. CHECKOUT: /home/ubuntu/$CIRCLE_PROJECT_REPONAME
  14. BASE_DIR: src/github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
  15. # Trick circle brainflat "no absolute path" behavior
  16. BASE_STABLE: ../../../$HOME/.gvm/pkgsets/stable/global/$BASE_DIR
  17. DOCKER_BUILDTAGS: "include_oss include_gcs"
  18. # Workaround Circle parsing dumb bugs and/or YAML wonkyness
  19. CIRCLE_PAIN: "mode: set"
  20. hosts:
  21. # Not used yet
  22. fancy: 127.0.0.1
  23. dependencies:
  24. pre:
  25. # Copy the code to the gopath of all go versions
  26. - >
  27. gvm use stable &&
  28. mkdir -p "$(dirname $BASE_STABLE)" &&
  29. cp -R "$CHECKOUT" "$BASE_STABLE"
  30. override:
  31. # Install dependencies for every copied clone/go version
  32. - gvm use stable && go get github.com/tools/godep:
  33. pwd: $BASE_STABLE
  34. post:
  35. # For the stable go version, additionally install linting tools
  36. - >
  37. gvm use stable &&
  38. go get github.com/axw/gocov/gocov github.com/golang/lint/golint
  39. test:
  40. pre:
  41. # Output the go versions we are going to test
  42. # - gvm use old && go version
  43. - gvm use stable && go version
  44. # Ensure validation of dependencies
  45. - gvm use stable && if test -n "`git diff --stat=1000 master | grep -Ei \"vendor|godeps\"`"; then make dep-validate; fi:
  46. pwd: $BASE_STABLE
  47. # First thing: build everything. This will catch compile errors, and it's
  48. # also necessary for go vet to work properly (see #807).
  49. - gvm use stable && godep go install $(go list ./... | grep -v "/vendor/"):
  50. pwd: $BASE_STABLE
  51. # FMT
  52. - gvm use stable && make fmt:
  53. pwd: $BASE_STABLE
  54. # VET
  55. - gvm use stable && make vet:
  56. pwd: $BASE_STABLE
  57. # LINT
  58. - gvm use stable && make lint:
  59. pwd: $BASE_STABLE
  60. override:
  61. # Test stable, and report
  62. - gvm use stable; export ROOT_PACKAGE=$(go list .); go list -tags "$DOCKER_BUILDTAGS" ./... | grep -v "/vendor/" | xargs -L 1 -I{} bash -c 'export PACKAGE={}; godep go test -tags "$DOCKER_BUILDTAGS" -test.short -coverprofile=$GOPATH/src/$PACKAGE/coverage.out -coverpkg=$(./coverpkg.sh $PACKAGE $ROOT_PACKAGE) $PACKAGE':
  63. timeout: 600
  64. pwd: $BASE_STABLE
  65. post:
  66. # Report to codecov
  67. - bash <(curl -s https://codecov.io/bash):
  68. pwd: $BASE_STABLE
  69. ## Notes
  70. # Disabled the -race detector due to massive memory usage.
  71. # Do we want these as well?
  72. # - go get code.google.com/p/go.tools/cmd/goimports
  73. # - test -z "$(goimports -l -w ./... | tee /dev/stderr)"
  74. # http://labix.org/gocheck