|
1 |
| -version: 2 # use CircleCI 2.0 |
| 1 | +version: 2.1 |
2 | 2 |
|
3 |
| -jobs: # a collection of steps |
4 |
| - build: # runs not using Workflows must have a `build` job as entry point |
5 |
| - working_directory: ~/worldmap-panel # directory where steps will run |
6 |
| - docker: # run the steps with Docker |
7 |
| - - image: circleci/node:latest |
8 |
| - steps: |
9 |
| - - checkout |
10 |
| - - restore_cache: |
11 |
| - name: Restore Yarn Package Cache |
12 |
| - keys: |
13 |
| - - yarn-packages-{{ checksum "yarn.lock" }} |
14 |
| - - run: |
15 |
| - name: Install Dependencies |
16 |
| - command: yarn install --frozen-lockfile |
17 |
| - - save_cache: |
18 |
| - name: Save Yarn Package Cache |
19 |
| - key: yarn-packages-{{ checksum "yarn.lock" }} |
20 |
| - paths: |
21 |
| - - ~/.cache/yarn |
22 |
| - - run: # run tests |
23 |
| - name: test |
24 |
| - command: yarn test |
| 3 | +parameters: |
| 4 | + ssh-fingerprint: |
| 5 | + type: string |
| 6 | + default: ${GITHUB_SSH_FINGERPRINT} |
| 7 | + |
| 8 | +aliases: |
| 9 | + # Workflow filters |
| 10 | + - &filter-only-master |
| 11 | + branches: |
| 12 | + only: master |
| 13 | + - &filter-only-release |
| 14 | + branches: |
| 15 | + only: /^v[1-9]*[0-9]+\.[1-9]*[0-9]+\.x$/ |
| 16 | + |
| 17 | +workflows: |
| 18 | + plugin_workflow: |
| 19 | + jobs: |
| 20 | + - build |
| 21 | + - report: |
| 22 | + requires: |
| 23 | + - build |
| 24 | + - approve_release: |
| 25 | + type: approval |
| 26 | + requires: |
| 27 | + - report |
| 28 | + filters: *filter-only-release |
| 29 | + - publish_github_release: |
| 30 | + requires: |
| 31 | + - approve_release |
| 32 | + filters: *filter-only-release |
| 33 | + |
| 34 | +executors: |
| 35 | + default_exec: # declares a reusable executor |
| 36 | + docker: |
| 37 | + - image: srclosson/grafana-plugin-ci-alpine:latest |
| 38 | + e2e_exec: |
| 39 | + docker: |
| 40 | + - image: srclosson/grafana-plugin-ci-e2e:latest |
| 41 | + |
| 42 | +jobs: |
| 43 | + build: |
| 44 | + executor: default_exec |
| 45 | + steps: |
| 46 | + - checkout |
| 47 | + - restore_cache: |
| 48 | + name: restore node_modules |
| 49 | + keys: |
| 50 | + - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} |
| 51 | + - run: |
| 52 | + name: Install dependencies |
| 53 | + command: | |
| 54 | + mkdir ci |
| 55 | + [ -f ~/project/node_modules/.bin/grafana-toolkit ] || yarn install --frozen-lockfile |
| 56 | + - save_cache: |
| 57 | + name: save node_modules |
| 58 | + paths: |
| 59 | + - ~/project/node_modules |
| 60 | + key: build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} |
| 61 | + - save_cache: |
| 62 | + name: save cypress cache |
| 63 | + paths: |
| 64 | + - ~/.cache/Cypress |
| 65 | + key: cypress-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} |
| 66 | + - run: |
| 67 | + name: Build and test panel |
| 68 | + command: /usr/local/bin/grafana-toolkit plugin:ci-build |
| 69 | + - run: |
| 70 | + name: Move results to ci folder |
| 71 | + command: /usr/local/bin/grafana-toolkit plugin:ci-build --finish |
| 72 | + - run: |
| 73 | + name: Package distribution |
| 74 | + command: | |
| 75 | + /usr/local/bin/grafana-toolkit plugin:ci-package |
| 76 | + - persist_to_workspace: |
| 77 | + root: . |
| 78 | + paths: |
| 79 | + - ci/jobs/package |
| 80 | + - ci/packages |
| 81 | + - ci/dist |
| 82 | + - ci/grafana-test-env |
| 83 | + - store_artifacts: |
| 84 | + path: ci |
| 85 | + |
| 86 | + report: |
| 87 | + executor: default_exec |
| 88 | + steps: |
| 89 | + - checkout |
| 90 | + - attach_workspace: |
| 91 | + at: . |
| 92 | + - restore_cache: |
| 93 | + name: restore node_modules |
| 94 | + keys: |
| 95 | + - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} |
| 96 | + - run: |
| 97 | + name: Toolkit report |
| 98 | + command: | |
| 99 | + /usr/local/bin/grafana-toolkit plugin:ci-report |
| 100 | + - store_artifacts: |
| 101 | + path: ci |
| 102 | + |
| 103 | + publish_github_release: |
| 104 | + executor: default_exec |
| 105 | + steps: |
| 106 | + - checkout |
| 107 | + - add_ssh_keys: |
| 108 | + fingerprints: |
| 109 | + - "${GITHUB_SSH_FINGERPRINT}" |
| 110 | + - attach_workspace: |
| 111 | + at: . |
| 112 | + - restore_cache: |
| 113 | + name: restore node_modules |
| 114 | + keys: |
| 115 | + - build-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }} |
| 116 | + - run: |
| 117 | + name: "Publish Release on GitHub" |
| 118 | + command: | |
| 119 | + /usr/local/bin/grafana-toolkit plugin:github-publish |
0 commit comments