rsnext/.circleci/config.yml
JJ Kasper f89d55f10d Add selenium-webdriver and testing cross-browser in PRs (#9821)
* Migrate from wd to selenium-webdriver

* Add chaining for next-webdriver

* Re-add browserStackLocal global for teardown

* Add additional element methods

* Use freshWindow helper for chrome

* Add selenium-server

* Add cross-env for windows compat

* Fix single quote windows

* Update production preload tests

* Update preload tests count

* Update CircleCi for testing other browsers

* Update CI configs

* Update config

* Add browser.url command

* Add more methods

* Update xcode version

* Make sure to add chromedriver to path

* Add forceExit flag

* Update config

* Update config

* Disable safari

* Fix bug in test

* Add teardown logging

* Update jest teardown

* Move testing ie11 to Azure

* Update job names

* Remove force exiting on long teardown

* Update Azure config

* Re-add safari testing with BrowserStack

* Update config

* Update prefetch tests for ie11

* Update prefetch for safari and ids for ie11 testing

* trigger prefetching manually in ie
2019-12-26 15:01:22 -05:00

217 lines
4.9 KiB
YAML

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
#########################
orbs:
win: circleci/windows@2.2.0
executors:
node:
docker:
- image: circleci/node:10-browsers
working_directory: ~/repo
#########################
# Commands
#########################
commands:
yarn_install:
steps:
- run:
name: Installing Dependencies
command: yarn install --frozen-lockfile --check-files
yarn_lint:
steps:
- 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!)
yarn_info:
steps:
- run:
name: React Versions
command: yarn why react && yarn why react-dom
test_all:
steps:
- run: google-chrome --version
- run: chromedriver --version
- run:
name: Run All Tests
command: |
node run-tests.js --timings -c 3 $(
circleci tests glob "test/**/*.test.*" | \
circleci tests split --split-by=timings
)
environment:
NEXT_TELEMETRY_DISABLED: '1'
test_safari:
steps:
- run:
name: Test Safari
command: |
yarn testsafari --forceExit test/integration/production/
environment:
NEXT_TELEMETRY_DISABLED: '1'
BROWSERSTACK: 'true'
test_firefox:
steps:
- run:
name: Test Firefox
command: |
yarn testfirefox --forceExit test/integration/production/
environment:
NEXT_TELEMETRY_DISABLED: '1'
save_npm_token:
steps:
- 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:
- 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
publish_stable:
steps:
- 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
#########################
# 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
lint:
executor: node
steps:
- *attach_workspace
- yarn_lint
test:
parallelism: 6
executor: node
steps:
- *attach_workspace
- yarn_info
- test_all
- *store_test_results
test-safari:
executor: node
steps:
- *attach_workspace
- test_safari
test-firefox:
executor: node
steps:
- *attach_workspace
- test_firefox
deploy:
executor: node
steps:
- *attach_workspace
- save_npm_token
- publish_canary
- publish_stable
#########################
# Workflows
#########################
workflows:
version: 2
build-test-and-deploy:
jobs:
- build
- test-firefox:
requires:
- build
- test:
requires:
- build
- test-safari:
requires:
- build
filters:
branches:
only:
- master
- canary
- lint:
requires:
- build
- 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