Skip to content

Commit

Permalink
migrate ci to official docker (facebook#21477)
Browse files Browse the repository at this point in the history
Summary:
Simplify current build and offer it to community as official docker.
I have also created an [rfc](react-native-community/discussions-and-proposals#36).
pass all current ci.
none
 [GENERAL] [INTERNAL] [CI] - migrate ci to official docker
Pull Request resolved: facebook#21477

Differential Revision: D13801696

Pulled By: cpojer

fbshipit-source-id: fa235cf21ab5af2c87eb3c1a14788fab01c71ccf
  • Loading branch information
gengjiawen authored and facebook-github-bot committed Jan 24, 2019
1 parent 988366a commit 9351dd6
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 198 deletions.
90 changes: 2 additions & 88 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ aliases:
- node_modules
key: v1-analysis-dependencies-{{ arch }}-{{ checksum "package.json" }}{{ checksum "bots/package.json" }}

- &restore-cache-android-packages
keys:
- v1-android-sdkmanager-packages-api-28-alpha-{{ checksum "scripts/.tests.env" }}
- &save-cache-android-packages
paths:
- /opt/android/sdk
key: v1-android-sdkmanager-packages-api-28-alpha-{{ checksum "scripts/.tests.env" }}

- &restore-cache-gradle
keys:
- v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}
Expand All @@ -47,14 +39,6 @@ aliases:
- ~/.gradle
key: v1-gradle-{{ .Branch }}-{{ checksum "build.gradle" }}-{{ checksum "ReactAndroid/build.gradle" }}

- &restore-cache-ndk
keys:
- v3-android-ndk-r17c-{{ checksum "scripts/android-setup.sh" }}
- &save-cache-ndk
paths:
- /opt/ndk
key: v3-android-ndk-r17c-{{ checksum "scripts/android-setup.sh" }}

- &restore-cache-downloads-buck
keys:
- v3-buck-v2019.01.10.01-{{ checksum "scripts/circleci/buck_fetch.sh" }}}
Expand Down Expand Up @@ -115,11 +99,6 @@ aliases:
- /.*-stable/
- gh-pages

# Dependency Management
- &install-ndk
name: Install Android NDK
command: source scripts/android-setup.sh && getAndroidNDK

- &yarn
name: Run Yarn
command: |
Expand All @@ -129,52 +108,16 @@ aliases:
yarn install --non-interactive --cache-folder ~/.cache/yarn
fi
- &install-yarn
name: Install Yarn
command: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
- &install-buck
name: Install BUCK
command: |
if [[ ! -e ~/buck ]]; then
git clone https://github.com/facebook/buck.git ~/buck --branch v2019.01.10.01 --depth=1
fi
cd ~/buck && ant
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
cp -R ~/okbuck/tooling/junit/* ~/react-native/tooling/junit/.
- &create-ndk-directory
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
# CircleCI does not support interpolating env variables in the environment
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
- &configure-android-path
name: Configure Environment Variables
command: |
echo 'export PATH=${ANDROID_NDK}:~/buck/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
- &install-android-packages
name: Install Android SDK Packages
command: source scripts/android-setup.sh && getAndroidPackages

- &install-android-build-dependencies
name: Install Android Build Dependencies
command: ./scripts/circleci/apt-get-android-deps.sh

- &validate-android-sdk
name: Validate Android SDK Install
command: ./scripts/validate-android-sdk.sh
Expand Down Expand Up @@ -265,7 +208,7 @@ aliases:
- &build-android-rntester-app
name: Build Android RNTester App
command: ./gradlew RNTester:android:app:assembleRelease -Pjobs=$BUILD_THREADS
command: ./gradlew RNTester:android:app:assembleRelease

- &collect-android-test-results
name: Collect Test Results
Expand Down Expand Up @@ -340,14 +283,13 @@ js_defaults: &js_defaults
android_defaults: &android_defaults
<<: *defaults
docker:
- image: circleci/android:api-28-node8-alpha
- image: reactnativecommunity/react-native-android
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"'
- ANDROID_NDK: '/opt/ndk/android-ndk-r17c'
- BUILD_THREADS: 2

macos_defaults: &macos_defaults
Expand Down Expand Up @@ -472,15 +414,6 @@ jobs:
- attach_workspace:
at: ~/react-native

# Configure Android SDK and related dependencies
- run: *configure-android-path
# Android build deps install from the network faster than cache
- run: *install-android-build-dependencies

- restore-cache: *restore-cache-android-packages
- run: *install-android-packages
- save-cache: *save-cache-android-packages

# Validate Android SDK installation and packages
- run: *validate-android-sdk

Expand All @@ -490,12 +423,6 @@ jobs:

# Keep configuring Android dependencies while AVD boots up

# Install Android NDK
- run: *create-ndk-directory
- restore-cache: *restore-cache-ndk
- run: *install-ndk
- save-cache: *save-cache-ndk

# Install Buck
- restore-cache: *restore-cache-downloads-buck
- run: *install-buck
Expand Down Expand Up @@ -623,21 +550,8 @@ jobs:
- restore-cache: *restore-yarn-cache
- run: *yarn

# Configure Android SDK and related dependencies
- run: *configure-android-path
- run: *install-android-build-dependencies

- restore-cache: *restore-cache-android-packages
- run: *install-android-packages

# Install Android NDK
- run: *create-ndk-directory
- restore-cache: *restore-cache-ndk
- run: *install-ndk

# Fetch dependencies using Buck
- restore-cache: *restore-cache-downloads-buck
- run: *install-buck
- run: *download-dependencies-buck

# Fetch dependencies using Gradle
Expand Down
2 changes: 1 addition & 1 deletion ContainerShip/Dockerfile.android
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# image. Ideally, this image would be rebuilt with any new commit to the master
# branch. Doing so will catch issues such as BUCK failing to fetch dependencies
# or run tests, as well as unit test failures.
FROM reactnativeci/android-base:latest
FROM react-native-community/react-native

LABEL Description="This image prepares and runs React Native's Android tests."
LABEL maintainer="Héctor Ramos <[email protected]>"
Expand Down
83 changes: 0 additions & 83 deletions ContainerShip/Dockerfile.android-base

This file was deleted.

24 changes: 0 additions & 24 deletions ContainerShip/Dockerfile.javascript

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@
"flow-check-android": "flow check --flowconfig-name .flowconfig.android",
"lint": "eslint .",
"prettier": "prettier \"./**/*.js\" --write",
"docker-setup-android": "docker pull reactnativeci/android-base:latest",
"docker-build-android-base": "docker build -t reactnativeci/android-base -f ContainerShip/Dockerfile.android-base .",
"docker-setup-android": "docker pull reactnativecommunity/react-native-android",
"docker-build-android": "docker build -t reactnativeci/android -f ContainerShip/Dockerfile.android .",
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash ContainerShip/scripts/run-android-docker-instrumentation-tests.sh",
"test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash ContainerShip/scripts/run-android-docker-unit-tests.sh",
Expand Down

0 comments on commit 9351dd6

Please sign in to comment.