11version : 2.1
2+ orbs :
3+ browser-tools : circleci/browser-tools@1.2.4
4+ commitlint : conventional-changelog/commitlint@1.0.0
5+ node : circleci/node@5.0.2
26aliases :
37 - &save_git_cache
48 save_cache :
@@ -40,20 +44,64 @@ aliases:
4044 - v3-npm-
4145 - &defaults
4246 docker :
43- - image : circleci/node:10-browsers
47+ # TODO: fix scratch-audio and change this to `cimg/node:lts-browsers`
48+ - image : cimg/node:14.20-browsers
49+ auth :
50+ username : $DOCKERHUB_USERNAME
51+ password : $DOCKERHUB_PASSWORD
52+ executor : node/default
4453 working_directory : ~/repo
4554
4655jobs :
47- setup :
56+ build-test-no-cache :
4857 << : *defaults
58+ environment :
59+ DETECT_CHROMEDRIVER_VERSION : " true"
60+ JEST_JUNIT_OUTPUT_DIR : test-results
61+ NODE_OPTIONS : --max-old-space-size=4000
4962 steps :
5063 - *restore_git_cache
5164 - checkout
52- - *restore_npm_cache
65+ - browser-tools/install-chrome # must be before node/install-packages
66+ - node/install-packages
5367 - run : |
5468 rm -rf node_modules/scratch-vm
5569 npm install
5670 (cd node_modules/scratch-vm && npm install && $(npm bin)/webpack --colors --bail --silent)
71+ - run :
72+ name : Lint
73+ command : npm run test:lint -- --quiet --output-file test-results/eslint-results.xml --format junit
74+ - run :
75+ name : Unit
76+ environment :
77+ JEST_JUNIT_OUTPUT_NAME : unit-results.xml
78+ command : npm run test:unit -- --reporters="default" --reporters="jest-junit" --coverage --coverageReporters=text --coverageReporters=lcov --maxWorkers="2"
79+ - run :
80+ name : Build
81+ environment :
82+ NODE_ENV : production
83+ command : npm run build
84+ - run :
85+ name : Integration
86+ environment :
87+ JEST_JUNIT_OUTPUT_NAME : integration-results.xml
88+ command : |
89+ google-chrome --version
90+ npx --no -- chromedriver --version
91+ npm run test:integration -- --reporters="default" --reporters="jest-junit"
92+ - store_artifacts :
93+ path : coverage
94+ - store_test_results :
95+ path : test-results
96+ setup :
97+ << : *defaults
98+ environment :
99+ DETECT_CHROMEDRIVER_VERSION : " true"
100+ steps :
101+ - *restore_git_cache
102+ - checkout
103+ - browser-tools/install-chrome # must be before node/install-packages
104+ - node/install-packages
57105 - *save_git_cache
58106 - *save_npm_cache
59107 lint :
@@ -120,16 +168,35 @@ jobs:
120168 - checkout
121169 - *restore_npm_cache
122170 - *restore_build_cache
171+ - browser-tools/install-chrome
123172 - run :
124173 name : Integration
125174 environment :
126175 JEST_JUNIT_OUTPUT_DIR : test-results/integration
127176 command : |
177+ google-chrome --version
178+ npx --no -- chromedriver --version
128179 export TESTFILES=$(circleci tests glob "test/integration/*.test.js" | circleci tests split --split-by=timings)
129180 $(npm bin)/jest ${TESTFILES} --reporters="default" --reporters="jest-junit" --runInBand
130181 - store_test_results :
131182 path : test-results
132183
184+ deploy-npm :
185+ << : *defaults
186+ steps :
187+ - *restore_git_cache
188+ - checkout
189+ - *restore_npm_cache
190+ - *restore_dist_cache
191+ - run :
192+ name : adjust config for hotfix if necessary
193+ command : |
194+ # double brackets are important for matching the wildcard
195+ if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then
196+ sed -e "s|hotfix/REPLACE|${CIRCLE_BRANCH}|" --in-place release.config.js
197+ fi
198+ - run : npx semantic-release
199+
133200 deploy-gh-pages :
134201 << : *defaults
135202 steps :
@@ -145,28 +212,95 @@ jobs:
145212
146213workflows :
147214 version : 2
215+ commitlint :
216+ jobs :
217+ - commitlint/lint :
218+ target-branch : develop
219+ push-translations :
220+ triggers :
221+ - schedule :
222+ cron : 0 0 * * * # daily at 12 UTC, 8 ET
223+ filters :
224+ branches :
225+ only :
226+ - develop
227+ jobs :
228+ - setup :
229+ context :
230+ - dockerhub-credentials
231+ - push-translations :
232+ context :
233+ - dockerhub-credentials
234+ requires :
235+ - setup
236+
237+ build-test-no-deploy :
238+ jobs :
239+ - build-test-no-cache :
240+ context :
241+ - dockerhub-credentials
242+ filters :
243+ branches :
244+ ignore :
245+ - master
246+ - develop
247+ - /^hotfix\/.*/
148248 build-test-deploy :
149249 jobs :
150- - setup
250+ - setup :
251+ context :
252+ - dockerhub-credentials
253+ filters :
254+ branches :
255+ only :
256+ - master
257+ - develop
258+ - /^hotfix\/.*/
151259 - lint :
260+ context :
261+ - dockerhub-credentials
152262 requires :
153263 - setup
154264 - unit :
265+ context :
266+ - dockerhub-credentials
155267 requires :
156268 - setup
157269 - build :
270+ context :
271+ - dockerhub-credentials
158272 requires :
159273 - setup
160274 - integration :
275+ context :
276+ - dockerhub-credentials
161277 requires :
162278 - build
163279 - store_build :
280+ context :
281+ - dockerhub-credentials
164282 requires :
165283 - build
284+ filters :
285+ branches :
286+ only :
287+ - master
288+ - develop
289+ - /^hotfix\/.*/
166290 - store_dist :
291+ context :
292+ - dockerhub-credentials
167293 requires :
168294 - build
169- - deploy-gh-pages :
295+ filters :
296+ branches :
297+ only :
298+ - master
299+ - develop
300+ - /^hotfix\/.*/
301+ - deploy-npm :
302+ context :
303+ - dockerhub-credentials
170304 requires :
171305 - lint
172306 - unit
@@ -175,4 +309,20 @@ workflows:
175309 filters :
176310 branches :
177311 only :
312+ - master
178313 - develop
314+ - /^hotfix\/.*/
315+ - deploy-gh-pages :
316+ context :
317+ - dockerhub-credentials
318+ requires :
319+ - lint
320+ - unit
321+ - integration
322+ - build
323+ filters :
324+ branches :
325+ ignore :
326+ - /^dependabot/.*/
327+ - /^renovate/.*/
328+ - /^pull/.*/ # don't deploy to gh pages on PRs.
0 commit comments