Commit 8e467bee authored by Natalie Marleny's avatar Natalie Marleny Committed by Tim Neutkens

[Enhancement]: Refactor circleCI config (#7963)

* Refactor bash commands in circleCI config

- Split into multiple lines for easier readability

* De-duplicate circleCI commands using parameter

- Reference: https://circleci.com/docs/2.0/configuration-reference/
parent 4adef73a
...@@ -45,50 +45,69 @@ commands: ...@@ -45,50 +45,69 @@ commands:
steps: steps:
- run: - run:
name: Run All Tests name: Run All Tests
command: > command: |
yarn testall $(circleci tests glob "test/**/*.test.*" | circleci tests split --split-by=timings --timings-type=classname) || (yarn git-clean; yarn git-reset; yarn testall $(circleci tests glob "test/**/*.test.*" | circleci tests split --split-by=timings --timings-type=classname)) yarn testall $(
circleci tests glob "test/**/*.test.*" | \
circleci tests split --split-by=timings --timings-type=classname
) || (
yarn git-clean
yarn git-reset
yarn testall $(
circleci tests glob "test/**/*.test.*" | \
circleci tests split --split-by=timings --timings-type=classname
)
)
environment: environment:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml' JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'
JEST_JUNIT_CLASSNAME: '{filepath}' JEST_JUNIT_CLASSNAME: '{filepath}'
test_ie11: test_browser:
parameters:
browser:
type: string
steps: steps:
- run: - run:
name: Test in ie11 name: Test in a browser
command: 'if [[ ! -z $BROWSERSTACK_USERNAME ]]; then yarn testall test/integration/production/; else echo "Not running for PR"; fi' command: |
if [[ ! -z $BROWSERSTACK_USERNAME ]]; then
yarn testall test/integration/production/
else
echo "Not running for PR"
fi
environment: environment:
BROWSERSTACK: 'true' BROWSERSTACK: 'true'
BROWSER_NAME: 'ie' BROWSER_NAME: << parameters.browser >>
test_safari:
steps:
- run:
name: Test in Safari
command: 'if [[ ! -z $BROWSERSTACK_USERNAME ]]; then yarn testall test/integration/production/; else echo "Not running for PR"; fi'
environment:
BROWSERSTACK: 'true'
BROWSER_NAME: 'safari'
test_firefox:
steps:
- run:
name: Test in Firefox
command: 'if [[ ! -z $BROWSERSTACK_USERNAME ]]; then yarn testall test/integration/production/; else echo "Not running for PR"; fi'
environment:
BROWSERSTACK: 'true'
BROWSER_NAME: 'firefox'
save_npm_token: save_npm_token:
steps: steps:
- run: - run:
name: Potentially save npm token 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"
publish_canary: publish_canary:
steps: steps:
- run: - run:
name: Potentially publish canary release 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
publish_stable: publish_stable:
steps: steps:
- run: - run:
name: Potentially publish stable release 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
######################### #########################
# Jobs # Jobs
...@@ -113,17 +132,20 @@ jobs: ...@@ -113,17 +132,20 @@ jobs:
executor: node executor: node
steps: steps:
- *attach_workspace - *attach_workspace
- test_ie11 - test_browser:
browser: 'ie'
test-safari: test-safari:
executor: node executor: node
steps: steps:
- *attach_workspace - *attach_workspace
- test_safari - test_browser:
browser: 'safari'
test-firefox: test-firefox:
executor: node executor: node
steps: steps:
- *attach_workspace - *attach_workspace
- test_firefox - test_browser:
browser: 'firefox'
deploy: deploy:
executor: node executor: node
steps: steps:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment