2018-03-09 04:27:00 -06:00
|
|
|
version: 2
|
2015-03-07 05:40:19 -06:00
|
|
|
|
2018-03-09 04:27:00 -06:00
|
|
|
jobs:
|
2018-04-16 04:44:50 -05:00
|
|
|
codespell:
|
|
|
|
docker:
|
|
|
|
- image: circleci/python
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: install codespell
|
|
|
|
command: 'sudo pip install codespell'
|
2018-04-17 13:45:46 -05:00
|
|
|
- run:
|
|
|
|
# Important: all words have to be in lowercase, and separated by "\n".
|
|
|
|
name: exclude known exceptions
|
|
|
|
command: 'echo -e "unknwon" > words_to_ignore.txt'
|
2018-04-16 04:44:50 -05:00
|
|
|
- run:
|
|
|
|
name: check documentation spelling errors
|
2018-04-17 13:45:46 -05:00
|
|
|
command: 'codespell -I ./words_to_ignore.txt docs/'
|
2018-04-16 04:44:50 -05:00
|
|
|
|
2018-04-18 15:36:14 -05:00
|
|
|
gometalinter:
|
|
|
|
docker:
|
|
|
|
- image: circleci/golang:1.10
|
2018-04-20 11:18:22 -05:00
|
|
|
environment:
|
|
|
|
# we need CGO because of go-sqlite3
|
|
|
|
CGO_ENABLED: 1
|
2018-04-18 15:36:14 -05:00
|
|
|
working_directory: /go/src/github.com/grafana/grafana
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-04-20 11:18:22 -05:00
|
|
|
- run: 'go get -u gopkg.in/alecthomas/gometalinter.v2'
|
2018-04-24 11:55:43 -05:00
|
|
|
- run: 'go get -u github.com/tsenart/deadcode'
|
2018-04-23 13:07:31 -05:00
|
|
|
- run: 'go get -u github.com/gordonklaus/ineffassign'
|
2018-04-20 11:18:22 -05:00
|
|
|
- run: 'go get -u github.com/opennota/check/cmd/structcheck'
|
|
|
|
- run: 'go get -u github.com/mdempsky/unconvert'
|
|
|
|
- run: 'go get -u github.com/opennota/check/cmd/varcheck'
|
2018-04-18 15:36:14 -05:00
|
|
|
- run:
|
2018-04-20 11:18:22 -05:00
|
|
|
name: run linters
|
2018-04-24 11:55:43 -05:00
|
|
|
command: 'gometalinter.v2 --enable-gc --vendor --deadline 10m --disable-all --enable=deadcode --enable=ineffassign --enable=structcheck --enable=unconvert --enable=varcheck ./...'
|
2018-04-18 15:36:14 -05:00
|
|
|
|
2018-03-09 04:27:00 -06:00
|
|
|
test-frontend:
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:6.11.4
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: install yarn
|
|
|
|
command: 'sudo npm install -g yarn --quiet'
|
|
|
|
- restore_cache:
|
|
|
|
key: dependency-cache-{{ checksum "yarn.lock" }}
|
|
|
|
# Could we skip this step if the cache has been restored? `[ -d node_modules ] || yarn install ...` should be able to apply to build step as well
|
|
|
|
- run:
|
|
|
|
name: yarn install
|
|
|
|
command: 'yarn install --pure-lockfile --no-progress'
|
|
|
|
- save_cache:
|
|
|
|
key: dependency-cache-{{ checksum "yarn.lock" }}
|
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
- run:
|
|
|
|
name: frontend tests
|
|
|
|
command: './scripts/circle-test-frontend.sh'
|
2017-01-30 10:27:12 -06:00
|
|
|
|
2018-03-09 04:27:00 -06:00
|
|
|
test-backend:
|
|
|
|
docker:
|
|
|
|
- image: circleci/golang:1.10
|
|
|
|
working_directory: /go/src/github.com/grafana/grafana
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: build backend and run go tests
|
|
|
|
command: './scripts/circle-test-backend.sh'
|
2016-01-27 13:18:35 -06:00
|
|
|
|
2018-03-09 04:27:00 -06:00
|
|
|
build:
|
|
|
|
docker:
|
2018-05-08 02:42:20 -05:00
|
|
|
- image: grafana/build-container:crosscompile
|
2018-03-09 04:27:00 -06:00
|
|
|
working_directory: /go/src/github.com/grafana/grafana
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-05-08 02:42:20 -05:00
|
|
|
- run:
|
|
|
|
name: prepare build tools
|
|
|
|
command: '/tmp/bootstrap.sh'
|
2018-05-18 04:38:31 -05:00
|
|
|
- restore_cache:
|
|
|
|
key: phantomjs-binaries-{{ checksum "scripts/build/download-phantomjs.sh" }}
|
|
|
|
- run:
|
|
|
|
name: download phantomjs binaries
|
|
|
|
command: './scripts/build/download-phantomjs.sh'
|
|
|
|
- save_cache:
|
|
|
|
key: phantomjs-binaries-{{ checksum "scripts/build/download-phantomjs.sh" }}
|
|
|
|
paths:
|
|
|
|
- /tmp/phantomjs
|
2018-03-09 04:27:00 -06:00
|
|
|
- run:
|
|
|
|
name: build and package grafana
|
|
|
|
command: './scripts/build/build.sh'
|
|
|
|
- run:
|
|
|
|
name: sign packages
|
|
|
|
command: './scripts/build/sign_packages.sh'
|
|
|
|
- run:
|
|
|
|
name: sha-sum packages
|
|
|
|
command: 'go run build.go sha-dist'
|
|
|
|
- run:
|
|
|
|
name: Build Grafana.com publisher
|
|
|
|
command: 'go build -o scripts/publish scripts/build/publish.go'
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- dist/grafana*
|
|
|
|
- scripts/*.sh
|
|
|
|
- scripts/publish
|
2018-05-10 03:39:29 -05:00
|
|
|
- store_artifacts:
|
|
|
|
path: dist
|
2018-03-09 04:27:00 -06:00
|
|
|
|
2018-04-27 06:41:58 -05:00
|
|
|
build-enterprise:
|
|
|
|
docker:
|
|
|
|
- image: grafana/build-container:v0.1
|
|
|
|
working_directory: /go/src/github.com/grafana/grafana
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: build and package grafana
|
|
|
|
command: './scripts/build/build_enterprise.sh'
|
|
|
|
- run:
|
|
|
|
name: sign packages
|
|
|
|
command: './scripts/build/sign_packages.sh'
|
|
|
|
- run:
|
|
|
|
name: sha-sum packages
|
|
|
|
command: 'go run build.go sha-dist'
|
|
|
|
|
2018-03-09 04:27:00 -06:00
|
|
|
deploy-master:
|
|
|
|
docker:
|
|
|
|
- image: circleci/python:2.7-stretch
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- run:
|
|
|
|
name: install awscli
|
|
|
|
command: 'sudo pip install awscli'
|
|
|
|
- run:
|
|
|
|
name: deploy to s3
|
|
|
|
command: 'aws s3 sync ./dist s3://$BUCKET_NAME/master'
|
|
|
|
- run:
|
|
|
|
name: Trigger Windows build
|
|
|
|
command: './scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} master'
|
|
|
|
- run:
|
|
|
|
name: Trigger Docker build
|
|
|
|
command: './scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN}'
|
|
|
|
- run:
|
|
|
|
name: Publish to Grafana.com
|
|
|
|
command: './scripts/publish -apiKey ${GRAFANA_COM_API_KEY}'
|
|
|
|
|
|
|
|
deploy-release:
|
|
|
|
docker:
|
|
|
|
- image: circleci/python:2.7-stretch
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
2018-04-20 05:59:44 -05:00
|
|
|
at: .
|
2018-03-09 04:27:00 -06:00
|
|
|
- run:
|
|
|
|
name: install awscli
|
|
|
|
command: 'sudo pip install awscli'
|
|
|
|
- run:
|
|
|
|
name: deploy to s3
|
|
|
|
command: 'aws s3 sync ./dist s3://$BUCKET_NAME/release'
|
|
|
|
- run:
|
|
|
|
name: Trigger Windows build
|
|
|
|
command: './scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} release'
|
|
|
|
- run:
|
|
|
|
name: Trigger Docker build
|
|
|
|
command: './scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN} ${CIRCLE_TAG}'
|
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
test-and-build:
|
|
|
|
jobs:
|
2018-04-16 04:44:50 -05:00
|
|
|
- codespell:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2018-04-20 11:18:22 -05:00
|
|
|
- gometalinter:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2018-03-09 04:27:00 -06:00
|
|
|
- build:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- test-frontend:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- test-backend:
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
|
|
|
- deploy-master:
|
|
|
|
requires:
|
|
|
|
- test-backend
|
|
|
|
- test-frontend
|
|
|
|
- build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: master
|
|
|
|
- deploy-release:
|
|
|
|
requires:
|
|
|
|
- test-backend
|
|
|
|
- test-frontend
|
|
|
|
- build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
tags:
|
|
|
|
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
|
2018-04-27 09:41:07 -05:00
|
|
|
# - build-enterprise:
|
|
|
|
# filters:
|
|
|
|
# tags:
|
|
|
|
# only: /.*/
|