Skip to content

Commit 95ba787

Browse files
authored
v2 (#104)
Breaking changes - remove cmake from apt - remove python version 2 - remove ruby - openjdk 8 headless
1 parent 2c106dd commit 95ba787

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

.github/workflows/build.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ jobs:
2222
- name: Build Docker image
2323
run: docker build --tag $IMAGE_TAG .
2424

25+
- name: Check if Emulator (Headless) starts
26+
run: docker run --rm -v "${GITHUB_WORKSPACE}/scripts/":/scripts $IMAGE_TAG /bin/sh -c "/scripts/test-emulator-headless.sh"
27+
2528
- name: Checkout React Native
2629
uses: actions/checkout@v2
2730
with:
2831
repository: facebook/react-native
2932
path: react-native
3033

3134
- name: Build React Native
32-
run: |
33-
docker run --rm -v "${GITHUB_WORKSPACE}/react-native/":/pwd -w /pwd $IMAGE_TAG /bin/sh -c \
34-
"yarn install && ./gradlew --no-daemon :packages:rn-tester:android:app:assembleRelease && ./scripts/circleci/buck_fetch.sh"
35+
run: docker run --rm -v "${GITHUB_WORKSPACE}/scripts/":/scripts -v "${GITHUB_WORKSPACE}/react-native/":/react-native -w /react-native $IMAGE_TAG /bin/sh -c "/scripts/test-react-native-setup.sh"

.github/workflows/publish.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,16 @@ jobs:
2424
- name: Prepare tags
2525
env:
2626
DOCKER_IMAGE: reactnativecommunity/react-native-android
27+
STABLE_MAJOR: 1
2728
id: tags
2829
run: |
2930
VERSION=${GITHUB_REF#refs/tags/v}
30-
echo ::set-output name=tags::"${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:latest"
31+
MAJOR=$(echo $VERSION | cut -d'.' -f 1)
32+
TAGS="$DOCKER_IMAGE:$VERSION,$DOCKER_IMAGE:$MAJOR"
33+
if [[ $MAJOR == $STABLE_MAJOR ]]; then
34+
TAGS="$TAGS,$DOCKER_IMAGE:latest"
35+
fi
36+
echo ::set-output name=tags::${TAGS}
3137
3238
- name: Build & publish to Docker Hub
3339
uses: docker/build-push-action@v2

Dockerfile

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ ENV ADB_INSTALL_TIMEOUT=10
1818
ENV ANDROID_HOME=/opt/android
1919
ENV ANDROID_SDK_HOME=${ANDROID_HOME}
2020
ENV ANDROID_NDK=${ANDROID_HOME}/ndk/$NDK_VERSION
21-
ENV ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/$NDK_VERSION
2221
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
2322

2423
ENV PATH=${ANDROID_NDK}:${ANDROID_HOME}/cmdline-tools/tools/bin:${ANDROID_HOME}/emulator:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:/opt/buck/bin/:${PATH}
2524

2625
# Install system dependencies
2726
RUN apt update -qq && apt install -qq -y --no-install-recommends \
2827
apt-transport-https \
29-
curl \
3028
build-essential \
29+
curl \
3130
file \
3231
git \
33-
cmake \
34-
ruby-full \
35-
openjdk-8-jdk \
3632
gnupg2 \
37-
python \
38-
python3-distutils \
33+
libc++1-10 \
34+
libgl1 \
35+
libtcmalloc-minimal4 \
36+
openjdk-8-jdk-headless \
3937
openssh-client \
38+
python3 \
39+
python3-distutils \
4040
rsync \
41+
tzdata \
4142
unzip \
42-
&& gem install bundler \
4343
&& rm -rf /var/lib/apt/lists/*;
4444

4545
# install nodejs and yarn packages from nodesource and yarn apt sources

scripts/test-emulator-headless.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
echo no | avdmanager create avd -n testEmulator -k "system-images;android-21;google_apis;armeabi-v7a"
6+
emulator -avd testEmulator -no-audio -no-cache -no-snapshot -no-window &
7+
8+
echo "Waiting until the device is ready"
9+
adb wait-for-device
10+
11+
echo "The device is ready"
12+
adb shell input keyevent 82

scripts/test-react-native-setup.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
echo "Check Buck setup"
6+
./scripts/circleci/buck_fetch.sh
7+
buck build ReactAndroid/src/main/java/com/facebook/react
8+
buck build ReactAndroid/src/main/java/com/facebook/react/shell
9+
10+
echo "Build React Native"
11+
yarn install
12+
./gradlew --no-daemon :ReactAndroid:packageReactNdkLibsForBuck
13+
14+
echo "Assemble RNTester app"
15+
./gradlew --no-daemon :packages:rn-tester:android:app:assembleRelease

0 commit comments

Comments
 (0)