123 lines
4.2 KiB
YAML
123 lines
4.2 KiB
YAML
version: 2
|
|
jobs:
|
|
jstest:
|
|
docker:
|
|
- image: circleci/golang:1.11-node-browsers
|
|
working_directory: /go/src/github.com/influxdata/platform
|
|
steps:
|
|
- checkout
|
|
|
|
# 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 "ui/yarn.lock" }}
|
|
- run: make node_modules
|
|
- save_cache:
|
|
name: Save Yarn package cache
|
|
key: chronograf-yarn-packages-{{ checksum "ui/yarn.lock" }}
|
|
paths:
|
|
- ~/.cache/yarn
|
|
|
|
- run: make test-js
|
|
- run: make chronograf_lint
|
|
|
|
gotest:
|
|
docker:
|
|
- image: circleci/golang:1.11
|
|
environment:
|
|
GOCACHE: /tmp/go-cache
|
|
GOFLAGS: "-mod=readonly"
|
|
working_directory: /go/src/github.com/influxdata/platform
|
|
steps:
|
|
- checkout
|
|
|
|
# Populate GOCACHE.
|
|
- 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.
|
|
# Populate GOPATH/pkg.
|
|
- restore_cache:
|
|
name: Restoring GOPATH/pkg/mod
|
|
keys:
|
|
- platform-gomod-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run.
|
|
- platform-gomod-{{ .Branch }}- # Matches a new commit on an existing branch.
|
|
- platform-gomod- # Matches a new branch.
|
|
- run: make test-go # This uses the test cache so it may succeed or fail quickly.
|
|
- run: make vet
|
|
- run: make checkfmt
|
|
- run: make checktidy
|
|
# For now stop testing race conditions as we think it is taking too much memory on circle
|
|
# - run: make test-go-race # This doesn't use the test cache, and will not complete quickly.
|
|
# TODO add these checks to the Makefile
|
|
# - run: go get -v -t -d ./...
|
|
|
|
# TODO(#544): fix the remaining static check in the generated promql file, and enable exit-non-zero.
|
|
# Not yet sure if that's a bug in staticcheck or if we need to submit a patch to pigeon to fix the generator.
|
|
- run: GO111MODULE=on go mod vendor # megacheck isn't module-aware yet, so install module dependencies to vendor.
|
|
- run: GO111MODULE=on go install honnef.co/go/tools/cmd/megacheck # Install megacheck from the version we specify in go.mod.
|
|
- run: megacheck -staticcheck.exit-non-zero=false ./...
|
|
|
|
- save_cache:
|
|
name: Saving GOCACHE
|
|
key: platform-gocache-{{ .Branch }}-{{ .Revision }}
|
|
paths:
|
|
- /tmp/go-cache
|
|
when: always
|
|
- save_cache:
|
|
name: Saving GOPATH/pkg/mod
|
|
key: platform-gomod-{{ .Branch }}-{{ .Revision }}
|
|
paths:
|
|
- /go/pkg/mod
|
|
when: always
|
|
|
|
deploy:
|
|
docker:
|
|
- image: circleci/golang:1.11-node-browsers
|
|
environment:
|
|
GOCACHE: /tmp/go-cache
|
|
GOFLAGS: "-mod=readonly"
|
|
working_directory: /go/src/github.com/influxdata/platform
|
|
steps:
|
|
- checkout
|
|
|
|
# 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: Restoring GOPATH/pkg/mod
|
|
keys:
|
|
- platform-gomod- # Just match the most recent Go mod cache.
|
|
- restore_cache:
|
|
name: Restore Yarn package cache
|
|
keys:
|
|
- chronograf-yarn-packages-{{ checksum "ui/yarn.lock" }}
|
|
|
|
- setup_remote_docker
|
|
- run: |
|
|
docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
|
|
make nightly
|
|
|
|
|
|
workflows:
|
|
version: 2
|
|
build-and-deploy:
|
|
jobs:
|
|
- gotest
|
|
- jstest
|
|
- deploy:
|
|
requires:
|
|
- gotest
|
|
- jstest
|
|
filters:
|
|
branches:
|
|
only: master
|
|
|