未验证 提交 e906e4bd 编写于 作者: J Joe Haddad 提交者: GitHub

Adjust CircleCI flow (#6728)

* Format circleci config

* Tweak configuration into multiple steps

* Persist whole repo to workspace

* Attach workspace for tests

* Run tests in parallelism x4

* Test circleci parallelism

* parallel x6 times

* Save test timing

* Use env var instead

* run in ci mode

* test speed
上级 78bcfa07
......@@ -12,20 +12,48 @@ jobs:
- run:
name: Linting
command: yarn lint
- persist_to_workspace:
root: ~/repo
paths: ['.']
test:
parallelism: 6
docker:
- image: circleci/node:8-browsers
working_directory: ~/repo
steps:
- attach_workspace:
at: .
- run:
name: Tests
command: yarn test
command: yarn testall $(circleci tests glob "test/**/*.test.*" | circleci tests split --split-by=timings)
environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
- store_test_results:
path: ~/repo/reports
deploy:
docker:
- image: circleci/node:8-browsers
working_directory: ~/repo
steps:
- attach_workspace:
at: .
- run:
name: Potentially save npm token
command: "([[ ! -z $NPM_TOKEN ]] && echo \"//registry.npmjs.org/:_authToken=$NPM_TOKEN\" >> ~/.npmrc) || echo \"Did not write npm token\""
command: '([[ ! -z $NPM_TOKEN ]] && echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc) || echo "Did not write npm token"'
- run:
name: Potentially publish canary release
command: "if ls ~/.npmrc >/dev/null 2>&1 && [[ $(git describe --exact-match 2> /dev/null || :) =~ -canary ]]; then yarn run lerna publish from-git --npm-tag canary --yes; else echo \"Did not publish\"; fi"
command: 'if ls ~/.npmrc >/dev/null 2>&1 && [[ $(git describe --exact-match 2> /dev/null || :) =~ -canary ]]; then yarn run lerna publish from-git --npm-tag canary --yes; else echo "Did not publish"; fi'
- run:
name: Potentially publish stable release
command: "if ls ~/.npmrc >/dev/null 2>&1 && [[ ! $(git describe --exact-match 2> /dev/null || :) =~ -canary ]]; then yarn run lerna publish from-git --yes; else echo \"Did not publish\"; fi"
command: 'if ls ~/.npmrc >/dev/null 2>&1 && [[ ! $(git describe --exact-match 2> /dev/null || :) =~ -canary ]]; then yarn run lerna publish from-git --yes; else echo "Did not publish"; fi'
workflows:
version: 2
build-and-deploy:
build-test-and-deploy:
jobs:
- build
- test:
requires:
- build
- deploy:
requires:
- test
......@@ -8,7 +8,7 @@
"lerna": "lerna",
"dev": "lerna run build --stream --parallel",
"testonly": "jest",
"testall": "yarn check && yarn run testonly -- --coverage --forceExit --runInBand --reporters=default --reporters=jest-junit",
"testall": "yarn check && yarn run testonly -- --ci --coverage --reporters=default --reporters=jest-junit --forceExit --runInBand",
"pretest": "yarn run lint",
"git-reset": "git reset --hard HEAD",
"git-clean": "git clean -d -x -e node_modules -e packages -f",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册