2018-05-16 15:43:33 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-08-27 15:34:17 +00:00
|
|
|
jstest:
|
2018-05-16 15:43:33 +00:00
|
|
|
docker:
|
2018-08-28 15:38:30 +00:00
|
|
|
- image: circleci/golang:1.11-node-browsers
|
2018-08-27 15:34:17 +00:00
|
|
|
working_directory: /go/src/github.com/influxdata/platform
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-08-28 21:20:46 +00:00
|
|
|
|
|
|
|
# Run yarn install, using Circle's cache if applicable.
|
|
|
|
- restore_cache:
|
|
|
|
name: Restore Yarn package cache
|
|
|
|
keys:
|
|
|
|
# Only cache on exact yarn.lock match, as in Circle's yarn example:
|
|
|
|
# https://circleci.com/docs/2.0/yarn/
|
|
|
|
- chronograf-yarn-packages-{{ checksum "chronograf/ui/yarn.lock" }}
|
|
|
|
- run: make node_modules
|
|
|
|
- save_cache:
|
|
|
|
name: Save Yarn package cache
|
|
|
|
key: chronograf-yarn-packages-{{ checksum "chronograf/ui/yarn.lock" }}
|
|
|
|
paths:
|
|
|
|
- ~/.cache/yarn
|
|
|
|
|
2018-08-27 15:34:17 +00:00
|
|
|
- run: make test-js
|
2018-05-22 20:50:10 +00:00
|
|
|
|
2018-08-27 15:34:17 +00:00
|
|
|
gotest:
|
|
|
|
docker:
|
2018-08-28 15:38:30 +00:00
|
|
|
- image: circleci/golang:1.11
|
ci: enable GOCACHE for Circle
With a clean GOCACHE, `make test-go` took about 30 seconds. It's hard to
tell the exact time since `make vendor` was implicitly executed in the
same block.
Now, `make test-go` uses GOCACHE and takes about 5 seconds to restore
the cache, then about 8 seconds to run through a fully cached set of
tests. If any test is actually broken or doesn't compile, this will give
us fast feedback.
But this change also runs `go test -race -count=1`, so that we fully
exercise any possible data races. That currently takes about 19 seconds.
Then finally we save GOCACHE, which has our `go test` results, and a
populated build cache for our test files, including built with the race
detector. Saving that takes about 14 seconds.
That means we took about 30 seconds originally to just run `go test
-count=1`, and now we take (5+8+19+14)=46 seconds to run plain go test
and go test with the race detector. There's probably an argument to be
made for just running with the race detector, but running both gives us
more coverage IMO, and it does allow us to run tests that aren't enabled
on race builds.
See https://circleci.com/gh/influxdata/platform/1840 for a run with full
caching.
2018-08-28 16:39:44 +00:00
|
|
|
environment:
|
|
|
|
GOCACHE: /tmp/go-cache
|
2018-08-26 18:54:24 +00:00
|
|
|
GOFLAGs: "-mod=readonly"
|
2018-05-16 15:43:33 +00:00
|
|
|
working_directory: /go/src/github.com/influxdata/platform
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-08-28 18:58:55 +00:00
|
|
|
|
|
|
|
# Populate GOCACHE.
|
ci: enable GOCACHE for Circle
With a clean GOCACHE, `make test-go` took about 30 seconds. It's hard to
tell the exact time since `make vendor` was implicitly executed in the
same block.
Now, `make test-go` uses GOCACHE and takes about 5 seconds to restore
the cache, then about 8 seconds to run through a fully cached set of
tests. If any test is actually broken or doesn't compile, this will give
us fast feedback.
But this change also runs `go test -race -count=1`, so that we fully
exercise any possible data races. That currently takes about 19 seconds.
Then finally we save GOCACHE, which has our `go test` results, and a
populated build cache for our test files, including built with the race
detector. Saving that takes about 14 seconds.
That means we took about 30 seconds originally to just run `go test
-count=1`, and now we take (5+8+19+14)=46 seconds to run plain go test
and go test with the race detector. There's probably an argument to be
made for just running with the race detector, but running both gives us
more coverage IMO, and it does allow us to run tests that aren't enabled
on race builds.
See https://circleci.com/gh/influxdata/platform/1840 for a run with full
caching.
2018-08-28 16:39:44 +00:00
|
|
|
- restore_cache:
|
|
|
|
name: Restoring GOCACHE
|
|
|
|
keys:
|
|
|
|
- platform-gocache-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run.
|
|
|
|
- platform-gocache-{{ .Branch }}- # Matches a new commit on an existing branch.
|
|
|
|
- platform-gocache- # Matches a new branch.
|
2018-08-28 18:58:55 +00:00
|
|
|
- run: make test-go # This uses the test cache so it may succeed or fail quickly.
|
2018-05-22 22:19:04 +00:00
|
|
|
- run: make vet
|
2018-08-28 18:58:55 +00:00
|
|
|
- run: make test-go-race # This doesn't use the test cache, and will not complete quickly.
|
2018-05-22 20:50:10 +00:00
|
|
|
# TODO add these checks to the Makefile
|
|
|
|
# - run: go get -v -t -d ./...
|
|
|
|
# - run: go get honnef.co/go/tools/cmd/megacheck
|
|
|
|
# - run: megacheck ./...
|
ci: enable GOCACHE for Circle
With a clean GOCACHE, `make test-go` took about 30 seconds. It's hard to
tell the exact time since `make vendor` was implicitly executed in the
same block.
Now, `make test-go` uses GOCACHE and takes about 5 seconds to restore
the cache, then about 8 seconds to run through a fully cached set of
tests. If any test is actually broken or doesn't compile, this will give
us fast feedback.
But this change also runs `go test -race -count=1`, so that we fully
exercise any possible data races. That currently takes about 19 seconds.
Then finally we save GOCACHE, which has our `go test` results, and a
populated build cache for our test files, including built with the race
detector. Saving that takes about 14 seconds.
That means we took about 30 seconds originally to just run `go test
-count=1`, and now we take (5+8+19+14)=46 seconds to run plain go test
and go test with the race detector. There's probably an argument to be
made for just running with the race detector, but running both gives us
more coverage IMO, and it does allow us to run tests that aren't enabled
on race builds.
See https://circleci.com/gh/influxdata/platform/1840 for a run with full
caching.
2018-08-28 16:39:44 +00:00
|
|
|
- save_cache:
|
|
|
|
name: Saving GOCACHE
|
|
|
|
key: platform-gocache-{{ .Branch }}-{{ .Revision }}
|
|
|
|
paths:
|
|
|
|
- /tmp/go-cache
|
|
|
|
when: always
|
2018-05-22 20:42:32 +00:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
docker:
|
2018-08-28 15:38:30 +00:00
|
|
|
- image: circleci/golang:1.11-node-browsers
|
2018-08-28 21:57:17 +00:00
|
|
|
environment:
|
|
|
|
GOCACHE: /tmp/go-cache
|
2018-08-26 18:54:24 +00:00
|
|
|
GOFLAGs: "-mod=readonly"
|
2018-05-22 20:42:32 +00:00
|
|
|
working_directory: /go/src/github.com/influxdata/platform
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-08-28 21:57:17 +00:00
|
|
|
|
|
|
|
# Speed up `make nightly` by restoring caches from previous runs.
|
|
|
|
- restore_cache:
|
|
|
|
name: Restoring GOCACHE
|
|
|
|
keys:
|
|
|
|
- platform-gocache- # Just match the most recent Go cache.
|
|
|
|
- restore_cache:
|
|
|
|
name: Restore Yarn package cache
|
|
|
|
keys:
|
|
|
|
- chronograf-yarn-packages-{{ checksum "chronograf/ui/yarn.lock" }}
|
|
|
|
|
2018-07-17 22:23:39 +00:00
|
|
|
- setup_remote_docker
|
2018-07-17 19:03:40 +00:00
|
|
|
- run: |
|
|
|
|
docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
|
|
|
|
make nightly
|
2018-05-22 20:42:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build-and-deploy:
|
|
|
|
jobs:
|
2018-08-27 15:34:17 +00:00
|
|
|
- gotest
|
|
|
|
- jstest
|
2018-05-22 20:42:32 +00:00
|
|
|
- deploy:
|
|
|
|
requires:
|
2018-08-27 15:34:17 +00:00
|
|
|
- gotest
|
|
|
|
- jstest
|
2018-05-22 20:42:32 +00:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
|
|
|
|