Skip to content

Commit b14ab1f

Browse files
committed
[CIRCLE_CI]: added config for single job
1 parent d0fa2ca commit b14ab1f

File tree

2 files changed

+63
-23
lines changed

2 files changed

+63
-23
lines changed

.circleci/config.yml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2
22
jobs:
3-
build:
3+
build_and_test:
44
working_directory: ~/mern-starter
55
# The primary container is an instance of the first image listed. The job's commands run in this container.
66
docker:
@@ -20,24 +20,6 @@ jobs:
2020
key: dependency-cache-{{ checksum "package-lock.json" }}
2121
paths:
2222
- node_modules
23-
test:
24-
docker:
25-
- image: circleci/node:latest
26-
steps:
27-
- checkout
28-
# needed to add here also as both install and test are different docker instances and need to do same thing again in different instance
29-
- run:
30-
name: Update npm
31-
command: 'sudo npm install -g npm@latest'
32-
- restore_cache:
33-
key: dependency-cache-{{ checksum "package-lock.json" }}
34-
- run:
35-
name: Install npm dependencies
36-
command: npm install
37-
- save_cache:
38-
key: dependency-cache-{{ checksum "package-lock.json" }}
39-
paths:
40-
- node_modules
4123
- run:
4224
name: Test
4325
command: npm test
@@ -55,7 +37,4 @@ workflows:
5537
version: 2
5638
build_and_test:
5739
jobs:
58-
- build
59-
- test:
60-
requires:
61-
- build
40+
- build_and_test

.circleci/config_2jobs.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
version: 2
2+
jobs:
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.
6+
docker:
7+
- image: circleci/node:latest
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+
steps:
10+
- checkout
11+
- run:
12+
name: Update npm
13+
command: 'sudo npm install -g npm@latest'
14+
- restore_cache:
15+
key: dependency-cache-{{ checksum "package-lock.json" }}
16+
- run:
17+
name: Install npm dependencies
18+
command: npm install
19+
- save_cache:
20+
key: dependency-cache-{{ checksum "package-lock.json" }}
21+
paths:
22+
- node_modules
23+
test:
24+
docker:
25+
- image: circleci/node:latest
26+
steps:
27+
- checkout
28+
# needed to add here also as both install and test are different docker instances and need to do same thing again in different instance
29+
- run:
30+
name: Update npm
31+
command: 'sudo npm install -g npm@latest'
32+
- restore_cache:
33+
key: dependency-cache-{{ checksum "package-lock.json" }}
34+
- run:
35+
name: Install npm dependencies
36+
command: npm install
37+
- save_cache:
38+
key: dependency-cache-{{ checksum "package-lock.json" }}
39+
paths:
40+
- node_modules
41+
- run:
42+
name: Test
43+
command: npm test
44+
- run:
45+
name: Generate code coverage
46+
command: './node_modules/.bin/nyc report --reporter=text-lcov'
47+
- store_artifacts:
48+
path: test-results.xml
49+
prefix: tests
50+
- store_artifacts:
51+
path: coverage
52+
prefix: coverage
53+
54+
workflows:
55+
version: 2
56+
build_and_test:
57+
jobs:
58+
- build
59+
- test:
60+
requires:
61+
- build

0 commit comments

Comments
 (0)