config.yml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. version: 2
  2. jobs:
  3. codespell:
  4. docker:
  5. - image: circleci/python
  6. steps:
  7. - checkout
  8. - run:
  9. name: install codespell
  10. command: 'sudo pip install codespell'
  11. - run:
  12. # Important: all words have to be in lowercase, and separated by "\n".
  13. name: exclude known exceptions
  14. command: 'echo -e "unknwon" > words_to_ignore.txt'
  15. - run:
  16. name: check documentation spelling errors
  17. command: 'codespell -I ./words_to_ignore.txt docs/'
  18. gometalinter:
  19. docker:
  20. - image: circleci/golang:1.10
  21. environment:
  22. # we need CGO because of go-sqlite3
  23. CGO_ENABLED: 1
  24. working_directory: /go/src/github.com/grafana/grafana
  25. steps:
  26. - checkout
  27. - run: 'go get -u gopkg.in/alecthomas/gometalinter.v2'
  28. - run: 'go get -u github.com/tsenart/deadcode'
  29. - run: 'go get -u github.com/gordonklaus/ineffassign'
  30. - run: 'go get -u github.com/opennota/check/cmd/structcheck'
  31. - run: 'go get -u github.com/mdempsky/unconvert'
  32. - run: 'go get -u github.com/opennota/check/cmd/varcheck'
  33. - run:
  34. name: run linters
  35. command: 'gometalinter.v2 --enable-gc --vendor --deadline 10m --disable-all --enable=deadcode --enable=ineffassign --enable=structcheck --enable=unconvert --enable=varcheck ./...'
  36. test-frontend:
  37. docker:
  38. - image: circleci/node:6.11.4
  39. steps:
  40. - checkout
  41. - run:
  42. name: install yarn
  43. command: 'sudo npm install -g yarn --quiet'
  44. - restore_cache:
  45. key: dependency-cache-{{ checksum "yarn.lock" }}
  46. # 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
  47. - run:
  48. name: yarn install
  49. command: 'yarn install --pure-lockfile --no-progress'
  50. - save_cache:
  51. key: dependency-cache-{{ checksum "yarn.lock" }}
  52. paths:
  53. - node_modules
  54. - run:
  55. name: frontend tests
  56. command: './scripts/circle-test-frontend.sh'
  57. test-backend:
  58. docker:
  59. - image: circleci/golang:1.10
  60. working_directory: /go/src/github.com/grafana/grafana
  61. steps:
  62. - checkout
  63. - run:
  64. name: build backend and run go tests
  65. command: './scripts/circle-test-backend.sh'
  66. build:
  67. docker:
  68. - image: grafana/build-container:v0.1
  69. working_directory: /go/src/github.com/grafana/grafana
  70. steps:
  71. - checkout
  72. - run:
  73. name: build and package grafana
  74. command: './scripts/build/build.sh'
  75. - run:
  76. name: sign packages
  77. command: './scripts/build/sign_packages.sh'
  78. - run:
  79. name: sha-sum packages
  80. command: 'go run build.go sha-dist'
  81. - run:
  82. name: Build Grafana.com publisher
  83. command: 'go build -o scripts/publish scripts/build/publish.go'
  84. - persist_to_workspace:
  85. root: .
  86. paths:
  87. - dist/grafana*
  88. - scripts/*.sh
  89. - scripts/publish
  90. build-enterprise:
  91. docker:
  92. - image: grafana/build-container:v0.1
  93. working_directory: /go/src/github.com/grafana/grafana
  94. steps:
  95. - checkout
  96. - run:
  97. name: build and package grafana
  98. command: './scripts/build/build_enterprise.sh'
  99. - run:
  100. name: sign packages
  101. command: './scripts/build/sign_packages.sh'
  102. - run:
  103. name: sha-sum packages
  104. command: 'go run build.go sha-dist'
  105. deploy-master:
  106. docker:
  107. - image: circleci/python:2.7-stretch
  108. steps:
  109. - attach_workspace:
  110. at: .
  111. - run:
  112. name: install awscli
  113. command: 'sudo pip install awscli'
  114. - run:
  115. name: deploy to s3
  116. command: 'aws s3 sync ./dist s3://$BUCKET_NAME/master'
  117. - run:
  118. name: Trigger Windows build
  119. command: './scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} master'
  120. - run:
  121. name: Trigger Docker build
  122. command: './scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN}'
  123. - run:
  124. name: Publish to Grafana.com
  125. command: './scripts/publish -apiKey ${GRAFANA_COM_API_KEY}'
  126. deploy-release:
  127. docker:
  128. - image: circleci/python:2.7-stretch
  129. steps:
  130. - attach_workspace:
  131. at: .
  132. - run:
  133. name: install awscli
  134. command: 'sudo pip install awscli'
  135. - run:
  136. name: deploy to s3
  137. command: 'aws s3 sync ./dist s3://$BUCKET_NAME/release'
  138. - run:
  139. name: Trigger Windows build
  140. command: './scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} release'
  141. - run:
  142. name: Trigger Docker build
  143. command: './scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN} ${CIRCLE_TAG}'
  144. workflows:
  145. version: 2
  146. test-and-build:
  147. jobs:
  148. - codespell:
  149. filters:
  150. tags:
  151. only: /.*/
  152. - gometalinter:
  153. filters:
  154. tags:
  155. only: /.*/
  156. - build:
  157. filters:
  158. tags:
  159. only: /.*/
  160. - test-frontend:
  161. filters:
  162. tags:
  163. only: /.*/
  164. - test-backend:
  165. filters:
  166. tags:
  167. only: /.*/
  168. - deploy-master:
  169. requires:
  170. - test-backend
  171. - test-frontend
  172. - build
  173. filters:
  174. branches:
  175. only: master
  176. - deploy-release:
  177. requires:
  178. - test-backend
  179. - test-frontend
  180. - build
  181. filters:
  182. branches:
  183. ignore: /.*/
  184. tags:
  185. only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
  186. - build-enterprise:
  187. filters:
  188. tags:
  189. only: /.*/