|
| 1 | +version: 2.0 |
| 2 | + |
| 3 | +# Inspired by: |
| 4 | +# https://github.com/CircleCI-Public/circleci-demo-workflows/blob/workspace-forwarding/.circleci/config.yml |
| 5 | +# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs |
| 6 | +# |
| 7 | +# For list of official CircleCI node.js images, go to: |
| 8 | +# https://hub.docker.com/r/circleci/node/tags/ |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + docker: |
| 13 | + - image: circleci/node:10.9.0 |
| 14 | + working_directory: ~/plotly.js |
| 15 | + steps: |
| 16 | + - checkout |
| 17 | + - restore_cache: |
| 18 | + keys: |
| 19 | + - v{{ .Environment.CIRCLE_CACHE_VERSION }}-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} |
| 20 | + - v{{ .Environment.CIRCLE_CACHE_VERSION }}-deps-master-{{ checksum "package-lock.json" }} |
| 21 | + - run: |
| 22 | + name: Install dependencies |
| 23 | + command: | |
| 24 | + npm install |
| 25 | + - run: |
| 26 | + name: List dependency versions |
| 27 | + command: | |
| 28 | + echo "npm: $(npm --version)" |
| 29 | + echo "node: $(node --version)" |
| 30 | + npm ls || true |
| 31 | + - run: |
| 32 | + name: Pretest |
| 33 | + command: | |
| 34 | + npm run pretest |
| 35 | + npm run cibuild |
| 36 | + - save_cache: |
| 37 | + paths: |
| 38 | + - node_modules |
| 39 | + key: v{{ .Environment.CIRCLE_CACHE_VERSION }}-deps-{{ .Branch }}-{{ checksum "package.json" }} |
| 40 | + - persist_to_workspace: |
| 41 | + root: . |
| 42 | + paths: |
| 43 | + - node_modules |
| 44 | + - build |
| 45 | + - dist |
| 46 | + |
| 47 | + test-jasmine: |
| 48 | + docker: |
| 49 | + # need '-browsers' version to test in real (xvfb-wrapped) browsers |
| 50 | + - image: circleci/node:10.9.0-browsers |
| 51 | + working_directory: ~/plotly.js |
| 52 | + steps: |
| 53 | + - checkout |
| 54 | + - attach_workspace: |
| 55 | + at: ~/plotly.js |
| 56 | + - run: |
| 57 | + name: Run jasmine tests (batch 1) |
| 58 | + command: ./.circleci/test.sh jasmine |
| 59 | + |
| 60 | + test-jasmine2: |
| 61 | + docker: |
| 62 | + # need '-browsers' version to test in real (xvfb-wrapped) browsers |
| 63 | + - image: circleci/node:10.9.0-browsers |
| 64 | + working_directory: ~/plotly.js |
| 65 | + steps: |
| 66 | + - checkout |
| 67 | + - attach_workspace: |
| 68 | + at: ~/plotly.js |
| 69 | + - run: |
| 70 | + name: Run jasmine tests (batch 2) |
| 71 | + command: ./.circleci/test.sh jasmine2 |
| 72 | + |
| 73 | + test-image: |
| 74 | + docker: |
| 75 | + - image: plotly/testbed:latest |
| 76 | + working_directory: /var/www/streambed/image_server/plotly.js/ |
| 77 | + steps: |
| 78 | + - checkout |
| 79 | + - attach_workspace: |
| 80 | + at: /var/www/streambed/image_server/plotly.js/ |
| 81 | + - run: |
| 82 | + name: Run and setup container |
| 83 | + command: | |
| 84 | + supervisord & |
| 85 | + npm run docker -- setup |
| 86 | + - run: |
| 87 | + name: Run image tests |
| 88 | + command: ./.circleci/test.sh image |
| 89 | + - store_artifacts: |
| 90 | + path: build |
| 91 | + |
| 92 | + test-image2: |
| 93 | + docker: |
| 94 | + - image: plotly/testbed:latest |
| 95 | + working_directory: /var/www/streambed/image_server/plotly.js/ |
| 96 | + steps: |
| 97 | + - checkout |
| 98 | + - attach_workspace: |
| 99 | + at: /var/www/streambed/image_server/plotly.js/ |
| 100 | + - run: |
| 101 | + name: Run and setup container |
| 102 | + command: | |
| 103 | + supervisord & |
| 104 | + npm run docker -- setup |
| 105 | + - run: |
| 106 | + name: Run image tests |
| 107 | + command: ./.circleci/test.sh image2 |
| 108 | + - store_artifacts: |
| 109 | + path: build |
| 110 | + |
| 111 | + test-syntax: |
| 112 | + docker: |
| 113 | + - image: circleci/node:10.9.0 |
| 114 | + working_directory: ~/plotly.js |
| 115 | + steps: |
| 116 | + - checkout |
| 117 | + - attach_workspace: |
| 118 | + at: ~/plotly.js |
| 119 | + - run: |
| 120 | + name: Run syntax tests |
| 121 | + command: ./.circleci/test.sh syntax |
| 122 | + |
| 123 | +workflows: |
| 124 | + version: 2 |
| 125 | + build-and-test: |
| 126 | + jobs: |
| 127 | + - build |
| 128 | + - test-jasmine: |
| 129 | + requires: |
| 130 | + - build |
| 131 | + - test-jasmine2: |
| 132 | + requires: |
| 133 | + - build |
| 134 | + - test-image: |
| 135 | + requires: |
| 136 | + - build |
| 137 | + - test-image2: |
| 138 | + requires: |
| 139 | + - build |
| 140 | + - test-syntax: |
| 141 | + requires: |
| 142 | + - build |
0 commit comments