circle.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. version: 2
  2. jobs:
  3. test-frontend:
  4. docker:
  5. - image: circleci/node:6.11.4
  6. steps:
  7. - checkout
  8. - run:
  9. name: install yarn
  10. command: 'sudo npm install -g yarn --quiet'
  11. - restore_cache:
  12. key: dependency-cache-{{ checksum "yarn.lock" }}
  13. # 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
  14. - run:
  15. name: yarn install
  16. command: 'yarn install --pure-lockfile --no-progress'
  17. - save_cache:
  18. key: dependency-cache-{{ checksum "yarn.lock" }}
  19. paths:
  20. - node_modules
  21. - run:
  22. name: frontend tests
  23. command: './scripts/circle-test-frontend.sh'
  24. test-backend:
  25. docker:
  26. - image: circleci/golang:1.10
  27. working_directory: /go/src/github.com/grafana/grafana
  28. steps:
  29. - checkout
  30. - run:
  31. name: build backend and run go tests
  32. command: './scripts/circle-test-backend.sh'
  33. build:
  34. docker:
  35. - image: grafana/build-container:v0.1
  36. working_directory: /go/src/github.com/grafana/grafana
  37. steps:
  38. - checkout
  39. - run:
  40. name: build and package grafana
  41. command: './scripts/build/build.sh'
  42. - run:
  43. name: sign packages
  44. command: './scripts/build/sign_packages.sh'
  45. - run:
  46. name: sha-sum packages
  47. command: 'go run build.go sha-dist'
  48. - run:
  49. name: Build Grafana.com publisher
  50. command: 'go build -o scripts/publish scripts/build/publish.go'
  51. - persist_to_workspace:
  52. root: .
  53. paths:
  54. - dist/grafana*
  55. - scripts/*.sh
  56. - scripts/publish
  57. deploy-master:
  58. docker:
  59. - image: circleci/python:2.7-stretch
  60. steps:
  61. - attach_workspace:
  62. at: .
  63. - run:
  64. name: install awscli
  65. command: 'sudo pip install awscli'
  66. - run:
  67. name: deploy to s3
  68. command: 'aws s3 sync ./dist s3://$BUCKET_NAME/master'
  69. - run:
  70. name: Trigger Windows build
  71. command: './scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} master'
  72. - run:
  73. name: Trigger Docker build
  74. command: './scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN}'
  75. - run:
  76. name: Publish to Grafana.com
  77. command: './scripts/publish -apiKey ${GRAFANA_COM_API_KEY}'
  78. deploy-release:
  79. docker:
  80. - image: circleci/python:2.7-stretch
  81. steps:
  82. - attach_workspace:
  83. at: dist
  84. - run:
  85. name: install awscli
  86. command: 'sudo pip install awscli'
  87. - run:
  88. name: deploy to s3
  89. command: 'aws s3 sync ./dist s3://$BUCKET_NAME/release'
  90. - run:
  91. name: Trigger Windows build
  92. command: './scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} ${CIRCLE_SHA1} release'
  93. - run:
  94. name: Trigger Docker build
  95. command: './scripts/trigger_docker_build.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN} ${CIRCLE_TAG}'
  96. workflows:
  97. version: 2
  98. test-and-build:
  99. jobs:
  100. - build:
  101. filters:
  102. tags:
  103. only: /.*/
  104. - test-frontend:
  105. filters:
  106. tags:
  107. only: /.*/
  108. - test-backend:
  109. filters:
  110. tags:
  111. only: /.*/
  112. - deploy-master:
  113. requires:
  114. - test-backend
  115. - test-frontend
  116. - build
  117. filters:
  118. branches:
  119. only: master
  120. - deploy-release:
  121. requires:
  122. - test-backend
  123. - test-frontend
  124. - build
  125. filters:
  126. branches:
  127. ignore: /.*/
  128. tags:
  129. only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/