mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 05:29:42 -06:00
272 lines
8.5 KiB
YAML
272 lines
8.5 KiB
YAML
aliases:
|
|
# Workflow filters
|
|
- &filter-only-release
|
|
branches:
|
|
ignore: /.*/
|
|
tags:
|
|
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
|
|
- &filter-not-release
|
|
tags:
|
|
ignore: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
|
|
|
|
version: 2
|
|
|
|
jobs:
|
|
mysql-integration-test:
|
|
docker:
|
|
- image: circleci/golang:1.10
|
|
- image: circleci/mysql:5.6-ram
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: rootpass
|
|
MYSQL_DATABASE: grafana_tests
|
|
MYSQL_USER: grafana
|
|
MYSQL_PASSWORD: password
|
|
working_directory: /go/src/github.com/grafana/grafana
|
|
steps:
|
|
- checkout
|
|
- run: sudo apt update
|
|
- run: sudo apt install -y mysql-client
|
|
- run: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
|
|
- run: cat docker/blocks/mysql_tests/setup.sql | mysql -h 127.0.0.1 -P 3306 -u root -prootpass
|
|
- run:
|
|
name: mysql integration tests
|
|
command: 'GRAFANA_TEST_DB=mysql go test ./pkg/services/sqlstore/... ./pkg/tsdb/mysql/... '
|
|
|
|
postgres-integration-test:
|
|
docker:
|
|
- image: circleci/golang:1.10
|
|
- image: circleci/postgres:9.3-ram
|
|
environment:
|
|
POSTGRES_USER: grafanatest
|
|
POSTGRES_PASSWORD: grafanatest
|
|
POSTGRES_DB: grafanatest
|
|
working_directory: /go/src/github.com/grafana/grafana
|
|
steps:
|
|
- checkout
|
|
- run: sudo apt update
|
|
- run: sudo apt install -y postgresql-client
|
|
- run: dockerize -wait tcp://127.0.0.1:5432 -timeout 120s
|
|
- run: 'PGPASSWORD=grafanatest psql -p 5432 -h 127.0.0.1 -U grafanatest -d grafanatest -f docker/blocks/postgres_tests/setup.sql'
|
|
- run:
|
|
name: postgres integration tests
|
|
command: 'GRAFANA_TEST_DB=postgres go test ./pkg/services/sqlstore/... ./pkg/tsdb/postgres/...'
|
|
|
|
codespell:
|
|
docker:
|
|
- image: circleci/python
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: install codespell
|
|
command: 'sudo pip install codespell'
|
|
- 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'
|
|
- run:
|
|
name: check documentation spelling errors
|
|
command: 'codespell -I ./words_to_ignore.txt docs/'
|
|
|
|
gometalinter:
|
|
docker:
|
|
- image: circleci/golang:1.10
|
|
environment:
|
|
# we need CGO because of go-sqlite3
|
|
CGO_ENABLED: 1
|
|
working_directory: /go/src/github.com/grafana/grafana
|
|
steps:
|
|
- checkout
|
|
- run: 'go get -u gopkg.in/alecthomas/gometalinter.v2'
|
|
- run: 'go get -u github.com/tsenart/deadcode'
|
|
- run: 'go get -u github.com/gordonklaus/ineffassign'
|
|
- 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'
|
|
- run:
|
|
name: run linters
|
|
command: 'gometalinter.v2 --enable-gc --vendor --deadline 10m --disable-all --enable=deadcode --enable=ineffassign --enable=structcheck --enable=unconvert --enable=varcheck ./...'
|
|
|
|
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" }}
|
|
- 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'
|
|
|
|
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'
|
|
|
|
build-all:
|
|
docker:
|
|
- image: grafana/build-container:1.0.0
|
|
working_directory: /go/src/github.com/grafana/grafana
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: prepare build tools
|
|
command: '/tmp/bootstrap.sh'
|
|
- 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
|
|
- run:
|
|
name: build and package grafana
|
|
command: './scripts/build/build-all.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
|
|
- store_artifacts:
|
|
path: dist
|
|
|
|
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'
|
|
|
|
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:
|
|
at: .
|
|
- 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:
|
|
- build-all:
|
|
filters: *filter-not-release
|
|
- codespell:
|
|
filters: *filter-not-release
|
|
- gometalinter:
|
|
filters: *filter-not-release
|
|
- test-frontend:
|
|
filters: *filter-not-release
|
|
- test-backend:
|
|
filters: *filter-not-release
|
|
- mysql-integration-test:
|
|
filters: *filter-not-release
|
|
- postgres-integration-test:
|
|
filters: *filter-not-release
|
|
- deploy-master:
|
|
requires:
|
|
- build-all
|
|
- test-backend
|
|
- test-frontend
|
|
- codespell
|
|
- gometalinter
|
|
- mysql-integration-test
|
|
- postgres-integration-test
|
|
filters:
|
|
branches:
|
|
only: master
|
|
release:
|
|
jobs:
|
|
- build-all:
|
|
filters: *filter-only-release
|
|
- codespell:
|
|
filters: *filter-only-release
|
|
- gometalinter:
|
|
filters: *filter-only-release
|
|
- test-frontend:
|
|
filters: *filter-only-release
|
|
- test-backend:
|
|
filters: *filter-only-release
|
|
- mysql-integration-test:
|
|
filters: *filter-only-release
|
|
- postgres-integration-test:
|
|
filters: *filter-only-release
|
|
- deploy-release:
|
|
requires:
|
|
- build-all
|
|
- test-backend
|
|
- test-frontend
|
|
- codespell
|
|
- gometalinter
|
|
- mysql-integration-test
|
|
- postgres-integration-test
|
|
filters: *filter-only-release
|