-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Switch to Yarn in order to more closely match internal Facebook environment. Closes #17193 Differential Revision: D6572337 Pulled By: hramos fbshipit-source-id: 331b1f331937e8ce3b787d48561e2e655d4a1cc9
- Loading branch information
1 parent
a9c684a
commit da8bec9
Showing
1 changed file
with
63 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
@@ -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 | ||
|
@@ -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: | ||
|
@@ -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 | ||
|
||
|
@@ -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: | ||
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
da8bec9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hramos Would it be possible to commit the yarn.lock file with the current infra?
da8bec9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid not, as it would conflict with our internal lockfile and offline mirror.
Nothing that cannot be worked around, perhaps we could have an internal .github.yarn.lock => yarn.lock mapping like we do with .github.flowconfig => .flowconfig.