Migrate to Circle 2.0
Summary: Following the migration guide. Let's see what happens here. Closes https://github.com/facebook/react-native/pull/14955 Differential Revision: D5877682 Pulled By: hramos fbshipit-source-id: 2a40560120b5d8d28bc6c52cc5e5916fd1bba336
This commit is contained in:
parent
f01c73d84f
commit
8fa9984b11
|
@ -0,0 +1,373 @@
|
|||
aliases:
|
||||
- &restore-cache
|
||||
keys:
|
||||
- v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}
|
||||
# Fallback in case checksum fails
|
||||
- v1-dependencies-{{ .Branch }}-
|
||||
- &save-cache
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-dependencies-{{ .Branch }}-{{ checksum "package.json" }}
|
||||
|
||||
- &restore-cache-website
|
||||
keys:
|
||||
- v1-website-dependencies-{{ .Branch }}-{{ checksum "website/package.json" }}
|
||||
# Fallback in case checksum fails
|
||||
- v1-website-dependencies-{{ .Branch }}-
|
||||
- &save-cache-website
|
||||
paths:
|
||||
- website/node_modules
|
||||
key: v1-website-dependencies-{{ .Branch }}-{{ checksum "website/package.json" }}
|
||||
|
||||
- &restore-cache-danger
|
||||
keys:
|
||||
- v1-danger-dependencies-{{ .Branch }}-{{ checksum "danger/package.json" }}
|
||||
# Fallback in case checksum fails
|
||||
- v1-danger-dependencies-{{ .Branch }}-
|
||||
- &save-cache-danger
|
||||
paths:
|
||||
- danger/node_modules
|
||||
key: v1-danger-dependencies-{{ .Branch }}-{{ checksum "danger/package.json" }}
|
||||
|
||||
- &restore-cache-android-packages
|
||||
keys:
|
||||
- v1-android-sdkmanager-packages-{{ checksum "scripts/circle-ci-android-setup.sh" }}
|
||||
# Fallback in case checksum fails
|
||||
- v1-android-sdkmanager-packages-
|
||||
- &save-cache-android-packages
|
||||
paths:
|
||||
- /opt/android/sdk/system-images/android-23
|
||||
- /opt/android/sdk/system-images/android-19
|
||||
- /opt/android/sdk/platforms/android-26
|
||||
- /opt/android/sdk/platforms/android-23
|
||||
- /opt/android/sdk/platforms/android-19
|
||||
- /opt/android/sdk/build-tools/23.0.1
|
||||
- /opt/android/sdk/add-ons/addon-google_apis-google-23
|
||||
key: v1-android-sdkmanager-packages-{{ checksum "scripts/circle-ci-android-setup.sh" }}
|
||||
|
||||
- &restore-cache-ndk
|
||||
keys:
|
||||
- v1-android-ndk-r10e-32-64
|
||||
- &save-cache-ndk
|
||||
paths:
|
||||
- /opt/ndk
|
||||
key: v1-android-ndk-r10e-32-64
|
||||
|
||||
- &restore-cache-buck-downloads
|
||||
keys:
|
||||
- v1-buck-downloads-{{ .Branch }}-{{ checksum "ReactAndroid/build.gradle" }}
|
||||
# Fallback in case checksum fails
|
||||
- v1-buck-downloads-{{ .Branch }}-
|
||||
- &save-cache-buck-downloads
|
||||
paths:
|
||||
- "ReactAndroid/build/downloads"
|
||||
key: v1-buck-downloads-{{ .Branch }}-{{ checksum "ReactAndroid/build.gradle" }}
|
||||
|
||||
- &restore-cache-buck
|
||||
keys:
|
||||
- v1-buck-v2017.09.04.02
|
||||
- &save-cache-buck
|
||||
paths:
|
||||
- ~/buck
|
||||
key: v1-buck-v2017.09.04.02
|
||||
|
||||
- &restore-cache-watchman
|
||||
keys:
|
||||
- v1-watchman-v4.9.0
|
||||
- &save-cache-watchman
|
||||
paths:
|
||||
- ~/watchman
|
||||
key: v1-watchman-v4.9.0
|
||||
|
||||
defaults: &defaults
|
||||
working_directory: ~/react-native
|
||||
|
||||
version: 2
|
||||
jobs:
|
||||
test-node-8:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
steps:
|
||||
- checkout
|
||||
- run: npm install --no-package-lock
|
||||
- run: |
|
||||
npm run lint
|
||||
npm run flow -- check
|
||||
npm test -- --maxWorkers=2
|
||||
# eslint
|
||||
- run:
|
||||
name: Analyze Code
|
||||
command: |
|
||||
npm install github@0.2.4
|
||||
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
|
||||
|
||||
test-node-6:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/node:6.11.0
|
||||
steps:
|
||||
- checkout
|
||||
- run: npm install
|
||||
- run: |
|
||||
npm run lint
|
||||
npm run flow -- check
|
||||
npm test -- --maxWorkers=2
|
||||
|
||||
test-node-4:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/node:4.8.4
|
||||
steps:
|
||||
- checkout
|
||||
- run: npm install
|
||||
- run: |
|
||||
npm run lint
|
||||
npm run flow -- check
|
||||
npm test -- --maxWorkers=2
|
||||
|
||||
test-website:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install Dependencies
|
||||
command: |
|
||||
cd website
|
||||
npm install --no-package-lock
|
||||
- run:
|
||||
name: Test Website
|
||||
command: |
|
||||
cd website
|
||||
npm test
|
||||
- run:
|
||||
name: Test Build Static Website
|
||||
command: cd website && node ./server/generate.js
|
||||
|
||||
deploy-website:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install Dependencies
|
||||
command: |
|
||||
cd website
|
||||
npm install --no-package-lock
|
||||
- run:
|
||||
name: Build and Deploy Static Website
|
||||
command: |
|
||||
if [[ $CIRCLE_PROJECT_USERNAME == "facebook" && -z $CI_PULL_REQUEST && -z $CIRCLE_PR_USERNAME ]]; then
|
||||
git config --global user.email "reactjs-bot@users.noreply.github.com"
|
||||
git config --global user.name "Website Deployment Script"
|
||||
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||
|
||||
echo "Deploying website..."
|
||||
cd website && GIT_USER=reactjs-bot npm run gh-pages
|
||||
else
|
||||
echo "Skipping deploy."
|
||||
fi
|
||||
|
||||
build-js-bundle:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
steps:
|
||||
- checkout
|
||||
- run: npm install --no-package-lock
|
||||
- run:
|
||||
name: Build JavaScript Bundle
|
||||
command: node local-cli/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
|
||||
- persist_to_workspace:
|
||||
root: ReactAndroid/src/androidTest/assets/
|
||||
paths:
|
||||
- AndroidTestBundle.js
|
||||
- store_artifacts:
|
||||
path: ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||
|
||||
test-android:
|
||||
<<: *defaults
|
||||
docker:
|
||||
- image: circleci/android:api-26-alpha
|
||||
environment:
|
||||
- TERM: "dumb"
|
||||
- ADB_INSTALL_TIMEOUT: 10
|
||||
- GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx512m -XX:+HeapDumpOnOutOfMemoryError"'
|
||||
- ANDROID_NDK: '/opt/ndk/android-ndk-r10e'
|
||||
- BUILD_THREADS: 2
|
||||
steps:
|
||||
- checkout
|
||||
# CircleCI does not support interpolating env variables in the environment: step above.
|
||||
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
|
||||
- run:
|
||||
name: Configure PATH
|
||||
command: |
|
||||
echo 'export PATH=${ANDROID_NDK}:~/react-native/gradle-2.9/bin:~/buck/bin:$PATH' >> $BASH_ENV
|
||||
source $BASH_ENV
|
||||
# Configure dependencies
|
||||
- run:
|
||||
name: Install Build Dependencies
|
||||
command: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install ant autoconf automake g++ gcc libqt5widgets5 lib32z1 lib32stdc++6 make maven python-dev python3-dev qml-module-qtquick-controls qtdeclarative5-dev -y
|
||||
- restore-cache: *restore-cache-android-packages
|
||||
- run:
|
||||
name: Install Android Packages
|
||||
command: source scripts/circle-ci-android-setup.sh && getAndroidSDK
|
||||
- save-cache: *save-cache-android-packages
|
||||
- run:
|
||||
name: Create Android Virtual Device
|
||||
command: source scripts/circle-ci-android-setup.sh && createAVD
|
||||
# Starting emulator in advance as it takes some time to boot.
|
||||
- run:
|
||||
name: Launch Android Virtual Device in Background
|
||||
command: source scripts/circle-ci-android-setup.sh && launchAVD
|
||||
background: true
|
||||
# Continue configuring dependencies while AVD boots.
|
||||
- run:
|
||||
name: Create Android NDK Directory
|
||||
command: |
|
||||
if [[ ! -e /opt/ndk ]]; then
|
||||
sudo mkdir /opt/ndk
|
||||
fi
|
||||
sudo chown ${USER:=$(/usr/bin/id -run)}:$USER /opt/ndk
|
||||
- restore-cache: *restore-cache-ndk
|
||||
- run:
|
||||
name: Install Android NDK
|
||||
command: source scripts/circle-ci-android-setup.sh && getAndroidNDK
|
||||
- save-cache: *save-cache-ndk
|
||||
- restore-cache: *restore-cache-buck
|
||||
- run:
|
||||
name: Install Buck
|
||||
command: |
|
||||
if [[ ! -e ~/buck ]]; then
|
||||
git clone https://github.com/facebook/buck.git ~/buck --branch v2017.09.04.02 --depth=1
|
||||
fi
|
||||
cd ~/buck && ant
|
||||
buck --version
|
||||
- save-cache: *save-cache-buck
|
||||
- run:
|
||||
name: Install Node
|
||||
command: |
|
||||
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
- run: npm install
|
||||
# - restore-cache: *restore-cache-watchman
|
||||
# - run:
|
||||
# name: Install Watchman Dependencies
|
||||
# command: |
|
||||
# sudo apt-get update -y
|
||||
# sudo apt-get install libtool pkg-config -y
|
||||
# - run:
|
||||
# name: Install Watchman
|
||||
# command: |
|
||||
# if [[ ! -e ~/watchman ]]; then
|
||||
# mkdir ~/watchman
|
||||
# git clone https://github.com/facebook/watchman.git ~/watchman --branch v4.9.0 --depth=1
|
||||
# cd ~/watchman
|
||||
# ./autogen.sh
|
||||
# ./configure
|
||||
# make
|
||||
# fi
|
||||
# cd ~/watchman
|
||||
# sudo make install
|
||||
# - save-cache: *save-cache-watchman
|
||||
- restore-cache: *restore-cache-buck-downloads
|
||||
- run:
|
||||
name: Download Android App Dependencies
|
||||
command: |
|
||||
buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
||||
buck fetch ReactAndroid/src/main/java/com/facebook/react
|
||||
buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
||||
buck fetch ReactAndroid/src/test/...
|
||||
buck fetch ReactAndroid/src/androidTest/...
|
||||
./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders
|
||||
- save-cache: *save-cache-buck-downloads
|
||||
- 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
|
||||
# Wait for AVD to finish booting before running tests
|
||||
- run:
|
||||
name: Wait for Android Virtual Device
|
||||
command: source scripts/circle-ci-android-setup.sh && waitForAVD
|
||||
# The JavaScript Bundle is built as part of the build-js-bundle workflow, and is required for instrumentation tests.
|
||||
- attach_workspace:
|
||||
at: ReactAndroid/src/androidTest/assets/
|
||||
- run:
|
||||
name: Check for JavaScript Bundle
|
||||
command: |
|
||||
if [[ ! -e ReactAndroid/src/androidTest/assets/AndroidTestBundle.js ]]; then
|
||||
echo "JavaScript bundle missing, verify build-js-bundle step"; exit 1;
|
||||
else
|
||||
echo "JavaScript bundle found.";
|
||||
fi
|
||||
# Tests
|
||||
- run:
|
||||
name: Compile Native Libs for Unit and Integration Tests
|
||||
command: ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=$BUILD_THREADS -Pcom.android.build.threadPoolSize=1
|
||||
no_output_timeout: 6m
|
||||
- run:
|
||||
name: Unit Tests
|
||||
command: buck test ReactAndroid/src/test/... --config build.threads=$BUILD_THREADS
|
||||
# Integration Tests
|
||||
- run:
|
||||
name: Build and Install Test APK
|
||||
command: source scripts/circle-ci-android-setup.sh && NO_BUCKD=1 retry3 buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=$BUILD_THREADS
|
||||
# Failing test is expected
|
||||
# - run:
|
||||
# name: Run Installed APK with Tests
|
||||
# command: node ./scripts/run-android-ci-instrumentation-tests.js --retries 3 --path ./ReactAndroid/src/androidTest/java/com/facebook/react/tests --package com.facebook.react.tests
|
||||
# Should be disabled pending on https://our.intern.facebook.com/intern/tasks?t=16912142
|
||||
# - run:
|
||||
# name: Run Android End to End Tests
|
||||
# command: source scripts/circle-ci-android-setup.sh && retry3 node ./scripts/run-ci-e2e-tests.js --android --js --retries 2
|
||||
|
||||
# post (always runs)
|
||||
- run:
|
||||
name: Collect Test Results
|
||||
command: |
|
||||
mkdir -p ~/junit/
|
||||
find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} ~/junit/ \;
|
||||
find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} ~/junit/ \;
|
||||
# TODO circle does not understand Buck's report, maybe need to transform xml slightly
|
||||
# find . -type f -regex ".*/buck-out/gen/ReactAndroid/src/test/.*/.*xml" -exec cp {} ~/junit/ \;
|
||||
when: always
|
||||
- store_test_results:
|
||||
path: ~/junit
|
||||
- store_artifacts:
|
||||
path: ~/junit
|
||||
|
||||
# Workflows enables us to run multiple jobs in parallel
|
||||
workflows:
|
||||
version: 2
|
||||
test_node:
|
||||
jobs:
|
||||
- test-node-8
|
||||
- test-node-6
|
||||
# Node 4 tests are already failing on Circle 1.0
|
||||
# - test-node-4
|
||||
website:
|
||||
jobs:
|
||||
- test-website
|
||||
- deploy-website:
|
||||
requires:
|
||||
- test-website
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- /.*-stable/
|
||||
- master
|
||||
test_android:
|
||||
jobs:
|
||||
- build-js-bundle:
|
||||
filters:
|
||||
branches:
|
||||
ignore: gh-pages
|
||||
- test-android:
|
||||
requires:
|
||||
- build-js-bundle
|
|
@ -86,7 +86,7 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs):
|
|||
'-XX:MaxPermSize=620m',
|
||||
'-Drobolectric.offline=true',
|
||||
]
|
||||
if os.path.isdir("/dev/shm"):
|
||||
if os.path.isdir("/dev/shm") and not os.environ['CIRCLECI']:
|
||||
extra_vm_args.append('-Djava.io.tmpdir=/dev/shm')
|
||||
else:
|
||||
extra_vm_args.append(
|
||||
|
@ -110,4 +110,4 @@ def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs):
|
|||
|
||||
original_cxx_library = cxx_library
|
||||
def cxx_library(allow_jni_merging=None, **kwargs):
|
||||
original_cxx_library(**kwargs)
|
||||
original_cxx_library(**kwargs)
|
||||
|
|
122
circle.yml
122
circle.yml
|
@ -1,122 +0,0 @@
|
|||
general:
|
||||
branches:
|
||||
ignore:
|
||||
- gh-pages # list of branches to ignore
|
||||
machine:
|
||||
node:
|
||||
version: 6.2.0
|
||||
environment:
|
||||
PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-2.9/bin:/home/ubuntu/buck/bin:$PATH"
|
||||
TERM: "dumb"
|
||||
ADB_INSTALL_TIMEOUT: 10
|
||||
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx512m -XX:+HeapDumpOnOutOfMemoryError"'
|
||||
java:
|
||||
version: 'oraclejdk8'
|
||||
|
||||
dependencies:
|
||||
override:
|
||||
# BUCK and android
|
||||
- if [[ ! -e /home/ubuntu/buck ]]; then git clone https://github.com/facebook/buck.git /home/ubuntu/buck; fi
|
||||
- cd /home/ubuntu/buck && ant
|
||||
- buck --version
|
||||
- source scripts/circle-ci-android-setup.sh && getAndroidSDK
|
||||
- buck fetch ReactAndroid/src/test/java/com/facebook/react/modules
|
||||
- buck fetch ReactAndroid/src/main/java/com/facebook/react
|
||||
- buck fetch ReactAndroid/src/main/java/com/facebook/react/shell
|
||||
- buck fetch ReactAndroid/src/test/...
|
||||
- buck fetch ReactAndroid/src/androidTest/...
|
||||
- ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog :ReactAndroid:downloadJSCHeaders
|
||||
# CIRCLE_NPM_TOKEN is in React Native project settings in Circle CI.
|
||||
# It was generated for bestander user, easy to replace with anyone's else
|
||||
- echo "//registry.npmjs.org/:_authToken=${CIRCLE_NPM_TOKEN}" > ~/.npmrc
|
||||
- npm config set spin=false
|
||||
- npm config set progress=false
|
||||
- npm install
|
||||
# for eslint bot
|
||||
- npm install github@0.2.4
|
||||
# for website, danger
|
||||
- cd website && npm install
|
||||
- cd danger && npm install
|
||||
cache_directories:
|
||||
- "ReactAndroid/build/downloads"
|
||||
- "/home/ubuntu/buck"
|
||||
- "website/node_modules"
|
||||
- "node_modules"
|
||||
- "danger/node_modules"
|
||||
|
||||
test:
|
||||
pre:
|
||||
# starting emulator in advance because it takes very long to boot
|
||||
- $ANDROID_HOME/tools/emulator -avd testAVD -no-skin -no-audio -no-window:
|
||||
background: true
|
||||
- source scripts/circle-ci-android-setup.sh && waitForAVD
|
||||
|
||||
override:
|
||||
# Run Danger against PRs. This GitHub token grants public_repo access scope. The associated account has no privileged access to the React Native repo. The token must be split in this manner to avoid revocation by GitHub.
|
||||
- cd danger && DANGER_GITHUB_API_TOKEN="e622517d9f1136ea8900""07c6373666312cdfaa69" npm run danger
|
||||
# eslint bot. This GitHub token grants public_repo access scope. The token must be split in this manner to avoid revocation by GitHub.
|
||||
- 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
|
||||
- npm run lint
|
||||
# JS tests for dependencies installed with npm3
|
||||
# Commenting out Flow tests
|
||||
# - npm run flow -- check
|
||||
- npm test -- --maxWorkers=1
|
||||
|
||||
# build app
|
||||
- buck build ReactAndroid/src/main/java/com/facebook/react
|
||||
- buck build ReactAndroid/src/main/java/com/facebook/react/shell
|
||||
|
||||
# compile native libs with Gradle script, we need bridge for unit and
|
||||
# integration tests
|
||||
- ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1 -Pcom.android.build.threadPoolSize=1:
|
||||
timeout: 360
|
||||
|
||||
# unit tests
|
||||
- buck test ReactAndroid/src/test/... --config build.threads=1
|
||||
|
||||
# integration tests
|
||||
# build JS bundle for instrumentation tests
|
||||
- node local-cli/cli.js bundle --max-workers 1 --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||
|
||||
# build test APK
|
||||
# Commented out due to test failures. Please uncomment the next line once these have been fixed. See Issue #15726.
|
||||
# - buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests --config build.threads=1
|
||||
|
||||
# run installed apk with tests
|
||||
# - node ./scripts/run-android-ci-instrumentation-tests.js --retries 3 --path ./ReactAndroid/src/androidTest/java/com/facebook/react/tests --package com.facebook.react.tests
|
||||
|
||||
# Android e2e test
|
||||
# disabled pending on https://our.intern.facebook.com/intern/tasks?t=16912142
|
||||
# - source scripts/circle-ci-android-setup.sh && retry3 node ./scripts/run-ci-e2e-tests.js --android --js --retries 2
|
||||
|
||||
# testing docs generation
|
||||
- cd website && npm test
|
||||
- cd website && node ./server/generate.js
|
||||
# if website can be built, deploy regardless of test failures
|
||||
- if [[ ($CIRCLE_BRANCH =~ .*-stable || $CIRCLE_BRANCH == "master") && $CIRCLE_PROJECT_USERNAME == "facebook" && -z $CI_PULL_REQUEST && -z $CIRCLE_PR_USERNAME ]]; then git config --global user.email "reactjs-bot@users.noreply.github.com" && git config --global user.name "Website Deployment Script" && echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc && cd website && GIT_USER=reactjs-bot npm run gh-pages; fi
|
||||
|
||||
post:
|
||||
# copy test report for Circle CI to display
|
||||
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
|
||||
- find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
|
||||
- find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
|
||||
# TODO circle does not understand Buck's report, maybe need to transform xml slightly
|
||||
#- find . -type f -regex ".*/buck-out/gen/ReactAndroid/src/test/.*/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
|
||||
|
||||
deployment:
|
||||
stable:
|
||||
branch: [/.*-stable/, /master/]
|
||||
owner: facebook
|
||||
commands:
|
||||
- git config --global user.email "reactjs-bot@users.noreply.github.com"
|
||||
- git config --global user.name "Website Deployment Script"
|
||||
- echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||
# publish to npm
|
||||
- node ./scripts/publish-npm.js
|
||||
|
||||
experimental:
|
||||
notify:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /.*-stable/
|
|
@ -1,25 +1,77 @@
|
|||
# inspired by https://github.com/Originate/guide/blob/master/android/guide/Continuous%20Integration.md
|
||||
|
||||
# SDK Built Tools revision, per http://facebook.github.io/react-native/docs/getting-started.html
|
||||
ANDROID_SDK_BUILD_TOOLS_REVISION=23.0.1
|
||||
# API Level we build with
|
||||
ANDROID_SDK_BUILD_API_LEVEL="23"
|
||||
# Minimum API Level we target, used for emulator image
|
||||
ANDROID_SDK_TARGET_API_LEVEL="19"
|
||||
# Emulator name
|
||||
AVD_NAME="testAVD"
|
||||
|
||||
function getAndroidSDK {
|
||||
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$PATH"
|
||||
|
||||
DEPS="$ANDROID_HOME/installed-dependencies"
|
||||
|
||||
if [ ! -e $DEPS ]; then
|
||||
echo y | android update sdk --no-ui --all --filter extra-android-m2repository
|
||||
echo no | android create avd -n testAVD -f -t android-19 --abi default/armeabi-v7a &&
|
||||
echo "Installing Android API level $ANDROID_SDK_TARGET_API_LEVEL, Google APIs, ARM EABI v7a system image..."
|
||||
sdkmanager "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;armeabi-v7a"
|
||||
# x86 image requires hardware acceleration, which is not supported when running within the CircleCI Docker image
|
||||
# echo "Installing Android API level $ANDROID_SDK_TARGET_API_LEVEL, Google APIs, Intel x86 Atom system image..."
|
||||
# sdkmanager "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;x86"
|
||||
echo "Installing build SDK for Android API level $ANDROID_SDK_BUILD_API_LEVEL..."
|
||||
sdkmanager "platforms;android-$ANDROID_SDK_BUILD_API_LEVEL"
|
||||
echo "Installing target SDK for Android API level $ANDROID_SDK_TARGET_API_LEVEL..."
|
||||
sdkmanager "platforms;android-$ANDROID_SDK_TARGET_API_LEVEL"
|
||||
echo "Installing SDK build tools, revision $ANDROID_SDK_BUILD_TOOLS_REVISION..."
|
||||
sdkmanager "build-tools;$ANDROID_SDK_BUILD_TOOLS_REVISION"
|
||||
echo "Installing Google APIs for Android API level $ANDROID_SDK_BUILD_API_LEVEL..."
|
||||
sdkmanager "add-ons;addon-google_apis-google-$ANDROID_SDK_BUILD_API_LEVEL"
|
||||
echo "Installing Android Support Repository"
|
||||
sdkmanager "extras;android;m2repository"
|
||||
touch $DEPS
|
||||
fi
|
||||
}
|
||||
|
||||
function getAndroidNDK {
|
||||
NDK_HOME="/opt/ndk"
|
||||
DEPS="$NDK_HOME/installed-dependencies"
|
||||
|
||||
if [ ! -e $DEPS ]; then
|
||||
cd $NDK_HOME
|
||||
echo "Downloading NDK..."
|
||||
curl -o ndk.zip https://dl.google.com/android/repository/android-ndk-r10e-linux-x86.zip
|
||||
curl -o ndk_64.zip https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
|
||||
unzip -o -q ndk.zip
|
||||
unzip -o -q ndk_64.zip
|
||||
echo "Installed Android NDK at $NDK_HOME"
|
||||
touch $DEPS
|
||||
rm ndk.zip
|
||||
rm ndk_64.zip
|
||||
fi
|
||||
}
|
||||
|
||||
function createAVD {
|
||||
echo no | avdmanager create avd --name $AVD_NAME --force --package "system-images;android-$ANDROID_SDK_TARGET_API_LEVEL;google_apis;armeabi-v7a" --tag google_apis --abi armeabi-v7a
|
||||
}
|
||||
|
||||
function launchAVD {
|
||||
# The AVD name here should match the one created in createAVD
|
||||
# emulator64-arm -avd $AVD_NAME -no-audio -no-window -no-boot-anim -gpu off
|
||||
emulator -avd $AVD_NAME -no-audio -no-window
|
||||
}
|
||||
|
||||
function waitForAVD {
|
||||
echo "Waiting for Android Virtual Device to finish booting..."
|
||||
local bootanim=""
|
||||
export PATH=$(dirname $(dirname $(which android)))/platform-tools:$PATH
|
||||
until [[ "$bootanim" =~ "stopped" ]]; do
|
||||
sleep 5
|
||||
bootanim=$(adb -e shell getprop init.svc.bootanim 2>&1)
|
||||
echo "emulator status=$bootanim"
|
||||
echo "boot animation status=$bootanim"
|
||||
done
|
||||
echo "Android Virtual Device is ready."
|
||||
}
|
||||
|
||||
function retry3 {
|
||||
|
|
|
@ -48,11 +48,10 @@ try {
|
|||
const CLI_PACKAGE = path.join(ROOT, 'react-native-cli', 'react-native-cli-*.tgz');
|
||||
cd('..');
|
||||
|
||||
// can skip cli install for non sudo mode
|
||||
if (!argv['skip-cli-install']) {
|
||||
if (exec(`npm install -g ${CLI_PACKAGE}`).code) {
|
||||
echo('Could not install react-native-cli globally, please run in su mode');
|
||||
echo('Or with --skip-cli-install to skip this step');
|
||||
if (exec(`sudo npm install -g ${CLI_PACKAGE}`).code) {
|
||||
echo('Could not install react-native-cli globally.');
|
||||
echo('Run with --skip-cli-install to skip this step');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue