1+ version : 2.1
2+
3+ defaults : &defaults
4+ docker :
5+ - image : circleci/node
6+
7+ working_directory : ~/app
8+
9+ orbs :
10+ codecov : codecov/codecov@1.0.4
11+
12+ jobs :
13+ commitlint :
14+ docker :
15+ - image : williamlauze/circleci-commitlint:latest
16+ working_directory : ~/app
17+
18+ steps :
19+ - checkout
20+ - run :
21+ name : Lint commit messages
22+ command : /bin/sh /.scripts/commitlint_range.sh
23+
24+ checkout :
25+ << : *defaults
26+
27+ steps :
28+ - restore_cache :
29+ name : Restore Repository Cache
30+ keys :
31+ - repo-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
32+ - repo-{{ .Branch }}
33+ - repo-master
34+ - repo-
35+
36+ - checkout
37+
38+ - save_cache :
39+ name : Save Repository Cache
40+ key : repo-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
41+ paths :
42+ - .
43+
44+ - persist_to_workspace :
45+ root : .
46+ paths :
47+ - .
48+
49+ install-dependencies :
50+ << : *defaults
51+
52+ steps :
53+ - attach_workspace :
54+ at : .
55+
56+ - restore_cache :
57+ name : Restore yarn Package Cache
58+ keys :
59+ - yarn-{{ checksum "yarn.lock" }}
60+ - yarn-
61+
62+ - run :
63+ name : Install Dependencies
64+ command : yarn install
65+
66+ - save_cache :
67+ name : Save yarn Package Cache
68+ key : yarn-{{ checksum "yarn.lock" }}
69+ paths :
70+ - node_modules
71+
72+ - persist_to_workspace :
73+ root : .
74+ paths :
75+ - node_modules
76+
77+ lint :
78+ << : *defaults
79+
80+ steps :
81+ - attach_workspace :
82+ at : .
83+
84+ - run :
85+ name : Add Yarn Binary Folder To $PATH
86+ command : export PATH="$PATH:`yarn global bin`"
87+
88+ - run :
89+ name : Lint JS
90+ command : yarn lint
91+
92+ test :
93+ << : *defaults
94+
95+ steps :
96+ - attach_workspace :
97+ at : .
98+
99+ - run :
100+ name : Add Yarn Binary Folder To $PATH
101+ command : export PATH="$PATH:`yarn global bin`"
102+
103+ - run :
104+ name : Run tests
105+ command : yarn test:unit
106+
107+ coverage :
108+ << : *defaults
109+
110+ steps :
111+ - attach_workspace :
112+ at : .
113+
114+ - run :
115+ name : Add Yarn Binary Folder To $PATH
116+ command : export PATH="$PATH:`yarn global bin`"
117+
118+ - run :
119+ name : Generate and upload coverage report
120+ command : yarn test:unit --coverage --coverageReporters=json --collectCoverage=true --coverageDirectory=/home/circleci/app/coverage
121+
122+ - store_test_results :
123+ path : ~/app/coverage
124+
125+ - store_artifacts :
126+ path : ~/app/coverage
127+ destination : ~/app/coverage
128+
129+ - codecov/upload :
130+ token : 84850ad5-b40a-4ebb-975b-ee2c5b99d28e
131+ file : ~/app/coverage/*.json
132+ flags : frontend
133+
134+ workflows :
135+ version : 2
136+
137+ main :
138+ jobs :
139+ - checkout
140+ - commitlint :
141+ filters :
142+ branches :
143+ ignore : master
144+ - install-dependencies :
145+ requires :
146+ - checkout
147+ - test :
148+ requires :
149+ - install-dependencies
150+ - coverage :
151+ requires :
152+ - install-dependencies
153+ - lint :
154+ requires :
155+ - install-dependencies
0 commit comments