|
1 | 1 | version: 2
|
| 2 | + |
| 3 | +# Settings common to each job. |
| 4 | +anchor_1: &defaults |
| 5 | + working_directory: ~/angular-cli |
| 6 | + docker: |
| 7 | + - image: angular/ngcontainer |
| 8 | + |
| 9 | +# Restore cache based on package-lock.json checksum for branch. |
| 10 | +anchor_2: &restore_cache_defaults |
| 11 | + key: angular-cli-{{ checksum "package-lock.json" }} |
| 12 | + |
| 13 | +# Attach workspace that contains: |
| 14 | +# - dist/ : built cli |
| 15 | +# - angular-cli-e2e-default/ : initialized e2e test project |
| 16 | +anchor_3: &attach_workspace_defaults |
| 17 | + at: /workspace |
| 18 | + |
2 | 19 | jobs:
|
3 | 20 | build:
|
4 |
| - working_directory: ~/angular-cli |
5 |
| - docker: |
6 |
| - - image: angular/ngcontainer |
7 |
| - - image: node:8.4 |
| 21 | + <<: *defaults |
8 | 22 | steps:
|
9 | 23 | - checkout
|
10 | 24 | - restore_cache:
|
11 |
| - key: angular-cli-{{ .Branch }}-{{ checksum "package-lock.json" }} |
12 |
| - - run: | |
13 |
| - node --version |
14 |
| - npm --version |
15 |
| - npm install --quiet |
| 25 | + <<: *restore_cache_defaults |
| 26 | + - run: node --version |
| 27 | + - run: npm --version |
| 28 | + - run: npm install --quiet |
| 29 | + - run: npm run build |
16 | 30 | - save_cache:
|
17 |
| - key: angular-cli-{{ .Branch }}-{{ checksum "package-lock.json" }} |
| 31 | + key: angular-cli-{{ checksum "package-lock.json" }} |
18 | 32 | paths:
|
19 | 33 | - "node_modules"
|
20 |
| - - run: xvfb-run -a node tests/run_e2e.js --glob=tests/build/** |
| 34 | + |
| 35 | + lint: |
| 36 | + <<: *defaults |
| 37 | + steps: |
| 38 | + - checkout |
| 39 | + - restore_cache: |
| 40 | + <<: *restore_cache_defaults |
| 41 | + - run: npm run lint |
| 42 | + |
| 43 | + test: |
| 44 | + <<: *defaults |
| 45 | + steps: |
| 46 | + - checkout |
| 47 | + - restore_cache: |
| 48 | + <<: *restore_cache_defaults |
| 49 | + - run: npm run test |
| 50 | + |
| 51 | + e2e-setup: |
| 52 | + <<: *defaults |
| 53 | + steps: |
| 54 | + - checkout |
| 55 | + - restore_cache: |
| 56 | + <<: *restore_cache_defaults |
| 57 | + - run: mkdir /workspace |
| 58 | + - run: mkdir /workspace/angular-cli-e2e-default |
| 59 | + # Ignore all tests, we just want the setup step to persist it to the workspace. |
| 60 | + - run: node tests/run_e2e.js --tmpdir=/workspace/angular-cli-e2e-default --ignore=**/* |
| 61 | + - run: mv dist /workspace/ |
| 62 | + - persist_to_workspace: |
| 63 | + root: /workspace |
| 64 | + paths: |
| 65 | + - dist/ |
| 66 | + - angular-cli-e2e-default/ |
| 67 | + |
| 68 | + e2e-0: |
| 69 | + <<: *defaults |
| 70 | + steps: |
| 71 | + - checkout |
| 72 | + - restore_cache: |
| 73 | + <<: *restore_cache_defaults |
| 74 | + - attach_workspace: |
| 75 | + <<: *attach_workspace_defaults |
| 76 | + - run: cp -r /workspace/dist/ ./ |
| 77 | + - run: xvfb-run -a node tests/run_e2e.js --nobuild --reuse=/workspace/angular-cli-e2e-default/test-project --nb-shards=4 --shard=0 --nosilent |
| 78 | + |
| 79 | + e2e-1: |
| 80 | + <<: *defaults |
| 81 | + steps: |
| 82 | + - checkout |
| 83 | + - restore_cache: |
| 84 | + <<: *restore_cache_defaults |
| 85 | + - attach_workspace: |
| 86 | + <<: *attach_workspace_defaults |
| 87 | + - run: cp -r /workspace/dist/ ./ |
| 88 | + - run: xvfb-run -a node tests/run_e2e.js --nobuild --reuse=/workspace/angular-cli-e2e-default/test-project --nb-shards=4 --shard=1 --nosilent |
| 89 | + |
| 90 | + e2e-2: |
| 91 | + <<: *defaults |
| 92 | + steps: |
| 93 | + - checkout |
| 94 | + - restore_cache: |
| 95 | + <<: *restore_cache_defaults |
| 96 | + - attach_workspace: |
| 97 | + <<: *attach_workspace_defaults |
| 98 | + - run: cp -r /workspace/dist/ ./ |
| 99 | + - run: xvfb-run -a node tests/run_e2e.js --nobuild --reuse=/workspace/angular-cli-e2e-default/test-project --nb-shards=4 --shard=2 --nosilent |
| 100 | + |
| 101 | + e2e-3: |
| 102 | + <<: *defaults |
| 103 | + steps: |
| 104 | + - checkout |
| 105 | + - restore_cache: |
| 106 | + <<: *restore_cache_defaults |
| 107 | + - attach_workspace: |
| 108 | + <<: *attach_workspace_defaults |
| 109 | + - run: cp -r /workspace/dist/ ./ |
| 110 | + - run: xvfb-run -a node tests/run_e2e.js --nobuild --reuse=/workspace/angular-cli-e2e-default/test-project --nb-shards=4 --shard=3 --nosilent |
| 111 | + |
| 112 | +workflows: |
| 113 | + version: 2 |
| 114 | + build_and_test: |
| 115 | + jobs: |
| 116 | + - build |
| 117 | + - lint: |
| 118 | + requires: |
| 119 | + - build |
| 120 | + - test: |
| 121 | + requires: |
| 122 | + - build |
| 123 | + - e2e-setup: |
| 124 | + requires: |
| 125 | + - build |
| 126 | + - e2e-0: |
| 127 | + requires: |
| 128 | + - e2e-setup |
| 129 | + - e2e-1: |
| 130 | + requires: |
| 131 | + - e2e-setup |
| 132 | + - e2e-2: |
| 133 | + requires: |
| 134 | + - e2e-setup |
| 135 | + - e2e-3: |
| 136 | + requires: |
| 137 | + - e2e-setup |
0 commit comments