rsnext/.circleci/config.yml

248 lines
5.7 KiB
YAML
Raw Normal View History

version: 2.1
#########################
# Aliases
#########################
aliases:
- &store_test_results
store_test_results:
path: ~/repo/test
- &persist_to_workspace
persist_to_workspace:
root: ~/repo
paths: ['.']
- &attach_workspace
attach_workspace:
at: .
#########################
# Executors
#########################
executors:
node:
2018-09-02 15:14:29 +02:00
docker:
- image: circleci/node@sha256:8631b3dc0f49fc179940bbd4254ced0c41b99d02bfdbf1d8bdd4d0b135e3ee5f
2018-09-02 15:14:29 +02:00
working_directory: ~/repo
#########################
# Commands
#########################
commands:
yarn_install:
2018-09-02 15:14:29 +02:00
steps:
2018-10-02 14:49:39 +02:00
- run:
name: Installing Dependencies
2019-10-23 20:14:32 +02:00
command: yarn install --frozen-lockfile --check-files
- run:
name: Install correct Chrome Driver version
command: node node_modules/chromedriver/install.js
environment:
CHROMEDRIVER_VERSION: '76.0.3809.68'
- run: google-chrome --version
- run: yarn chromedriver --version
yarn_lint:
steps:
2019-02-11 08:15:23 +01:00
- run:
name: Linting
command: yarn lint
yarn_react_integration:
steps:
- run:
name: Upgrade to most recent release in React's Next channel
command: yarn upgrade react@next react-dom@next -W --dev # upgrade (vs add) will skip re-building Next.js, which doesn't bundle React internals (so this is OK!)
environment:
CHROMEDRIVER_VERSION: '76.0.3809.68'
yarn_info:
steps:
- run:
name: React Versions
command: yarn why react && yarn why react-dom
test_all:
steps:
2019-02-11 08:15:23 +01:00
- run:
name: Run All Tests
command: |
2019-11-27 20:49:17 +01:00
node run-tests.js --timings -c 3 $(
circleci tests glob "test/**/*.test.*" | \
circleci tests split --split-by=timings
)
2019-09-13 04:51:56 +02:00
environment:
NEXT_TELEMETRY_DISABLED: '1'
test_browser:
parameters:
browser:
type: string
steps:
- run:
name: Test in a browser
command: |
if [[ ! -z $BROWSERSTACK_USERNAME ]]; then
yarn testall test/integration/production/
else
echo "Not running for PR"
fi
environment:
BROWSERSTACK: 'true'
BROWSER_NAME: << parameters.browser >>
2019-09-13 04:51:56 +02:00
NEXT_TELEMETRY_DISABLED: '1'
save_npm_token:
steps:
2019-02-11 08:15:23 +01:00
- run:
name: Potentially save npm token
command: |
([[ ! -z $NPM_TOKEN ]] && echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc) || echo "Did not write npm token"
publish_canary:
steps:
2018-10-02 14:49:39 +02:00
- run:
2019-02-11 08:15:23 +01:00
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
publish_stable:
steps:
2018-10-02 14:49:39 +02:00
- run:
2019-02-11 08:15:23 +01:00
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
#########################
# Jobs
#########################
jobs:
build:
executor: node
steps:
- checkout
- yarn_install
- *persist_to_workspace
build-react-canary:
executor: node
steps:
- *attach_workspace
- yarn_react_integration
- *persist_to_workspace
2019-11-27 20:57:18 +01:00
lint:
executor: node
steps:
- *attach_workspace
- yarn_lint
test:
2019-11-27 20:49:17 +01:00
parallelism: 6
executor: node
steps:
- *attach_workspace
- yarn_info
- test_all
- *store_test_results
test-ie11:
executor: node
steps:
- *attach_workspace
- test_browser:
browser: 'ie'
test-safari:
executor: node
steps:
- *attach_workspace
- test_browser:
browser: 'safari'
test-firefox:
executor: node
steps:
- *attach_workspace
- test_browser:
browser: 'firefox'
deploy:
executor: node
steps:
- *attach_workspace
- save_npm_token
- publish_canary
- publish_stable
#########################
# Workflows
#########################
2018-10-02 14:49:39 +02:00
workflows:
version: 2
build-test-and-deploy:
2018-10-02 14:49:39 +02:00
jobs:
2019-02-14 14:33:00 +01:00
- build
- test:
requires:
- build
2019-11-27 20:57:18 +01:00
- lint:
requires:
- build
- test-ie11:
requires:
- build
filters:
branches:
only:
- master
- canary
- test-safari:
requires:
- build
- test
- test-ie11
filters:
branches:
only:
- master
- canary
- test-firefox:
requires:
- build
- test
- test-ie11
- test-safari
filters:
branches:
only:
- master
- canary
- deploy:
requires:
- test
filters:
branches:
only:
- master
- canary
q12h-react-canary:
triggers:
- schedule:
cron: '0 0,12 * * *'
filters:
branches:
only:
- canary
jobs:
- build
- build-react-canary:
requires:
- build
- test:
requires:
- build-react-canary