|
1 | | ---- |
2 | 1 | version: 2 |
3 | 2 | jobs: |
4 | | - node-latest: &test |
| 3 | + build: |
| 4 | + working_directory: ~/mern-starter |
| 5 | + # The primary container is an instance of the first image listed. The job's commands run in this container. |
5 | 6 | docker: |
6 | | - - image: node:latest |
7 | | - working_directory: ~/cli |
| 7 | + - image: circleci/node:4.8.2-jessie |
| 8 | + # The secondary container is an instance of the second listed image which is run in a common network where ports exposed on the primary container are available on localhost. |
| 9 | + - image: mongo:3.4.4-jessie |
8 | 10 | steps: |
9 | 11 | - checkout |
10 | | - - restore_cache: &restore_cache |
11 | | - keys: |
12 | | - - v1-npm-{{checksum ".circleci/config.yml"}}-{{ checksum "package-lock.json"}} |
13 | | - - v1-npm-{{checksum ".circleci/config.yml"}} |
14 | 12 | - run: |
15 | | - name: Install dependencies |
16 | | - command: .circleci/greenkeeper |
17 | | - - run: ./bin/run --version |
18 | | - - run: ./bin/run --help |
| 13 | + name: Update npm |
| 14 | + command: 'sudo npm install -g npm@latest' |
| 15 | + - restore_cache: |
| 16 | + key: dependency-cache-{{ checksum "package-lock.json" }} |
19 | 17 | - run: |
20 | | - name: Testing |
21 | | - command: npm test |
22 | | - - run: |
23 | | - name: Submitting code coverage to codecov |
24 | | - command: | |
25 | | - ./node_modules/.bin/nyc report --reporter text-lcov > coverage.lcov |
26 | | - curl -s https://codecov.io/bash | bash |
27 | | - node-8: |
28 | | - <<: *test |
| 18 | + name: Install npm wee |
| 19 | + command: npm install |
| 20 | + - save_cache: |
| 21 | + key: dependency-cache-{{ checksum "package-lock.json" }} |
| 22 | + paths: |
| 23 | + - node_modules |
| 24 | + test: |
29 | 25 | docker: |
30 | | - - image: node:8 |
31 | | - release: |
32 | | - <<: *test |
| 26 | + - image: circleci/node:4.8.2-jessie |
| 27 | + - image: mongo:3.4.4-jessie |
33 | 28 | steps: |
34 | | - - add_ssh_keys |
35 | 29 | - checkout |
36 | | - - restore_cache: *restore_cache |
37 | 30 | - run: |
38 | | - name: Install dependencies |
39 | | - command: | |
40 | | - npm install -g @oclif/semantic-release@3 semantic-release@15 |
41 | | - npm install |
| 31 | + name: Test |
| 32 | + command: npm test |
42 | 33 | - run: |
43 | | - name: Cutting release |
44 | | - command: | |
45 | | - semantic-release -e @oclif/semantic-release |
46 | | - - save_cache: |
47 | | - key: v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "package-lock.json"}} |
48 | | - paths: |
49 | | - - ~/cli/node_modules |
50 | | - - ~/.npm |
51 | | - - /usr/local/lib/node_modules |
| 34 | + name: Generate code coverage |
| 35 | + command: './node_modules/.bin/nyc report --reporter=text-lcov' |
| 36 | + - store_artifacts: |
| 37 | + path: test-results.xml |
| 38 | + prefix: tests |
| 39 | + - store_artifacts: |
| 40 | + path: coverage |
| 41 | + prefix: coverage |
52 | 42 |
|
53 | 43 | workflows: |
54 | 44 | version: 2 |
55 | | - "cdt": |
| 45 | + build_and_test: |
56 | 46 | jobs: |
57 | | - - node-latest |
58 | | - - node-8 |
59 | | - - release: |
60 | | - context: org-global |
61 | | - filters: |
62 | | - branches: {only: master} |
| 47 | + - build |
| 48 | + - test: |
63 | 49 | requires: |
64 | | - - node-latest |
65 | | - - node-8 |
| 50 | + - build |
| 51 | + filters: |
| 52 | + branches: |
| 53 | + only: master |
0 commit comments