mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
[0.50.0-rc.0] Bump version numbers
Fix eslint Fix flow Revert "Improve Flow Types" This reverts commitbee33a4400. [0.50.0-rc.1] Bump version numbers Fix Analyze step Remove mockFs dependency and unblock tests Revert "[0.50.0-rc.1] Bump version numbers" This reverts commit 5d0bc1d29bfdce40bbcc403190b06324557e5a58. Revert "Migrate to Circle 2.0" This reverts commit8fa9984b11. Remove old circle Comment out danger for now
This commit is contained in:
@@ -1,373 +0,0 @@
|
||||
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
|
||||
+2
-2
@@ -46,8 +46,8 @@ suppress_type=$FlowFixMeProps
|
||||
suppress_type=$FlowFixMeState
|
||||
suppress_type=$FixMe
|
||||
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*[react_native_oss|react_native_fb][a-z,_]*\\)?)\\)
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*[react_native_oss|react_native_fb][a-z,_]*\\)?)\\)?:? #[0-9]+
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
|
||||
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
exports.version = {
|
||||
major: 0,
|
||||
minor: 0,
|
||||
minor: 50,
|
||||
patch: 0,
|
||||
prerelease: null,
|
||||
prerelease: 'rc.0',
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ import type {Props as VirtualizedSectionListProps} from 'VirtualizedSectionList'
|
||||
|
||||
type Item = any;
|
||||
|
||||
export type SectionBase<SectionItemT> = {
|
||||
type SectionBase<SectionItemT> = {
|
||||
/**
|
||||
* The data for rendering items in this section.
|
||||
*/
|
||||
@@ -187,11 +187,10 @@ type OptionalProps<SectionT: SectionBase<any>> = {
|
||||
legacyImplementation?: ?boolean,
|
||||
};
|
||||
|
||||
export type Props<SectionT> = {
|
||||
...$Exact<RequiredProps<SectionT>>,
|
||||
...$Exact<OptionalProps<SectionT>>,
|
||||
...$Exact<VirtualizedSectionListProps<SectionT>>,
|
||||
};
|
||||
export type Props<SectionT> = RequiredProps<SectionT> &
|
||||
OptionalProps<SectionT> &
|
||||
VirtualizedSectionListProps<SectionT>;
|
||||
|
||||
const defaultProps = {
|
||||
...VirtualizedSectionList.defaultProps,
|
||||
stickySectionHeadersEnabled: Platform.OS === 'ios',
|
||||
|
||||
@@ -74,9 +74,7 @@ const SwipeableFlatListExample = createReactClass({
|
||||
<View style={styles.row}>
|
||||
<Image style={styles.rowIcon} source={item.icon} />
|
||||
<View style={styles.rowData}>
|
||||
<Text style={styles.rowDataText}>
|
||||
{item.data}
|
||||
</Text>
|
||||
<Text style={styles.rowDataText}>{item.data}</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#define REACT_NATIVE_VERSION @{ \
|
||||
@"major": @(0), \
|
||||
@"minor": @(0), \
|
||||
@"minor": @(50), \
|
||||
@"patch": @(0), \
|
||||
@"prerelease": [NSNull null], \
|
||||
@"prerelease": @"rc.0", \
|
||||
}
|
||||
|
||||
+2
-2
@@ -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") and not os.environ['CIRCLECI']:
|
||||
if os.path.isdir("/dev/shm"):
|
||||
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)
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=1000.0.0-master
|
||||
VERSION_NAME=0.50.0-rc.0
|
||||
GROUP=com.facebook.react
|
||||
|
||||
POM_NAME=ReactNative
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import java.util.Map;
|
||||
public class ReactNativeVersion {
|
||||
public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
|
||||
"major", 0,
|
||||
"minor", 0,
|
||||
"minor", 50,
|
||||
"patch", 0,
|
||||
"prerelease", null);
|
||||
"prerelease", "rc.0");
|
||||
}
|
||||
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
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/
|
||||
@@ -94,6 +94,9 @@ fs.readFileSync.mockImplementation(function(filepath, encoding) {
|
||||
if (isDirNode(node)) {
|
||||
throw new Error('Error readFileSync a dir: ' + filepath);
|
||||
}
|
||||
if (Buffer.isBuffer(node) && typeof encoding !== 'undefined') {
|
||||
return node.toString();
|
||||
}
|
||||
return node;
|
||||
});
|
||||
|
||||
@@ -133,7 +136,12 @@ function fsError(code, message) {
|
||||
}
|
||||
|
||||
function isDirNode(node) {
|
||||
return node && typeof node === 'object' && node.SYMLINK == null;
|
||||
return (
|
||||
node &&
|
||||
typeof node === 'object' &&
|
||||
node.SYMLINK == null &&
|
||||
Buffer.isBuffer(node) === false
|
||||
);
|
||||
}
|
||||
|
||||
function readlinkSync(filepath) {
|
||||
@@ -1,4 +1,4 @@
|
||||
const fs = require('fs');
|
||||
const fs = require.requireActual('fs');
|
||||
const path = require('path');
|
||||
|
||||
const manifest = fs.readFileSync(path.join(__dirname, './files/AndroidManifest.xml'));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const fs = require('fs');
|
||||
const fs = require.requireActual('fs');
|
||||
const path = require('path');
|
||||
const android = require('./android');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const fs = require('fs');
|
||||
const fs = require.requireActual('fs');
|
||||
const path = require('path');
|
||||
|
||||
exports.valid = {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const android = require('./android');
|
||||
const ios = require('./ios');
|
||||
|
||||
|
||||
@@ -11,13 +11,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const fs = require('fs');
|
||||
const findAndroidAppFolder = require('../../android/findAndroidAppFolder');
|
||||
const mockFS = require('mock-fs');
|
||||
const mocks = require('../../__fixtures__/android');
|
||||
|
||||
describe('android::findAndroidAppFolder', () => {
|
||||
beforeAll(() => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
empty: {},
|
||||
nested: {
|
||||
android: {
|
||||
@@ -31,15 +33,11 @@ describe('android::findAndroidAppFolder', () => {
|
||||
});
|
||||
|
||||
it('returns an android app folder if it exists in the given folder', () => {
|
||||
expect(findAndroidAppFolder('flat')).toBe('android');
|
||||
expect(findAndroidAppFolder('nested')).toBe('android/app');
|
||||
expect(findAndroidAppFolder('/flat')).toBe('android');
|
||||
expect(findAndroidAppFolder('/nested')).toBe('android/app');
|
||||
});
|
||||
|
||||
it('returns `null` if there is no android app folder', () => {
|
||||
expect(findAndroidAppFolder('empty')).toBeNull();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
mockFS.restore();
|
||||
expect(findAndroidAppFolder('/empty')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,13 +11,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const findManifest = require('../../android/findManifest');
|
||||
const mockFS = require('mock-fs');
|
||||
const fs = require('fs');
|
||||
const mocks = require('../../__fixtures__/android');
|
||||
|
||||
describe('android::findManifest', () => {
|
||||
beforeAll(() => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
empty: {},
|
||||
flat: {
|
||||
android: mocks.valid,
|
||||
@@ -26,14 +28,10 @@ describe('android::findManifest', () => {
|
||||
});
|
||||
|
||||
it('returns a manifest path if file exists in the folder', () => {
|
||||
expect(typeof findManifest('flat')).toBe('string');
|
||||
expect(typeof findManifest('/flat')).toBe('string');
|
||||
});
|
||||
|
||||
it('returns `null` if there is no manifest in the folder', () => {
|
||||
expect(findManifest('empty')).toBeNull();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
mockFS.restore();
|
||||
expect(findManifest('/empty')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,13 +11,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const findPackageClassName = require('../../android/findPackageClassName');
|
||||
const mockFS = require('mock-fs');
|
||||
const fs = require('fs');
|
||||
const mocks = require('../../__fixtures__/android');
|
||||
|
||||
describe('android::findPackageClassName', () => {
|
||||
beforeAll(() => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
empty: {},
|
||||
flatJava: {
|
||||
android: mocks.valid,
|
||||
@@ -29,22 +31,20 @@ describe('android::findPackageClassName', () => {
|
||||
});
|
||||
|
||||
it('returns manifest content if file exists in the folder', () => {
|
||||
expect(typeof findPackageClassName('flatJava')).toBe('string');
|
||||
expect(typeof findPackageClassName('/flatJava')).toBe('string');
|
||||
});
|
||||
|
||||
it('returns the name of the java class implementing ReactPackage', () => {
|
||||
expect(findPackageClassName('flatJava')).toBe('SomeExampleJavaPackage');
|
||||
expect(findPackageClassName('/flatJava')).toBe('SomeExampleJavaPackage');
|
||||
});
|
||||
|
||||
it('returns the name of the kotlin class implementing ReactPackage', () => {
|
||||
expect(findPackageClassName('flatKotlin')).toBe('SomeExampleKotlinPackage');
|
||||
expect(findPackageClassName('/flatKotlin')).toBe(
|
||||
'SomeExampleKotlinPackage',
|
||||
);
|
||||
});
|
||||
|
||||
it('returns `null` if there are no matches', () => {
|
||||
expect(findPackageClassName('empty')).toBeNull();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
mockFS.restore();
|
||||
expect(findPackageClassName('/empty')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,15 +11,17 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const getDependencyConfig = require('../../android').dependencyConfig;
|
||||
const mockFS = require('mock-fs');
|
||||
const fs = require('fs');
|
||||
const mocks = require('../../__fixtures__/android');
|
||||
|
||||
const userConfig = {};
|
||||
|
||||
describe('android::getDependencyConfig', () => {
|
||||
beforeAll(() => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
empty: {},
|
||||
nested: {
|
||||
android: {
|
||||
@@ -38,27 +40,23 @@ describe('android::getDependencyConfig', () => {
|
||||
});
|
||||
|
||||
it('returns an object with android project configuration', () => {
|
||||
expect(getDependencyConfig('nested', userConfig)).not.toBeNull();
|
||||
expect(typeof getDependencyConfig('nested', userConfig)).toBe('object');
|
||||
expect(getDependencyConfig('/nested', userConfig)).not.toBeNull();
|
||||
expect(typeof getDependencyConfig('/nested', userConfig)).toBe('object');
|
||||
});
|
||||
|
||||
it('returns `null` if manifest file has not been found', () => {
|
||||
expect(getDependencyConfig('empty', userConfig)).toBeNull();
|
||||
expect(getDependencyConfig('/empty', userConfig)).toBeNull();
|
||||
});
|
||||
|
||||
it('returns `null` if android project was not found', () => {
|
||||
expect(getDependencyConfig('empty', userConfig)).toBeNull();
|
||||
expect(getDependencyConfig('/empty', userConfig)).toBeNull();
|
||||
});
|
||||
|
||||
it('returns `null` if android project does not contain ReactPackage', () => {
|
||||
expect(getDependencyConfig('noPackage', userConfig)).toBeNull();
|
||||
expect(getDependencyConfig('/noPackage', userConfig)).toBeNull();
|
||||
});
|
||||
|
||||
it('returns `null` if it cannot find a packageClassName', () => {
|
||||
expect(getDependencyConfig('corrupted', userConfig)).toBeNull();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
mockFS.restore();
|
||||
expect(getDependencyConfig('/corrupted', userConfig)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,13 +11,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const getProjectConfig = require('../../android').projectConfig;
|
||||
const mockFS = require('mock-fs');
|
||||
const fs = require('fs');
|
||||
const mocks = require('../../__fixtures__/android');
|
||||
|
||||
describe('android::getProjectConfig', () => {
|
||||
beforeAll(() => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
empty: {},
|
||||
nested: {
|
||||
android: {
|
||||
@@ -38,7 +40,7 @@ describe('android::getProjectConfig', () => {
|
||||
|
||||
it("returns `null` if manifest file hasn't been found", () => {
|
||||
const userConfig = {};
|
||||
const folder = 'noManifest';
|
||||
const folder = '/noManifest';
|
||||
|
||||
expect(getProjectConfig(folder, userConfig)).toBeNull();
|
||||
});
|
||||
@@ -46,7 +48,7 @@ describe('android::getProjectConfig', () => {
|
||||
describe('returns an object with android project configuration for', () => {
|
||||
it('nested structure', () => {
|
||||
const userConfig = {};
|
||||
const folder = 'nested';
|
||||
const folder = '/nested';
|
||||
|
||||
expect(getProjectConfig(folder, userConfig)).not.toBeNull();
|
||||
expect(typeof getProjectConfig(folder, userConfig)).toBe('object');
|
||||
@@ -54,7 +56,7 @@ describe('android::getProjectConfig', () => {
|
||||
|
||||
it('flat structure', () => {
|
||||
const userConfig = {};
|
||||
const folder = 'flat';
|
||||
const folder = '/flat';
|
||||
|
||||
expect(getProjectConfig(folder, userConfig)).not.toBeNull();
|
||||
expect(typeof getProjectConfig(folder, userConfig)).toBe('object');
|
||||
@@ -64,7 +66,7 @@ describe('android::getProjectConfig', () => {
|
||||
const userConfig = {
|
||||
manifestPath: 'src/main/AndroidManifest.xml',
|
||||
};
|
||||
const folder = 'multiple';
|
||||
const folder = '/multiple';
|
||||
|
||||
expect(getProjectConfig(folder, userConfig)).not.toBeNull();
|
||||
expect(typeof getProjectConfig(folder, userConfig)).toBe('object');
|
||||
@@ -73,12 +75,8 @@ describe('android::getProjectConfig', () => {
|
||||
|
||||
it('should return `null` if android project was not found', () => {
|
||||
const userConfig = {};
|
||||
const folder = 'empty';
|
||||
const folder = '/empty';
|
||||
|
||||
expect(getProjectConfig(folder, userConfig)).toBeNull();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
mockFS.restore();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,14 +11,16 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const findManifest = require('../../android/findManifest');
|
||||
const readManifest = require('../../android/readManifest');
|
||||
const mockFS = require('mock-fs');
|
||||
const fs = require('fs');
|
||||
const mocks = require('../../__fixtures__/android');
|
||||
|
||||
describe('android::readManifest', () => {
|
||||
beforeAll(() => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
empty: {},
|
||||
nested: {
|
||||
android: {
|
||||
@@ -29,19 +31,15 @@ describe('android::readManifest', () => {
|
||||
});
|
||||
|
||||
it('returns manifest content if file exists in the folder', () => {
|
||||
const manifestPath = findManifest('nested');
|
||||
const manifestPath = findManifest('/nested');
|
||||
expect(readManifest(manifestPath)).not.toBeNull();
|
||||
expect(typeof readManifest(manifestPath)).toBe('object');
|
||||
});
|
||||
|
||||
it('throws an error if there is no manifest in the folder', () => {
|
||||
const fakeManifestPath = findManifest('empty');
|
||||
const fakeManifestPath = findManifest('/empty');
|
||||
expect(() => {
|
||||
readManifest(fakeManifestPath);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
mockFS.restore();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,24 +11,26 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const findAssets = require('../findAssets');
|
||||
const dependencies = require('../__fixtures__/dependencies');
|
||||
const mockFs = require('mock-fs');
|
||||
const fs = require('fs');
|
||||
|
||||
describe('findAssets', () => {
|
||||
beforeEach(() => {
|
||||
mockFs({testDir: dependencies.withAssets});
|
||||
fs.__setMockFilesystem({testDir: dependencies.withAssets});
|
||||
});
|
||||
|
||||
it('returns an array of all files in given folders', () => {
|
||||
const assets = findAssets('testDir', ['fonts', 'images']);
|
||||
const assets = findAssets('/testDir', ['fonts', 'images']);
|
||||
|
||||
expect(Array.isArray(assets)).toBeTruthy();
|
||||
expect(assets).toHaveLength(3);
|
||||
});
|
||||
|
||||
it('prepends assets paths with the folder path', () => {
|
||||
const assets = findAssets('testDir', ['fonts', 'images']);
|
||||
const assets = findAssets('/testDir', ['fonts', 'images']);
|
||||
|
||||
assets.forEach(assetPath => {
|
||||
expect(assetPath).toContain('testDir');
|
||||
@@ -36,10 +38,6 @@ describe('findAssets', () => {
|
||||
});
|
||||
|
||||
it('returns an empty array if given assets are null', () => {
|
||||
expect(findAssets('testDir', null)).toHaveLength(0);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
mockFs.restore();
|
||||
expect(findAssets('/testDir', null)).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,49 +11,51 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const findProject = require('../../ios/findProject');
|
||||
const mockFS = require('mock-fs');
|
||||
const fs = require('fs');
|
||||
const projects = require('../../__fixtures__/projects');
|
||||
const ios = require('../../__fixtures__/ios');
|
||||
|
||||
describe('ios::findProject', () => {
|
||||
it('returns path to xcodeproj if found', () => {
|
||||
mockFS(projects.flat);
|
||||
expect(findProject('')).not.toBeNull();
|
||||
fs.__setMockFilesystem(projects.flat);
|
||||
expect(findProject('/')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('returns null if there are no projects', () => {
|
||||
mockFS({testDir: projects});
|
||||
expect(findProject('')).toBeNull();
|
||||
fs.__setMockFilesystem({testDir: projects});
|
||||
expect(findProject('/')).toBeNull();
|
||||
});
|
||||
|
||||
it('returns ios project regardless of its name', () => {
|
||||
mockFS({ios: ios.validTestName});
|
||||
expect(findProject('')).not.toBeNull();
|
||||
fs.__setMockFilesystem({ios: ios.validTestName});
|
||||
expect(findProject('/')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('ignores node_modules', () => {
|
||||
mockFS({node_modules: projects.flat});
|
||||
expect(findProject('')).toBeNull();
|
||||
fs.__setMockFilesystem({node_modules: projects.flat});
|
||||
expect(findProject('/')).toBeNull();
|
||||
});
|
||||
|
||||
it('ignores Pods', () => {
|
||||
mockFS({Pods: projects.flat});
|
||||
expect(findProject('')).toBeNull();
|
||||
fs.__setMockFilesystem({Pods: projects.flat});
|
||||
expect(findProject('/')).toBeNull();
|
||||
});
|
||||
|
||||
it('ignores Pods inside `ios` folder', () => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
ios: {
|
||||
Pods: projects.flat,
|
||||
DemoApp: projects.flat.ios,
|
||||
},
|
||||
});
|
||||
expect(findProject('')).toBe('ios/DemoApp/demoProject.xcodeproj');
|
||||
expect(findProject('/')).toBe('ios/DemoApp/demoProject.xcodeproj');
|
||||
});
|
||||
|
||||
it('ignores xcodeproj from example folders', () => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
examples: projects.flat,
|
||||
Examples: projects.flat,
|
||||
example: projects.flat,
|
||||
@@ -61,11 +63,11 @@ describe('ios::findProject', () => {
|
||||
Zpp: projects.flat,
|
||||
});
|
||||
|
||||
expect(findProject('').toLowerCase()).not.toContain('example');
|
||||
expect(findProject('/').toLowerCase()).not.toContain('example');
|
||||
});
|
||||
|
||||
it('ignores xcodeproj from sample folders', () => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
samples: projects.flat,
|
||||
Samples: projects.flat,
|
||||
sample: projects.flat,
|
||||
@@ -73,11 +75,11 @@ describe('ios::findProject', () => {
|
||||
Zpp: projects.flat,
|
||||
});
|
||||
|
||||
expect(findProject('').toLowerCase()).not.toContain('sample');
|
||||
expect(findProject('/').toLowerCase()).not.toContain('sample');
|
||||
});
|
||||
|
||||
it('ignores xcodeproj from test folders at any level', () => {
|
||||
mockFS({
|
||||
fs.__setMockFilesystem({
|
||||
test: projects.flat,
|
||||
IntegrationTests: projects.flat,
|
||||
tests: projects.flat,
|
||||
@@ -87,10 +89,6 @@ describe('ios::findProject', () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(findProject('').toLowerCase()).not.toContain('test');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
mockFS.restore();
|
||||
expect(findProject('/').toLowerCase()).not.toContain('test');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,32 +11,34 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
jest.mock('fs');
|
||||
|
||||
const getProjectConfig = require('../../ios').projectConfig;
|
||||
const mockFS = require('mock-fs');
|
||||
const fs = require('fs');
|
||||
const projects = require('../../__fixtures__/projects');
|
||||
|
||||
describe('ios::getProjectConfig', () => {
|
||||
const userConfig = {};
|
||||
|
||||
beforeEach(() => {
|
||||
mockFS({testDir: projects});
|
||||
fs.__setMockFilesystem({testDir: projects});
|
||||
});
|
||||
|
||||
it('returns an object with ios project configuration', () => {
|
||||
const folder = 'testDir/nested';
|
||||
const folder = '/testDir/nested';
|
||||
|
||||
expect(getProjectConfig(folder, userConfig)).not.toBeNull();
|
||||
expect(typeof getProjectConfig(folder, userConfig)).toBe('object');
|
||||
});
|
||||
|
||||
it('returns `null` if ios project was not found', () => {
|
||||
const folder = 'testDir/empty';
|
||||
const folder = '/testDir/empty';
|
||||
|
||||
expect(getProjectConfig(folder, userConfig)).toBeNull();
|
||||
});
|
||||
|
||||
it('returns normalized shared library names', () => {
|
||||
const projectConfig = getProjectConfig('testDir/nested', {
|
||||
const projectConfig = getProjectConfig('/testDir/nested', {
|
||||
sharedLibraries: ['libc++', 'libz.tbd', 'HealthKit', 'HomeKit.framework'],
|
||||
});
|
||||
|
||||
@@ -47,8 +49,4 @@ describe('ios::getProjectConfig', () => {
|
||||
'HomeKit.framework',
|
||||
]);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
mockFS.restore();
|
||||
});
|
||||
});
|
||||
|
||||
+2
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native",
|
||||
"version": "1000.0.0",
|
||||
"version": "0.50.0-rc.0",
|
||||
"description": "A framework for building native apps using React",
|
||||
"license": "BSD-3-Clause",
|
||||
"repository": {
|
||||
@@ -162,7 +162,7 @@
|
||||
"graceful-fs": "^4.1.3",
|
||||
"inquirer": "^3.0.6",
|
||||
"lodash": "^4.16.6",
|
||||
"metro-bundler": "^0.19.0",
|
||||
"metro-bundler": "^0.20.0",
|
||||
"mime": "^1.3.4",
|
||||
"minimist": "^1.2.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
@@ -200,7 +200,6 @@
|
||||
"eslint-plugin-react": "^7.2.1",
|
||||
"flow-bin": "^0.56.0",
|
||||
"jest": "^21",
|
||||
"mock-fs": "^4.4.1",
|
||||
"prettier": "1.7.0",
|
||||
"react": "16.0.0",
|
||||
"react-test-renderer": "16.0.0",
|
||||
|
||||
+45
-36
@@ -15,7 +15,7 @@
|
||||
* After changing the files it makes a commit and tags it.
|
||||
* All you have to do is push changes to remote and CI will make a new build.
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const {
|
||||
cat,
|
||||
echo,
|
||||
@@ -32,15 +32,15 @@ let argv = minimist(process.argv.slice(2), {
|
||||
});
|
||||
|
||||
// - check we are in release branch, e.g. 0.33-stable
|
||||
let branch = exec(`git symbolic-ref --short HEAD`, {silent: true}).stdout.trim();
|
||||
let branch = exec('git symbolic-ref --short HEAD', {silent: true}).stdout.trim();
|
||||
|
||||
if (branch.indexOf(`-stable`) === -1) {
|
||||
echo(`You must be in 0.XX-stable branch to bump a version`);
|
||||
if (branch.indexOf('-stable') === -1) {
|
||||
echo('You must be in 0.XX-stable branch to bump a version');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// e.g. 0.33
|
||||
let versionMajor = branch.slice(0, branch.indexOf(`-stable`));
|
||||
let versionMajor = branch.slice(0, branch.indexOf('-stable'));
|
||||
|
||||
// - check that argument version matches branch
|
||||
// e.g. 0.33.1 or 0.33.0-rc4
|
||||
@@ -58,34 +58,43 @@ if (!match) {
|
||||
}
|
||||
let [, major, minor, patch, prerelease] = match;
|
||||
|
||||
cat('scripts/versiontemplates/ReactNativeVersion.java.template')
|
||||
.replace('${major}', major)
|
||||
.replace('${minor}', minor)
|
||||
.replace('${patch}', patch)
|
||||
.replace('${prerelease}', prerelease !== undefined ? `"${prerelease}"` : 'null')
|
||||
.to('ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java');
|
||||
fs.writeFileSync(
|
||||
'ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java',
|
||||
cat('scripts/versiontemplates/ReactNativeVersion.java.template')
|
||||
.replace('${major}', major)
|
||||
.replace('${minor}', minor)
|
||||
.replace('${patch}', patch)
|
||||
.replace('${prerelease}', prerelease !== undefined ? `"${prerelease}"` : 'null'),
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
cat('scripts/versiontemplates/RCTVersion.h.template')
|
||||
.replace('${major}', `@(${major})`)
|
||||
.replace('${minor}', `@(${minor})`)
|
||||
.replace('${patch}', `@(${patch})`)
|
||||
.replace('${prerelease}', prerelease !== undefined ? `@"${prerelease}"` : '[NSNull null]')
|
||||
.to('React/Base/RCTVersion.h');
|
||||
fs.writeFileSync(
|
||||
'React/Base/RCTVersion.h',
|
||||
cat('scripts/versiontemplates/RCTVersion.h.template')
|
||||
.replace('${major}', `@(${major})`)
|
||||
.replace('${minor}', `@(${minor})`)
|
||||
.replace('${patch}', `@(${patch})`)
|
||||
.replace('${prerelease}', prerelease !== undefined ? `@"${prerelease}"` : '[NSNull null]'),
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
cat('scripts/versiontemplates/ReactNativeVersion.js.template')
|
||||
.replace('${major}', major)
|
||||
.replace('${minor}', minor)
|
||||
.replace('${patch}', patch)
|
||||
.replace('${prerelease}', prerelease !== undefined ? `'${prerelease}'` : 'null')
|
||||
.to('Libraries/Core/ReactNativeVersion.js');
|
||||
fs.writeFileSync(
|
||||
'Libraries/Core/ReactNativeVersion.js',
|
||||
cat('scripts/versiontemplates/ReactNativeVersion.js.template')
|
||||
.replace('${major}', major)
|
||||
.replace('${minor}', minor)
|
||||
.replace('${patch}', patch)
|
||||
.replace('${prerelease}', prerelease !== undefined ? `'${prerelease}'` : 'null'),
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
let packageJson = JSON.parse(cat(`package.json`));
|
||||
let packageJson = JSON.parse(cat('package.json'));
|
||||
packageJson.version = version;
|
||||
JSON.stringify(packageJson, null, 2).to(`package.json`);
|
||||
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2), 'utf-8');
|
||||
|
||||
// - change ReactAndroid/gradle.properties
|
||||
if (sed(`-i`, /^VERSION_NAME=.*/, `VERSION_NAME=${version}`, `ReactAndroid/gradle.properties`).code) {
|
||||
echo(`Couldn't update version for Gradle`);
|
||||
if (sed('-i', /^VERSION_NAME=.*/, `VERSION_NAME=${version}`, 'ReactAndroid/gradle.properties').code) {
|
||||
echo('Couldn\'t update version for Gradle');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -93,23 +102,23 @@ if (sed(`-i`, /^VERSION_NAME=.*/, `VERSION_NAME=${version}`, `ReactAndroid/gradl
|
||||
let numberOfChangedLinesWithNewVersion = exec(`git diff -U0 | grep '^[+]' | grep -c ${version} `, {silent: true})
|
||||
.stdout.trim();
|
||||
if (+numberOfChangedLinesWithNewVersion !== 2) {
|
||||
echo(`Failed to update all the files. package.json and gradle.properties must have versions in them`);
|
||||
echo(`Fix the issue, revert and try again`);
|
||||
exec(`git diff`);
|
||||
echo('Failed to update all the files. package.json and gradle.properties must have versions in them');
|
||||
echo('Fix the issue, revert and try again');
|
||||
exec('git diff');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// - make commit [0.21.0-rc] Bump version numbers
|
||||
if (exec(`git commit -a -m "[${version}] Bump version numbers"`).code) {
|
||||
echo(`failed to commit`);
|
||||
echo('failed to commit');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// - add tag v0.21.0-rc
|
||||
if (exec(`git tag v${version}`).code) {
|
||||
echo(`failed to tag the commit with v${version}, are you sure this release wasn't made earlier?`);
|
||||
echo(`You may want to rollback the last commit`);
|
||||
echo(`git reset --hard HEAD~1`);
|
||||
echo('You may want to rollback the last commit');
|
||||
echo('git reset --hard HEAD~1');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -118,10 +127,10 @@ let remote = argv.remote;
|
||||
exec(`git push ${remote} v${version}`);
|
||||
|
||||
// Tag latest if doing stable release
|
||||
if (version.indexOf(`rc`) === -1) {
|
||||
exec(`git tag -d latest`);
|
||||
if (version.indexOf('rc') === -1) {
|
||||
exec('git tag -d latest');
|
||||
exec(`git push ${remote} :latest`);
|
||||
exec(`git tag latest`);
|
||||
exec('git tag latest');
|
||||
exec(`git push ${remote} latest`);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,77 +1,25 @@
|
||||
# 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 "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"
|
||||
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 &&
|
||||
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 "boot animation status=$bootanim"
|
||||
echo "emulator status=$bootanim"
|
||||
done
|
||||
echo "Android Virtual Device is ready."
|
||||
}
|
||||
|
||||
function retry3 {
|
||||
|
||||
@@ -48,10 +48,11 @@ 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(`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');
|
||||
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');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user