2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# ALIASES
|
|
|
|
# -------------------------
|
2017-09-21 20:34:02 +00:00
|
|
|
aliases:
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# ALIASES: Caches
|
|
|
|
# -------------------------
|
2018-05-17 03:12:39 +00:00
|
|
|
- &restore-yarn-cache
|
2017-09-21 20:34:02 +00:00
|
|
|
keys:
|
2019-02-24 01:01:34 +00:00
|
|
|
- v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
|
2018-05-17 03:12:39 +00:00
|
|
|
- v1-yarn-cache-{{ arch }}
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2018-05-17 03:12:39 +00:00
|
|
|
- &save-yarn-cache
|
2017-09-21 20:34:02 +00:00
|
|
|
paths:
|
2018-01-30 21:49:01 +00:00
|
|
|
- ~/.cache/yarn
|
2019-02-24 01:01:34 +00:00
|
|
|
key: v1-yarn-cache-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}
|
2018-05-17 03:12:39 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- &restore-brew-cache
|
2018-05-17 03:12:39 +00:00
|
|
|
keys:
|
2019-02-24 01:01:34 +00:00
|
|
|
- v1-brew
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- &save-brew-cache
|
2017-09-21 20:34:02 +00:00
|
|
|
paths:
|
2019-02-24 01:01:34 +00:00
|
|
|
- /usr/local/Homebrew
|
|
|
|
- ~/Library/Caches/Homebrew
|
|
|
|
key: v1-brew
|
2018-03-27 16:15:54 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# Android
|
|
|
|
- &restore-buck-downloads-cache
|
2017-09-21 20:34:02 +00:00
|
|
|
keys:
|
2019-01-11 23:14:37 +00:00
|
|
|
- v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}}
|
|
|
|
- v3-buck-v2019.01.10.01-
|
2019-02-24 01:01:34 +00:00
|
|
|
- &save-buck-downloads-cache
|
2017-09-21 20:34:02 +00:00
|
|
|
paths:
|
|
|
|
- ~/buck
|
2018-03-28 19:53:08 +00:00
|
|
|
- ~/okbuck
|
2019-01-11 23:14:37 +00:00
|
|
|
key: v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- &restore-gradle-downloads-cache
|
2018-03-27 21:31:42 +00:00
|
|
|
keys:
|
2018-07-23 20:28:17 +00:00
|
|
|
- v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
|
|
|
- v1-gradle-
|
2019-02-24 01:01:34 +00:00
|
|
|
|
|
|
|
- &save-gradle-downloads-cache
|
2018-03-27 21:31:42 +00:00
|
|
|
paths:
|
|
|
|
- ~/.gradle
|
|
|
|
- ReactAndroid/build/downloads
|
|
|
|
- ReactAndroid/build/third-party-ndk
|
2018-07-23 20:28:17 +00:00
|
|
|
key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }}
|
2018-03-27 21:31:42 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# ALIASES: Shared Commands
|
|
|
|
# -------------------------
|
2018-01-30 21:49:01 +00:00
|
|
|
- &yarn
|
2018-06-15 18:34:19 +00:00
|
|
|
name: Run Yarn
|
|
|
|
command: |
|
|
|
|
# Skip yarn install on metro bump commits as the package is not yet
|
|
|
|
# available on npm
|
|
|
|
if [[ $(echo "$GIT_COMMIT_DESC" | grep -c "Bump metro@") -eq 0 ]]; then
|
|
|
|
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
|
|
|
fi
|
2018-01-30 21:49:01 +00:00
|
|
|
|
2018-01-31 22:48:51 +00:00
|
|
|
- &setup-artifacts
|
|
|
|
name: Initial Setup
|
2018-05-07 21:24:32 +00:00
|
|
|
command: |
|
2018-03-28 19:53:08 +00:00
|
|
|
mkdir -p ~/react-native/reports/buck/
|
|
|
|
mkdir -p ~/react-native/reports/build/
|
2018-02-08 22:57:36 +00:00
|
|
|
mkdir -p ~/react-native/reports/junit/
|
2018-03-28 19:53:08 +00:00
|
|
|
mkdir -p ~/react-native/reports/outputs/
|
2018-05-07 21:24:32 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# Android
|
|
|
|
- &download-dependencies-buck
|
|
|
|
name: Download Dependencies Using Buck
|
|
|
|
command: ./scripts/circleci/buck_fetch.sh
|
2018-02-13 16:08:18 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- &download-dependencies-gradle
|
|
|
|
name: Download Dependencies Using Gradle
|
|
|
|
command: ./scripts/circleci/gradle_download_deps.sh
|
2019-02-21 05:47:56 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# JavaScript
|
|
|
|
- &run-js-tests
|
|
|
|
name: JavaScript Test Suite
|
|
|
|
command: yarn test-ci
|
2018-08-23 22:02:56 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# ALIASES: Disabled Tests
|
|
|
|
# -------------------------
|
2018-08-23 22:02:56 +00:00
|
|
|
- &run-podspec-tests
|
2019-02-21 02:39:10 +00:00
|
|
|
name: Test CocoaPods
|
|
|
|
command: ./scripts/process-podspecs.sh
|
2018-06-10 23:53:22 +00:00
|
|
|
- &run-e2e-tests
|
2019-02-21 02:39:10 +00:00
|
|
|
name: End-to-End Test Suite
|
|
|
|
command: ./scripts/run-ci-e2e-tests.js --android --ios --js --retries 3;
|
2018-06-16 22:49:31 +00:00
|
|
|
- &run-android-e2e-tests
|
2019-02-21 02:39:10 +00:00
|
|
|
name: Android End-to-End Test Suite
|
|
|
|
command: node ./scripts/run-ci-e2e-tests.js --android --retries 3;
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
|
|
|
|
# -------------------------
|
|
|
|
# ALIASES: Branch Filters
|
|
|
|
# -------------------------
|
|
|
|
- &filter-only-master
|
|
|
|
branches:
|
|
|
|
only: master
|
|
|
|
|
|
|
|
- &filter-only-master-stable
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /.*-stable/
|
|
|
|
- master
|
|
|
|
|
|
|
|
- &filter-only-stable
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- /.*-stable/
|
|
|
|
|
|
|
|
- &filter-ignore-gh-pages
|
|
|
|
branches:
|
|
|
|
ignore: gh-pages
|
|
|
|
|
|
|
|
- &filter-only-version-tags
|
|
|
|
# Both of the following conditions must be included!
|
|
|
|
# Ignore any commit on any branch by default.
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
# Only act on version tags.
|
|
|
|
tags:
|
|
|
|
only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/
|
|
|
|
|
|
|
|
- &filter-only-forked-pull-requests
|
|
|
|
branches:
|
|
|
|
only: /^pull\/.*$/
|
|
|
|
|
|
|
|
# -------------------------
|
|
|
|
# ALIASES: Workflows
|
|
|
|
# -------------------------
|
|
|
|
- &run-after-checkout
|
|
|
|
filters: *filter-ignore-gh-pages
|
|
|
|
requires:
|
|
|
|
- checkout_code
|
|
|
|
|
|
|
|
# -------------------------
|
|
|
|
# DEFAULTS
|
|
|
|
# -------------------------
|
2017-09-21 20:34:02 +00:00
|
|
|
defaults: &defaults
|
|
|
|
working_directory: ~/react-native
|
2018-06-15 18:34:19 +00:00
|
|
|
environment:
|
|
|
|
- GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# JavaScript
|
2018-02-08 22:57:36 +00:00
|
|
|
js_defaults: &js_defaults
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2019-02-13 14:27:33 +00:00
|
|
|
- image: node:8
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# Android
|
2017-11-27 18:54:22 +00:00
|
|
|
android_defaults: &android_defaults
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2019-05-07 23:58:03 +00:00
|
|
|
- image: reactnativecommunity/react-native-android:2019-5-7
|
2017-11-27 18:54:22 +00:00
|
|
|
resource_class: "large"
|
|
|
|
environment:
|
|
|
|
- TERM: "dumb"
|
|
|
|
- ADB_INSTALL_TIMEOUT: 10
|
|
|
|
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
|
|
|
|
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
|
|
|
|
- BUILD_THREADS: 2
|
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# iOS
|
2018-02-08 22:57:36 +00:00
|
|
|
macos_defaults: &macos_defaults
|
|
|
|
<<: *defaults
|
|
|
|
macos:
|
2019-04-24 16:26:56 +00:00
|
|
|
xcode: "10.2.0"
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# JOBS
|
|
|
|
# -------------------------
|
2017-09-21 20:34:02 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-02-08 22:57:36 +00:00
|
|
|
# Set up a Node environment for downstream jobs
|
|
|
|
checkout_code:
|
|
|
|
<<: *js_defaults
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2018-01-31 22:48:51 +00:00
|
|
|
- run: *setup-artifacts
|
|
|
|
|
2018-05-17 03:12:39 +00:00
|
|
|
- restore-cache: *restore-yarn-cache
|
2018-01-30 21:49:01 +00:00
|
|
|
- run: *yarn
|
2018-05-17 03:12:39 +00:00
|
|
|
- save-cache: *save-yarn-cache
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2018-02-08 22:57:36 +00:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths: .
|
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# JOBS: Analyze PR
|
|
|
|
# -------------------------
|
|
|
|
# Analyze pull request and raise any lint/flow issues.
|
|
|
|
# Issues will be posted to the PR itself via GitHub bots.
|
|
|
|
# This workflow should only fail if the bots fail to run.
|
|
|
|
analyze_pr:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: node:lts
|
|
|
|
# The public github tokens are publicly visible by design
|
|
|
|
environment:
|
|
|
|
- PUBLIC_PULLBOT_GITHUB_TOKEN_A: "a6edf8e8d40ce4e8b11a"
|
|
|
|
- PUBLIC_PULLBOT_GITHUB_TOKEN_B: "150e1341f4dd9c944d2a"
|
|
|
|
- PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A: "78a72af35445ca3f8180"
|
|
|
|
- PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: "b1a98e0bbd56ff1ccba1"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: *setup-artifacts
|
|
|
|
|
|
|
|
- restore-cache: *restore-yarn-cache
|
|
|
|
- run: *yarn
|
|
|
|
- run:
|
2019-05-22 02:35:40 +00:00
|
|
|
name: Install dependencies
|
2019-02-24 01:01:34 +00:00
|
|
|
command: |
|
2019-05-22 02:35:40 +00:00
|
|
|
apt update
|
|
|
|
apt install -y shellcheck jq
|
|
|
|
cd bots
|
|
|
|
yarn install --non-interactive --cache-folder ~/.cache/yarn
|
|
|
|
- save-cache: *save-yarn-cache
|
2019-02-24 01:01:34 +00:00
|
|
|
|
|
|
|
- run:
|
2019-05-22 02:35:40 +00:00
|
|
|
name: Run linters against modified files (analysis-bot)
|
|
|
|
command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" yarn lint-ci
|
2019-02-24 01:01:34 +00:00
|
|
|
when: always
|
|
|
|
|
|
|
|
- run:
|
2019-05-22 02:35:40 +00:00
|
|
|
name: Analyze Pull Request (pull-bot)
|
2019-02-24 01:01:34 +00:00
|
|
|
command: |
|
|
|
|
cd bots
|
2019-05-22 02:35:40 +00:00
|
|
|
DANGER_GITHUB_API_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" yarn danger ci --use-github-checks
|
2019-02-24 01:01:34 +00:00
|
|
|
when: always
|
2019-05-22 02:35:40 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
|
|
|
|
# -------------------------
|
|
|
|
# JOBS: Analyze Code
|
|
|
|
# -------------------------
|
2018-03-01 16:07:40 +00:00
|
|
|
analyze:
|
2018-02-08 22:57:36 +00:00
|
|
|
<<: *js_defaults
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Lint code
|
|
|
|
command: scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/eslint/results.xml
|
2019-04-12 16:50:13 +00:00
|
|
|
when: always
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2019-04-09 23:03:21 +00:00
|
|
|
- run:
|
2019-02-24 01:01:34 +00:00
|
|
|
name: Check for errors in code using Flow (iOS)
|
|
|
|
command: yarn flow-check-ios
|
|
|
|
when: always
|
|
|
|
|
2019-04-09 23:03:21 +00:00
|
|
|
- run:
|
2019-02-24 01:01:34 +00:00
|
|
|
name: Check for errors in code using Flow (Android)
|
|
|
|
command: yarn flow-check-android
|
|
|
|
when: always
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Sanity checks
|
|
|
|
command: |
|
|
|
|
./scripts/circleci/check_license.sh
|
|
|
|
./scripts/circleci/validate_yarn_lockfile.sh
|
|
|
|
when: always
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2019-04-12 16:50:13 +00:00
|
|
|
- run:
|
|
|
|
name: Check formatting
|
|
|
|
command: yarn run format-check
|
|
|
|
when: always
|
|
|
|
|
2018-02-01 01:08:06 +00:00
|
|
|
- store_test_results:
|
2018-02-08 22:57:36 +00:00
|
|
|
path: ~/react-native/reports/junit
|
2018-02-06 20:36:07 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: ~/react-native/yarn.lock
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# JOBS: Test JavaScript
|
|
|
|
# -------------------------
|
2017-12-20 19:29:33 +00:00
|
|
|
# Runs JavaScript tests on Node 8
|
2018-02-08 22:57:36 +00:00
|
|
|
test_javascript:
|
|
|
|
<<: *js_defaults
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2019-04-12 16:50:13 +00:00
|
|
|
- run:
|
|
|
|
name: JavaScript Test Suite
|
|
|
|
command: node ./scripts/run-ci-javascript-tests.js --maxWorkers 2
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2018-01-31 22:48:51 +00:00
|
|
|
- store_test_results:
|
2018-02-08 22:57:36 +00:00
|
|
|
path: ~/react-native/reports/junit
|
2017-09-21 20:34:02 +00:00
|
|
|
|
2019-02-13 13:06:12 +00:00
|
|
|
# Run JavaScript tests on Node LTS
|
|
|
|
test_node_lts:
|
2018-08-21 00:31:59 +00:00
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2019-02-13 13:06:12 +00:00
|
|
|
- image: node:lts
|
2018-08-21 00:31:59 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run: *setup-artifacts
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2018-08-21 00:31:59 +00:00
|
|
|
- run: *yarn
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2019-04-12 16:50:13 +00:00
|
|
|
- run:
|
|
|
|
name: JavaScript Test Suite
|
|
|
|
command: node ./scripts/run-ci-javascript-tests.js --maxWorkers 2
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2018-08-21 00:31:59 +00:00
|
|
|
- store_test_results:
|
|
|
|
path: ~/react-native/reports/junit
|
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# JOBS: Test iOS
|
|
|
|
# -------------------------
|
2018-12-20 23:04:40 +00:00
|
|
|
# Runs unit tests on iOS devices
|
|
|
|
test_ios:
|
2018-02-08 22:57:36 +00:00
|
|
|
<<: *macos_defaults
|
2019-04-24 16:26:56 +00:00
|
|
|
environment:
|
|
|
|
- REPORTS_DIR: "./reports"
|
2017-10-13 23:11:53 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
2019-04-24 16:26:56 +00:00
|
|
|
name: Print Xcode environment
|
|
|
|
command: xcodebuild -version
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: List available devices
|
|
|
|
command: instruments -s devices
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Boot iOS Simulator
|
2019-04-09 23:03:21 +00:00
|
|
|
command: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
|
2018-06-16 22:49:31 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- restore-cache: *restore-brew-cache
|
|
|
|
- run:
|
|
|
|
name: Install Watchman
|
|
|
|
command: |
|
|
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install watchman >/dev/null
|
2019-04-09 23:03:21 +00:00
|
|
|
touch .watchmanconfig
|
2019-02-24 01:01:34 +00:00
|
|
|
- save-cache: *save-brew-cache
|
|
|
|
|
|
|
|
- run:
|
2019-04-24 16:26:56 +00:00
|
|
|
name: Start Metro packager
|
2019-05-03 21:34:57 +00:00
|
|
|
command: yarn start --max-workers=1 || echo "Can't start packager automatically"
|
2019-04-24 16:26:56 +00:00
|
|
|
background: true
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Start WebSocket test server
|
|
|
|
command: open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
|
|
|
|
background: true
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Verify RNTester can be built
|
|
|
|
command: |
|
|
|
|
source ./scripts/.tests.env
|
|
|
|
xcodebuild \
|
|
|
|
-project RNTester/RNTester.xcodeproj \
|
|
|
|
-scheme RNTester \
|
|
|
|
-sdk iphonesimulator \
|
|
|
|
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
|
|
|
|
-UseModernBuildSystem=NO \
|
|
|
|
build | \
|
|
|
|
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_buiild/results.xml" && \
|
|
|
|
exit "${PIPESTATUS[0]}"
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Wait for Metro packager
|
|
|
|
command: |
|
|
|
|
max_attempts=60
|
|
|
|
attempt_num=1
|
|
|
|
until curl -s http://localhost:8081/status | grep "packager-status:running" -q; do
|
|
|
|
if (( attempt_num == max_attempts )); then
|
|
|
|
echo "Packager did not respond in time. No more attempts left."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
(( attempt_num++ ))
|
|
|
|
echo "Packager did not respond. Retrying for attempt number $attempt_num..."
|
|
|
|
sleep 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "Packager is ready!"
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Preload the RNTesterApp bundles
|
|
|
|
command: |
|
|
|
|
curl --silent 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true' --output /dev/null
|
|
|
|
curl --silent 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' --output /dev/null
|
|
|
|
curl --silent 'http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=ios&dev=true' --output /dev/null
|
|
|
|
curl --silent 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' --output /dev/null
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Run RNTester Unit Tests
|
|
|
|
command: |
|
|
|
|
source ./scripts/.tests.env
|
|
|
|
xcodebuild \
|
|
|
|
-project RNTester/RNTester.xcodeproj \
|
|
|
|
-scheme RNTester \
|
|
|
|
-sdk iphonesimulator \
|
|
|
|
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
|
|
|
|
-UseModernBuildSystem=NO \
|
|
|
|
-only-testing:RNTesterUnitTests \
|
|
|
|
build test | \
|
|
|
|
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_unit_tests/results.xml" && \
|
|
|
|
exit "${PIPESTATUS[0]}"
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Run RNTester Integration Tests
|
|
|
|
command: |
|
|
|
|
source ./scripts/.tests.env
|
|
|
|
xcodebuild \
|
|
|
|
-project RNTester/RNTester.xcodeproj \
|
|
|
|
-scheme RNTester \
|
|
|
|
-sdk iphonesimulator \
|
|
|
|
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
|
|
|
|
-UseModernBuildSystem=NO \
|
|
|
|
-only-testing:RNTesterIntegrationTests \
|
|
|
|
build test | \
|
|
|
|
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_integration_tests/results.xml" && \
|
|
|
|
exit "${PIPESTATUS[0]}"
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Stop Metro packager and WebSocket test server
|
|
|
|
command: |
|
|
|
|
# kill whatever is occupying port 8081 (packager)
|
|
|
|
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
|
|
|
|
# kill whatever is occupying port 5555 (web socket server)
|
|
|
|
lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2018-08-06 19:59:41 +00:00
|
|
|
- store_test_results:
|
|
|
|
path: ~/react-native/reports/junit
|
2018-06-10 23:53:22 +00:00
|
|
|
|
2019-05-03 21:34:57 +00:00
|
|
|
# Runs end-to-end tests
|
|
|
|
test_end_to_end:
|
2018-08-06 19:59:41 +00:00
|
|
|
<<: *macos_defaults
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2019-04-09 23:03:21 +00:00
|
|
|
- run:
|
|
|
|
name: Boot iPhone Simulator
|
|
|
|
command: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
|
2019-02-24 01:01:34 +00:00
|
|
|
|
2018-08-22 03:16:41 +00:00
|
|
|
- run:
|
|
|
|
name: Configure Environment Variables
|
|
|
|
command: |
|
|
|
|
echo 'export PATH=/usr/local/opt/node@8/bin:$PATH' >> $BASH_ENV
|
|
|
|
source $BASH_ENV
|
2019-02-24 01:01:34 +00:00
|
|
|
|
|
|
|
# Brew
|
|
|
|
- restore-cache: *restore-brew-cache
|
2018-08-22 03:16:41 +00:00
|
|
|
- run:
|
2019-02-24 01:01:34 +00:00
|
|
|
name: Configure Detox Environment
|
2018-08-22 03:16:41 +00:00
|
|
|
command: |
|
2019-02-24 01:01:34 +00:00
|
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install node@8 >/dev/null
|
|
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew >/dev/null
|
|
|
|
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils >/dev/null
|
|
|
|
touch .watchmanconfig
|
2018-08-22 03:16:41 +00:00
|
|
|
node -v
|
2019-02-24 01:01:34 +00:00
|
|
|
- save-cache: *save-brew-cache
|
|
|
|
|
|
|
|
# Yarn install
|
|
|
|
- restore-cache: *restore-yarn-cache
|
2018-08-22 03:16:41 +00:00
|
|
|
- run: *yarn
|
2019-02-24 01:01:34 +00:00
|
|
|
- save-cache: *save-yarn-cache
|
2018-08-23 22:02:56 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# Xcode build
|
2018-08-22 03:16:41 +00:00
|
|
|
- run:
|
2019-05-03 21:34:57 +00:00
|
|
|
name: Build app for Detox iOS End-to-End Tests
|
2018-08-23 22:02:56 +00:00
|
|
|
command: yarn run build-ios-e2e
|
2019-02-24 01:01:34 +00:00
|
|
|
|
|
|
|
# Test
|
2018-08-22 03:16:41 +00:00
|
|
|
- run:
|
2019-05-03 21:34:57 +00:00
|
|
|
name: Run Detox iOS End-to-End Tests
|
2018-08-28 19:41:46 +00:00
|
|
|
command: yarn run test-ios-e2e
|
2019-05-03 21:34:57 +00:00
|
|
|
when: always
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Run JavaScript End-to-End Tests
|
2019-05-13 14:31:01 +00:00
|
|
|
command: |
|
|
|
|
# free up port 8081 for the packager before running tests
|
|
|
|
set +eo pipefail
|
|
|
|
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
|
|
|
|
set -eo pipefail
|
|
|
|
node ./scripts/run-ci-e2e-tests.js --js --retries 3
|
2019-05-03 21:34:57 +00:00
|
|
|
when: always
|
|
|
|
|
2019-05-21 12:41:23 +00:00
|
|
|
- run:
|
|
|
|
name: Run iOS End-to-End Tests
|
|
|
|
command: |
|
|
|
|
# free up port 8081 for the packager before running tests
|
|
|
|
set +eo pipefail
|
|
|
|
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
|
|
|
|
set -eo pipefail
|
|
|
|
node ./scripts/run-ci-e2e-tests.js --ios --retries 3;
|
|
|
|
when: always
|
2017-10-13 23:11:53 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# JOBS: Test Android
|
|
|
|
# -------------------------
|
|
|
|
# Run Android tests
|
2018-02-08 22:57:36 +00:00
|
|
|
test_android:
|
2017-11-27 18:54:22 +00:00
|
|
|
<<: *android_defaults
|
2017-09-21 20:34:02 +00:00
|
|
|
steps:
|
2018-02-08 22:57:36 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ~/react-native
|
2018-01-31 22:48:51 +00:00
|
|
|
|
2018-07-23 20:28:17 +00:00
|
|
|
# Validate Android SDK installation and packages
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Validate Android SDK Install
|
|
|
|
command: ./scripts/validate-android-sdk.sh
|
2018-03-10 01:06:51 +00:00
|
|
|
|
2018-05-07 21:24:32 +00:00
|
|
|
# Starting emulator in advance as it takes some time to boot.
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Create Android Virtual Device
|
2019-04-09 23:03:21 +00:00
|
|
|
command: source scripts/android-setup.sh && createAVD
|
|
|
|
- run:
|
2019-02-24 01:01:34 +00:00
|
|
|
name: Launch Android Virtual Device in Background
|
|
|
|
command: source scripts/android-setup.sh && launchAVD
|
|
|
|
background: true
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2017-11-27 18:54:22 +00:00
|
|
|
# Keep configuring Android dependencies while AVD boots up
|
2017-12-22 19:07:48 +00:00
|
|
|
|
2018-07-23 20:28:17 +00:00
|
|
|
# Install Buck
|
2019-02-24 01:01:34 +00:00
|
|
|
- restore-cache: *restore-buck-downloads-cache
|
2019-04-09 23:03:21 +00:00
|
|
|
- run:
|
2019-02-24 01:01:34 +00:00
|
|
|
name: Install BUCK
|
|
|
|
command: |
|
|
|
|
buck --version
|
|
|
|
# Install related tooling
|
|
|
|
if [[ ! -e ~/okbuck ]]; then
|
|
|
|
git clone https://github.com/uber/okbuck.git ~/okbuck --depth=1
|
|
|
|
fi
|
|
|
|
mkdir -p ~/react-native/tooling/junit
|
2019-04-09 23:03:21 +00:00
|
|
|
cp -R ~/okbuck/tooling/junit/* ~/react-native/tooling/junit/.
|
2019-02-24 01:01:34 +00:00
|
|
|
- save-cache: *save-buck-downloads-cache
|
2017-12-22 19:07:48 +00:00
|
|
|
|
2018-07-23 20:28:17 +00:00
|
|
|
# Validate Android test environment (including Buck)
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Validate Android Test Environment
|
2019-04-09 23:03:21 +00:00
|
|
|
command: ./scripts/validate-android-test-env.sh
|
2018-03-10 01:06:51 +00:00
|
|
|
|
2018-07-23 20:28:17 +00:00
|
|
|
# Download dependencies using Buck
|
|
|
|
- run: *download-dependencies-buck
|
2018-03-27 16:15:54 +00:00
|
|
|
|
2018-07-23 20:28:17 +00:00
|
|
|
# Download dependencies using Gradle
|
2019-02-24 01:01:34 +00:00
|
|
|
- restore-cache: *restore-gradle-downloads-cache
|
2018-07-23 20:28:17 +00:00
|
|
|
- run: *download-dependencies-gradle
|
2019-02-24 01:01:34 +00:00
|
|
|
- save-cache: *save-gradle-downloads-cache
|
2017-12-22 19:07:48 +00:00
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
# Build and compile
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Build Android App
|
|
|
|
command: |
|
|
|
|
buck build ReactAndroid/src/main/java/com/facebook/react
|
|
|
|
buck build ReactAndroid/src/main/java/com/facebook/react/shell
|
|
|
|
- run:
|
|
|
|
name: Compile Native Libs for Unit and Integration Tests
|
|
|
|
command: ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=$BUILD_THREADS
|
|
|
|
no_output_timeout: 6m
|
2017-12-22 19:07:48 +00:00
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
# Build JavaScript Bundle for instrumentation tests
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Build JavaScript Bundle
|
2019-04-24 11:44:27 +00:00
|
|
|
command: node cli.js bundle --max-workers 2 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
2019-05-03 21:34:57 +00:00
|
|
|
|
2017-12-22 19:07:48 +00:00
|
|
|
# Wait for AVD to finish booting before running tests
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Wait for Android Virtual Device
|
2019-04-09 23:03:21 +00:00
|
|
|
command: source scripts/android-setup.sh && waitForAVD
|
2018-03-10 01:06:51 +00:00
|
|
|
|
2018-02-06 20:36:07 +00:00
|
|
|
# Test Suite
|
2018-09-29 00:00:18 +00:00
|
|
|
- run:
|
2019-02-24 01:01:34 +00:00
|
|
|
name: Run Unit Tests
|
|
|
|
command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS --xml ~/react-native/reports/buck/all-results-raw.xml
|
2018-09-29 00:00:18 +00:00
|
|
|
|
2017-10-16 18:52:48 +00:00
|
|
|
- run:
|
2019-02-24 01:01:34 +00:00
|
|
|
name: Run Instrumentation Tests
|
2017-10-16 18:52:48 +00:00
|
|
|
command: |
|
2019-02-24 01:01:34 +00:00
|
|
|
if [[ ! -e ReactAndroid/src/androidTest/assets/AndroidTestBundle.js ]]; then
|
|
|
|
echo "JavaScript bundle missing, cannot run instrumentation tests. Verify Build JavaScript Bundle step completed successfully."; exit 1;
|
|
|
|
fi
|
|
|
|
source scripts/android-setup.sh && NO_BUCKD=1 retry3 timeout 300 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
|
2019-04-09 23:03:21 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Build Android RNTester App
|
|
|
|
command: ./gradlew RNTester:android:app:assembleRelease
|
2018-02-08 22:57:36 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# Collect Results
|
2017-10-16 18:52:48 +00:00
|
|
|
- run:
|
2019-02-24 01:01:34 +00:00
|
|
|
name: Collect Test Results
|
2017-10-16 18:52:48 +00:00
|
|
|
command: |
|
2019-02-24 01:01:34 +00:00
|
|
|
find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} ~/react-native/reports/build/ \;
|
|
|
|
find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} ~/react-native/reports/outputs/ \;
|
|
|
|
find . -type f -regex ".*/buck-out/gen/ReactAndroid/src/test/.*/.*xml" -exec cp {} ~/react-native/reports/buck/ \;
|
|
|
|
./tooling/junit/buck_to_junit.sh ~/react-native/reports/buck/all-results-raw.xml ~/react-native/reports/junit/all-results-junit.xml
|
2017-10-16 18:52:48 +00:00
|
|
|
when: always
|
2019-04-09 23:03:21 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- store_test_results:
|
|
|
|
path: ~/react-native/reports/junit
|
2019-04-09 23:03:21 +00:00
|
|
|
|
2019-04-10 01:15:31 +00:00
|
|
|
# -------------------------
|
|
|
|
# JOBS: Test Docker Build
|
|
|
|
# -------------------------
|
|
|
|
test_docker_build:
|
|
|
|
machine: true
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Build Docker container for Android RNTester App
|
|
|
|
command: |
|
|
|
|
source ~/.bashrc
|
|
|
|
nvm i node
|
|
|
|
npm i -g yarn
|
|
|
|
npx envinfo@latest
|
|
|
|
yarn run docker-setup-android
|
|
|
|
yarn run docker-build-android
|
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# JOBS: Coverage
|
|
|
|
# -------------------------
|
|
|
|
# Collect JavaScript test coverage
|
2018-12-01 03:45:56 +00:00
|
|
|
js_coverage:
|
|
|
|
<<: *js_defaults
|
2018-12-03 19:44:07 +00:00
|
|
|
environment:
|
|
|
|
- CI_BRANCH: $CIRCLE_BRANCH
|
|
|
|
- CI_PULL_REQUEST: $CIRCLE_PULL_REQUEST
|
|
|
|
- CI_BUILD_NUMBER: $CIRCLE_BUILD_NUM
|
|
|
|
- CI_BUILD_URL: $CIRCLE_BUILD_URL
|
2018-12-01 03:45:56 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore-cache: *restore-yarn-cache
|
|
|
|
- run: *yarn
|
2019-02-24 01:01:34 +00:00
|
|
|
- run:
|
|
|
|
name: Test coverage
|
|
|
|
command: |
|
|
|
|
yarn test --coverage --maxWorkers=2
|
|
|
|
cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
|
2019-04-09 23:03:21 +00:00
|
|
|
when: always
|
2018-12-01 03:45:56 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: ~/react-native/coverage/
|
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# JOBS: Releases
|
|
|
|
# -------------------------
|
2018-07-23 20:28:17 +00:00
|
|
|
# Publishes new version onto npm
|
|
|
|
# Only works on stable branches when a properly tagged commit is pushed
|
|
|
|
publish_npm_package:
|
|
|
|
<<: *android_defaults
|
|
|
|
steps:
|
Use one time password when publishing to npm (#20701)
Summary:
This pull request addresses the failing publish-npm.js script from earlier this week. For background, last month we reset all npm access tokens for any package related to Facebook, and we now require all accounts with publish permissions to have two factor enabled.
The publish-npm.js script relied on one such token that is configured in Circle CI as a envvar. The token has been updated in Circle CI, but we now need a way of passing the one time password to npm.
With this PR, we can now grab the otp from Circle CI's envvars. Considering otps are ephemeral, this requires the NPM_CONFIG_OTP envvar to be set by someone with publishing permissions anytime a new release will be pushed to npm. The token is short lived, but it would still be good to clear the envvar after the package is published. Circle CI envvars are not passed on to PR/forked builds.
This PR is effectively a breaking change for the release process, as the publish step will not succeed if the OTP is not valid.
OTPs are short-lived, and the publish_npm_package job will definitely outlive the token. Unfortunately this will require some timing to get right, but the alternative is to ssh into the Circle CI machine and re-run the `npm publish --otp` command, which again would still require someone with publish access to provide the otp.
Pull Request resolved: https://github.com/facebook/react-native/pull/20701
Differential Revision: D9478488
Pulled By: hramos
fbshipit-source-id: 6af631a9cb425271b98c03d158aec390ebc95304
2018-08-23 06:20:05 +00:00
|
|
|
- checkout
|
|
|
|
|
|
|
|
- restore-cache: *restore-yarn-cache
|
|
|
|
- run: *yarn
|
2018-07-23 20:28:17 +00:00
|
|
|
|
|
|
|
# Fetch dependencies using Buck
|
2019-02-24 01:01:34 +00:00
|
|
|
- restore-cache: *restore-buck-downloads-cache
|
2018-07-23 20:28:17 +00:00
|
|
|
- run: *download-dependencies-buck
|
|
|
|
|
|
|
|
# Fetch dependencies using Gradle
|
2019-02-24 01:01:34 +00:00
|
|
|
- restore-cache: *restore-gradle-downloads-cache
|
2018-07-23 20:28:17 +00:00
|
|
|
- run: *download-dependencies-gradle
|
|
|
|
|
|
|
|
- restore-cache: *restore-yarn-cache
|
|
|
|
- run: *yarn
|
|
|
|
|
|
|
|
- run:
|
Use one time password when publishing to npm (#20701)
Summary:
This pull request addresses the failing publish-npm.js script from earlier this week. For background, last month we reset all npm access tokens for any package related to Facebook, and we now require all accounts with publish permissions to have two factor enabled.
The publish-npm.js script relied on one such token that is configured in Circle CI as a envvar. The token has been updated in Circle CI, but we now need a way of passing the one time password to npm.
With this PR, we can now grab the otp from Circle CI's envvars. Considering otps are ephemeral, this requires the NPM_CONFIG_OTP envvar to be set by someone with publishing permissions anytime a new release will be pushed to npm. The token is short lived, but it would still be good to clear the envvar after the package is published. Circle CI envvars are not passed on to PR/forked builds.
This PR is effectively a breaking change for the release process, as the publish step will not succeed if the OTP is not valid.
OTPs are short-lived, and the publish_npm_package job will definitely outlive the token. Unfortunately this will require some timing to get right, but the alternative is to ssh into the Circle CI machine and re-run the `npm publish --otp` command, which again would still require someone with publish access to provide the otp.
Pull Request resolved: https://github.com/facebook/react-native/pull/20701
Differential Revision: D9478488
Pulled By: hramos
fbshipit-source-id: 6af631a9cb425271b98c03d158aec390ebc95304
2018-08-23 06:20:05 +00:00
|
|
|
name: Authenticate with npm
|
|
|
|
command: echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Authenticate git user
|
2018-07-23 20:28:17 +00:00
|
|
|
command: |
|
Use one time password when publishing to npm (#20701)
Summary:
This pull request addresses the failing publish-npm.js script from earlier this week. For background, last month we reset all npm access tokens for any package related to Facebook, and we now require all accounts with publish permissions to have two factor enabled.
The publish-npm.js script relied on one such token that is configured in Circle CI as a envvar. The token has been updated in Circle CI, but we now need a way of passing the one time password to npm.
With this PR, we can now grab the otp from Circle CI's envvars. Considering otps are ephemeral, this requires the NPM_CONFIG_OTP envvar to be set by someone with publishing permissions anytime a new release will be pushed to npm. The token is short lived, but it would still be good to clear the envvar after the package is published. Circle CI envvars are not passed on to PR/forked builds.
This PR is effectively a breaking change for the release process, as the publish step will not succeed if the OTP is not valid.
OTPs are short-lived, and the publish_npm_package job will definitely outlive the token. Unfortunately this will require some timing to get right, but the alternative is to ssh into the Circle CI machine and re-run the `npm publish --otp` command, which again would still require someone with publish access to provide the otp.
Pull Request resolved: https://github.com/facebook/react-native/pull/20701
Differential Revision: D9478488
Pulled By: hramos
fbshipit-source-id: 6af631a9cb425271b98c03d158aec390ebc95304
2018-08-23 06:20:05 +00:00
|
|
|
git config --global user.email "react-native-bot@users.noreply.github.com"
|
2018-07-23 20:28:17 +00:00
|
|
|
git config --global user.name "npm Deployment Script"
|
Use one time password when publishing to npm (#20701)
Summary:
This pull request addresses the failing publish-npm.js script from earlier this week. For background, last month we reset all npm access tokens for any package related to Facebook, and we now require all accounts with publish permissions to have two factor enabled.
The publish-npm.js script relied on one such token that is configured in Circle CI as a envvar. The token has been updated in Circle CI, but we now need a way of passing the one time password to npm.
With this PR, we can now grab the otp from Circle CI's envvars. Considering otps are ephemeral, this requires the NPM_CONFIG_OTP envvar to be set by someone with publishing permissions anytime a new release will be pushed to npm. The token is short lived, but it would still be good to clear the envvar after the package is published. Circle CI envvars are not passed on to PR/forked builds.
This PR is effectively a breaking change for the release process, as the publish step will not succeed if the OTP is not valid.
OTPs are short-lived, and the publish_npm_package job will definitely outlive the token. Unfortunately this will require some timing to get right, but the alternative is to ssh into the Circle CI machine and re-run the `npm publish --otp` command, which again would still require someone with publish access to provide the otp.
Pull Request resolved: https://github.com/facebook/react-native/pull/20701
Differential Revision: D9478488
Pulled By: hramos
fbshipit-source-id: 6af631a9cb425271b98c03d158aec390ebc95304
2018-08-23 06:20:05 +00:00
|
|
|
echo "machine github.com login react-native-bot password $GITHUB_TOKEN" > ~/.netrc
|
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# Build and publish release. Requires an Android environment.
|
Use one time password when publishing to npm (#20701)
Summary:
This pull request addresses the failing publish-npm.js script from earlier this week. For background, last month we reset all npm access tokens for any package related to Facebook, and we now require all accounts with publish permissions to have two factor enabled.
The publish-npm.js script relied on one such token that is configured in Circle CI as a envvar. The token has been updated in Circle CI, but we now need a way of passing the one time password to npm.
With this PR, we can now grab the otp from Circle CI's envvars. Considering otps are ephemeral, this requires the NPM_CONFIG_OTP envvar to be set by someone with publishing permissions anytime a new release will be pushed to npm. The token is short lived, but it would still be good to clear the envvar after the package is published. Circle CI envvars are not passed on to PR/forked builds.
This PR is effectively a breaking change for the release process, as the publish step will not succeed if the OTP is not valid.
OTPs are short-lived, and the publish_npm_package job will definitely outlive the token. Unfortunately this will require some timing to get right, but the alternative is to ssh into the Circle CI machine and re-run the `npm publish --otp` command, which again would still require someone with publish access to provide the otp.
Pull Request resolved: https://github.com/facebook/react-native/pull/20701
Differential Revision: D9478488
Pulled By: hramos
fbshipit-source-id: 6af631a9cb425271b98c03d158aec390ebc95304
2018-08-23 06:20:05 +00:00
|
|
|
- run:
|
|
|
|
name: Publish React Native Package
|
|
|
|
command: node ./scripts/publish-npm.js
|
2018-07-23 20:28:17 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
# -------------------------
|
|
|
|
# WORK FLOWS
|
|
|
|
# -------------------------
|
2017-09-21 20:34:02 +00:00
|
|
|
workflows:
|
|
|
|
version: 2
|
2017-11-27 18:54:22 +00:00
|
|
|
|
2018-02-13 16:08:18 +00:00
|
|
|
tests:
|
2017-09-21 20:34:02 +00:00
|
|
|
jobs:
|
2019-02-24 01:01:34 +00:00
|
|
|
- test_node_lts:
|
2017-10-16 18:52:48 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2018-02-01 01:08:06 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- checkout_code:
|
2018-08-22 03:16:41 +00:00
|
|
|
filters: *filter-ignore-gh-pages
|
2018-08-06 19:59:41 +00:00
|
|
|
|
2019-02-24 01:01:34 +00:00
|
|
|
- analyze: *run-after-checkout
|
|
|
|
- test_javascript: *run-after-checkout
|
|
|
|
- test_android: *run-after-checkout
|
|
|
|
- test_ios: *run-after-checkout
|
2019-05-03 21:34:57 +00:00
|
|
|
- test_end_to_end: *run-after-checkout
|
2019-04-12 16:50:13 +00:00
|
|
|
- test_docker_build:
|
|
|
|
filters: *filter-ignore-gh-pages
|
2018-09-26 03:32:52 +00:00
|
|
|
|
2018-12-01 03:45:56 +00:00
|
|
|
releases:
|
|
|
|
jobs:
|
2018-06-14 20:48:15 +00:00
|
|
|
- publish_npm_package:
|
2019-02-24 01:01:34 +00:00
|
|
|
filters: *filter-only-version-tags
|
2018-06-14 20:48:15 +00:00
|
|
|
|
2018-12-01 03:45:56 +00:00
|
|
|
analysis:
|
|
|
|
jobs:
|
2018-10-05 18:26:14 +00:00
|
|
|
# Run code checks on PRs from forks
|
2018-05-07 21:24:32 +00:00
|
|
|
- analyze_pr:
|
2019-02-24 01:01:34 +00:00
|
|
|
filters: *filter-only-forked-pull-requests
|
2018-12-01 03:45:56 +00:00
|
|
|
|
|
|
|
# Gather coverage on master
|
|
|
|
- js_coverage:
|
2019-02-24 01:01:34 +00:00
|
|
|
filters: *filter-only-master
|