influxdb/.circleci/config.yml

259 lines
8.7 KiB
YAML
Raw Normal View History

2018-05-16 15:43:33 +00:00
version: 2
jobs:
litmus_nightly:
machine: true
steps:
- run: docker login -u=$QUAY_USER -p=$QUAY_PASS quay.io
- run: docker run --entrypoint "./run_litmus_tests_oss.sh" -e TEST_LIST=tests_lists/gateway_api_tests.list --net host -v /var/run/docker.sock:/var/run/docker.sock -v ~/project:/Litmus/result quay.io/influxdb/litmus:latest
- run:
name: Litmus Nightly Tests Success
when: on_success
command: |
curl -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_TOKEN" \
-H "Content-type: application/json; charset=utf-8" \
--data @<(cat <<EOF
{
"channel":"#testing",
"text":"SUCCESSFUL: Branch: $CIRCLE_BRANCH, Job: $CIRCLE_JOB, Build: $CIRCLE_BUILD_NUM, Build URL: $CIRCLE_BUILD_URL",
"username":"CircleCI Nightly Litmus OSS Litmus Tests",
"icon_emoji":":circleci-pass:"
}
EOF
)
- run:
name: Litmus Nightly Tests Fail
when: on_fail
command: |
curl -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_TOKEN" \
-H "Content-type: application/json; charset=utf-8" \
--data @<(cat <<EOF
{
"channel":"#testing",
"text":"FAIL: Branch: $CIRCLE_BRANCH, Job: $CIRCLE_JOB, Build: $CIRCLE_BUILD_NUM, Build URL: $CIRCLE_BUILD_URL",
"username":"CircleCI Nightly Litmus OSS Litmus Tests",
"icon_emoji":":circleci-fail:"
}
EOF
)
- store_artifacts:
path: ~/project
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
working_directory: /go/src/github.com/influxdata/influxdb
steps:
- checkout
2018-12-01 01:02:31 +00:00
# Run npm install, using Circle's cache if applicable.
- restore_cache:
2018-12-01 01:02:31 +00:00
name: Restore npm package cache
keys:
2018-12-01 01:02:31 +00:00
# Only cache on exact package-lock.json match, as in Circle's yarn example:
- chronograf-npm-packages-{{ checksum "ui/package-lock.json" }}
- run: make node_modules
- save_cache:
name: Save Yarn package cache
2018-12-01 01:02:31 +00:00
key: chronograf-npm-packages-{{ checksum "ui/package-lock.json" }}
paths:
2018-12-01 01:02:31 +00:00
- ~/.cache/npm
- run: make test-js
- run: make chronograf_lint
2018-05-22 20:50:10 +00:00
gotest:
docker:
2018-08-28 15:38:30 +00:00
- image: circleci/golang:1.11
environment:
GOCACHE: /tmp/go-cache
GOFLAGS: "-mod=readonly -p=2" # Go on Circle thinks 32 CPUs are available, but there aren't.
working_directory: /go/src/github.com/influxdata/influxdb
2018-05-16 15:43:33 +00:00
steps:
- checkout
# Populate GOCACHE.
- restore_cache:
name: Restoring GOCACHE
keys:
- influxdb-gocache-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run.
- influxdb-gocache-{{ .Branch }}- # Matches a new commit on an existing branch.
- influxdb-gocache- # Matches a new branch.
# Populate GOPATH/pkg.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }} # Matches based on go.sum checksum.
- 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
- run: make checkfmt
- run: make checktidy
- run: make test-go-race # This doesn't use the test cache because of -count=1, so it 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 ./...
2018-11-01 16:12:38 +00:00
- run: GO111MODULE=on go mod vendor # staticcheck looks in vendor for dependencies.
2018-11-20 19:02:13 +00:00
- run: GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck # Install staticcheck from the version we specify in go.mod.
- run: staticcheck ./...
# In go1.11, running go mod vendor when go.mod contains replace entries, "taints" go.sum, even with -mod=readonly.
# See https://github.com/golang/go/issues/27868.
# Clean up go.sum so that we save to the same module key we attempted to restore from.
# TODO: remove this call to git checkout after we are on go1.12.
- run: git checkout -- go.sum
2018-11-01 16:12:38 +00:00
- save_cache:
name: Saving GOCACHE
key: influxdb-gocache-{{ .Branch }}-{{ .Revision }}
paths:
- /tmp/go-cache
when: always
- save_cache:
name: Saving GOPATH/pkg/mod
key: influxdb-gomod-{{ checksum "go.sum" }}
paths:
- /go/pkg/mod
when: always
build:
docker:
- image: circleci/golang:1.11-node-browsers
environment:
GOCACHE: /tmp/go-cache
GOFLAGS: "-mod=readonly -p=4" # Go on Circle thinks 32 CPUs are available, but there aren't.
working_directory: /go/src/github.com/influxdata/influxdb
steps:
- checkout
# Speed up `make build` by restoring caches from previous runs.
- restore_cache:
name: Restoring GOCACHE
keys:
- influxdb-gocache- # Just match the most recent Go cache.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }} # Just match the go.sum checksum cache.
- restore_cache:
name: Restore Yarn package cache
keys:
- chronograf-npm-packages-{{ checksum "ui/package-lock.json" }}
- run: make build
deploy-nightly:
docker:
2018-08-28 15:38:30 +00:00
- image: circleci/golang:1.11-node-browsers
environment:
GOCACHE: /tmp/go-cache
GOFLAGS: "-mod=readonly -p=4" # Go on Circle thinks 32 CPUs are available, but there aren't.
working_directory: /go/src/github.com/influxdata/influxdb
steps:
- checkout
# Speed up `make nightly` by restoring caches from previous runs.
- restore_cache:
name: Restoring GOCACHE
keys:
- influxdb-gocache- # Just match the most recent Go cache.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }} # Just match the go.sum checksum cache.
- restore_cache:
name: Restore Yarn package cache
keys:
2018-12-01 01:02:31 +00:00
- chronograf-npm-packages-{{ checksum "ui/package-lock.json" }}
- setup_remote_docker
- run:
name: "Docker Login"
command: docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
- run:
name: "Build nightly"
command: make nightly
release:
docker:
- image: circleci/golang:1.11-node-browsers
environment:
GOCACHE: /tmp/go-cache
GOFLAGS: "-mod=readonly -p=4" # Go on Circle thinks 32 CPUs are available, but there aren't.
DOCKER_VERSION: 2.0.0-alpha
working_directory: /go/src/github.com/influxdata/influxdb
steps:
- checkout
# Speed up `make nightly` by restoring caches from previous runs.
- restore_cache:
name: Restoring GOCACHE
keys:
- influxdb-gocache- # Just match the most recent Go cache.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- influxdb-gomod-{{ checksum "go.sum" }} # Just match the go.sum checksum cache.
- restore_cache:
name: Restore Yarn package cache
keys:
- chronograf-npm-packages-{{ checksum "ui/package-lock.json" }}
- setup_remote_docker
- run:
name: "Docker Login"
command: docker login -u "$QUAY_USER" -p $QUAY_PASS quay.io
- run:
name: "Build release"
command: make release
workflows:
version: 2
build:
jobs:
- gotest
- jstest
- build
2018-12-13 21:48:09 +00:00
nightly:
triggers:
- schedule:
2019-01-16 19:26:08 +00:00
cron: "0 7 * * *"
2018-12-13 21:48:09 +00:00
filters:
branches:
only:
- master
jobs:
2018-12-16 09:56:02 +00:00
- gotest
- jstest
- deploy-nightly:
2018-12-13 21:48:09 +00:00
requires:
- gotest
- jstest
filters:
branches:
2018-12-16 09:56:02 +00:00
only: master
- litmus_nightly:
requires:
- deploy-nightly
release:
jobs:
- gotest:
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$/
- jstest:
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$/
- release:
requires:
- gotest
- jstest
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$/