1+ version : 2.1
2+
13aliases :
24 - &install_yarn_version
35 name : Install specific Yarn version
46 command : |
57 curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22.5
68 echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV
7-
89 - &restore_yarn_cache
910 name : Restore Yarn cache
1011 keys :
1112 - yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}
12-
1313 - &save_yarn_cache
1414 name : Save Yarn cache
1515 key : yarn-{{ .Branch }}-packages-{{ checksum "yarn.lock" }}
1616 paths :
1717 - ~/.cache/yarn
18-
1918 - &run_yarn_install
2019 name : Install dependencies
2120 command : yarn install
21+ - &restore_dist_folders
22+ name : Restore dist folders
23+ command : |
24+ set -exu
25+
26+ mkdir -p packages/autocomplete-core/dist
27+ mkdir -p packages/autocomplete-js/dist
28+ mkdir -p packages/autocomplete-plugin-recent-searches/dist
29+ mkdir -p packages/autocomplete-preset-algolia/dist
30+
31+ cp -R /tmp/workspace/packages/autocomplete-core/dist packages/autocomplete-core
32+ cp -R /tmp/workspace/packages/autocomplete-js/dist packages/autocomplete-js
33+ cp -R /tmp/workspace/packages/autocomplete-plugin-recent-searches/dist packages/autocomplete-plugin-recent-searches
34+ cp -R /tmp/workspace/packages/autocomplete-preset-algolia/dist packages/autocomplete-preset-algolia
2235
2336defaults : &defaults
2437 working_directory : ~/autocomplete
2538 docker :
2639 - image : circleci/node:14.15.0
2740
28- version : 2.1
41+ references :
42+ workspace_root : &workspace_root /tmp/workspace
43+ attach_workspace : &attach_workspace
44+ attach_workspace :
45+ at : *workspace_root
2946
3047jobs :
31- test_build :
48+ build :
3249 << : *defaults
3350 steps :
3451 - checkout
@@ -37,46 +54,86 @@ jobs:
3754 - run : *run_yarn_install
3855 - save_cache : *save_yarn_cache
3956 - run :
40- name : Build & Test packages size
57+ name : Build
58+ command : yarn run build
59+ - run :
60+ name : Move dist folders to workspace
4161 command : |
42- yarn run build
43- yarn run test:size
62+ set -exu
4463
64+ mkdir -p /tmp/workspace/packages/autocomplete-core/dist
65+ mkdir -p /tmp/workspace/packages/autocomplete-js/dist
66+ mkdir -p /tmp/workspace/packages/autocomplete-plugin-recent-searches/dist
67+ mkdir -p /tmp/workspace/packages/autocomplete-preset-algolia/dist
68+
69+ cp -R packages/autocomplete-core/dist /tmp/workspace/packages/autocomplete-core
70+ cp -R packages/autocomplete-js/dist /tmp/workspace/packages/autocomplete-js
71+ cp -R packages/autocomplete-plugin-recent-searches/dist /tmp/workspace/packages/autocomplete-plugin-recent-searches
72+ cp -R packages/autocomplete-preset-algolia/dist /tmp/workspace/packages/autocomplete-preset-algolia
73+ - persist_to_workspace :
74+ root : *workspace_root
75+ paths :
76+ - packages
4577 test_lint :
4678 << : *defaults
4779 steps :
4880 - checkout
81+ - *attach_workspace
4982 - run : *install_yarn_version
5083 - restore_cache : *restore_yarn_cache
5184 - run : *run_yarn_install
5285 - save_cache : *save_yarn_cache
86+ - run : *restore_dist_folders
5387 - run :
54- name : Lint & Code styles
88+ name : Linting
5589 command : yarn run lint
90+ test_types :
91+ << : *defaults
92+ steps :
93+ - checkout
94+ - run : *install_yarn_version
95+ - restore_cache : *restore_yarn_cache
96+ - run : *run_yarn_install
97+ - save_cache : *save_yarn_cache
5698 - run :
57- name : Type Checking
58- command : yarn test:types
59-
99+ name : Type checking
100+ command : yarn run test:types
60101 test_unit :
61102 << : *defaults
62103 steps :
63104 - checkout
105+ - *attach_workspace
64106 - run : *install_yarn_version
65107 - restore_cache : *restore_yarn_cache
66108 - run : *run_yarn_install
67109 - save_cache : *save_yarn_cache
110+ - run : *restore_dist_folders
68111 - run :
69112 name : Unit tests
70113 command : yarn run test --maxWorkers=4
71-
114+ test_size :
115+ << : *defaults
116+ steps :
117+ - checkout
118+ - *attach_workspace
119+ - run : *install_yarn_version
120+ - restore_cache : *restore_yarn_cache
121+ - run : *run_yarn_install
122+ - save_cache : *save_yarn_cache
123+ - run : *restore_dist_folders
124+ - run :
125+ name : Test packages size
126+ command : yarn run test:size
72127 release :
73128 << : *defaults
74129 steps :
75130 - checkout
131+ - *attach_workspace
76132 - run : *install_yarn_version
77133 - restore_cache : *restore_yarn_cache
78134 - run : *run_yarn_install
79135 - save_cache : *save_yarn_cache
136+ - run : *restore_dist_folders
80137 - run :
81138 name : Release if needed
82139 command : yarn run shipjs trigger
@@ -85,19 +142,24 @@ workflows:
85142 version : 2.1
86143 ci :
87144 jobs :
88- - test_build :
89- filters :
90- branches :
91- only : next
92- - test_unit :
93- filters :
94- branches :
95- only : next
145+ - build
96146 - test_lint :
97- filters :
98- branches :
99- only : next
147+ requires :
148+ - build
149+ - test_types
150+ - test_unit :
151+ requires :
152+ - build
153+ - test_size :
154+ requires :
155+ - build
100156 - release :
157+ requires :
158+ - test_unit
159+ - test_lint
160+ - test_types
161+ - test_size
162+ - build
101163 filters :
102164 branches :
103165 only : next
0 commit comments