Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Circle] Switch to yarn #17193

Closed
wants to merge 12 commits into from
114 changes: 63 additions & 51 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
aliases:
- &restore-node-cache
- &restore-yarn-cache
keys:
- v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
- v1-yarn-{{ arch }}-{{ checksum "package.json" }}
# Fallback in case checksum fails
- v2-dependencies-{{ arch }}-

- &save-node-cache
- v1-yarn-{{ arch }}-
- &save-yarn-cache
paths:
- node_modules
key: v2-dependencies-{{ arch }}-{{ checksum "package.json" }}
- ~/.cache/yarn
key: v1-yarn-{{ arch }}-{{ checksum "package.json" }}

- &restore-cache-analysis
keys:
Expand Down Expand Up @@ -60,6 +60,16 @@ aliases:
- ~/watchman
key: v1-watchman-{{ arch }}-v4.9.0

- &yarn
|
yarn install --non-interactive --cache-folder ~/.cache/yarn

- &install-yarn
|
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

- &install-node-dependencies
|
npm install --no-package-lock --no-spin --no-progress
Expand All @@ -77,18 +87,18 @@ aliases:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

- &run-node-tests
|
npm test -- --maxWorkers=2

- &run-js-tests
|
yarn test --maxWorkers=2
- &run-lint-checks
|
npm run lint
|
yarn lint

- &run-flow-checks
|
npm run flow -- check
|
yarn flow check

- &filter-only-master-stable
branches:
only:
Expand Down Expand Up @@ -203,9 +213,9 @@ jobs:
- image: circleci/node:8
steps:
- checkout
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: *run-lint-checks
- run: *run-flow-checks

Expand All @@ -216,10 +226,10 @@ jobs:
- image: circleci/node:8
steps:
- checkout
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- run: *run-node-tests
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: *run-js-tests

# Runs JavaScript tests on Node 6
test-js-node-6:
Expand All @@ -228,10 +238,10 @@ jobs:
- image: circleci/node:6
steps:
- checkout
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- run: *run-node-tests
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: *run-js-tests

# Runs unit tests on iOS devices
test-objc-ios:
Expand All @@ -243,9 +253,9 @@ jobs:
- xcrun instruments -w "iPhone 5s (10.3.1)" || true
steps:
- checkout
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: ./scripts/objc-test-ios.sh

# Runs unit tests on tvOS devices
Expand All @@ -258,9 +268,9 @@ jobs:
- xcrun instruments -w "Apple TV 1080p (10.0)" || true
steps:
- checkout
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: ./scripts/objc-test-tvos.sh

# Runs end to end tests
Expand All @@ -273,9 +283,9 @@ jobs:
- xcrun instruments -w "iPhone 5s (10.3.1)" || true
steps:
- checkout
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3;

# Checks podspec
Expand All @@ -285,9 +295,9 @@ jobs:
xcode: "9.0"
steps:
- checkout
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: ./scripts/process-podspecs.sh

# Publishes new version onto npm
Expand All @@ -310,9 +320,10 @@ jobs:
- run: *install-buck
- save-cache: *save-cache-buck
- run: *install-node
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- run: *install-yarn
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react
- run: buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
Expand Down Expand Up @@ -372,9 +383,10 @@ jobs:

# The JavaScript Bundle is required for instrumentation tests.
- run: *install-node
- restore-cache: *restore-node-cache
- run: *install-node-dependencies
- save-cache: *save-node-cache
- run: *install-yarn
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- run: *build-js-bundle

# Wait for AVD to finish booting before running tests
Expand All @@ -398,14 +410,14 @@ jobs:
steps:
- checkout
- restore-cache: *restore-cache-analysis
- run: *install-node-dependencies
- run: *yarn
- run:
name: Install Dependencies
name: Install Additional Dependencies
command: |
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
npm install [email protected]
yarn add [email protected]
cd danger
npm install --no-package-lock --no-spin --no-progress
yarn install --non-interactive --cache-folder ~/.cache/yarn
else
echo "Skipping dependency installation."
fi
Expand All @@ -414,16 +426,16 @@ jobs:
name: Analyze Pull Request
command: |
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
cd danger && DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger
cd danger && DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" yarn danger
else
echo "Skipping pull request analysis."
fi
when: always
- run:
name: Analyze Code
command: |
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow --silent -- check --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER node bots/code-analysis-bot.js
if [ -n "$CIRCLE_PR_NUMBER" ]; then
cat <(echo eslint; yarn --silent lint --format=json; echo flow; yarn --silent flow check --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER node bots/code-analysis-bot.js
else
echo "Skipping code analysis."
fi
Expand Down