Skip to content

Commit

Permalink
Add gitlab-ci file and remove travis (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
anjmao authored Nov 4, 2019
1 parent 878a6b1 commit 8b36d7f
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 19 deletions.
40 changes: 40 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
image: mysteriumnetwork/mobile-ci:0.1.0

stages:
- install
- test
- deploy

install-packages:
stage: install
script:
- yarn install
cache:
paths:
- node_modules/
artifacts:
when: on_success
paths:
- node_modules/

lint-and-test:
stage: test
dependencies:
- install-packages
script:
- yarn ci

push-beta:
stage: deploy
dependencies:
- install-packages
when: manual
only:
- master
- /^release-*/
script:
- echo "$FASTLANE_ANDROID_SIGNING_FILE_VALUE" | base64 --decode > "$FASTLANE_ANDROID_SIGNING_FILE_PATH"
- echo "$FASTLANE_ANDROID_SECRET_JSON_VALUE" | base64 --decode > "$FASTLANE_ANDROID_SECRET_JSON_PATH"
- echo "$GOOGLE_SERVICES_VALUE" | base64 --decode > "$GOOGLE_SERVICES_PATH"
- bundle update --bundler
- fastlane android beta
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

83 changes: 83 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#
# GitLab CI react-native-android v0.1
#
# https://hub.docker.com/r/webcuisine/gitlab-ci-react-native-android/
# https://github.com/cuisines/gitlab-ci-react-native-android
#

FROM ubuntu:18.04
MAINTAINER Sascha-Matthias Kulawik <[email protected]>

RUN echo "Android SDK 26.1.1"
ENV VERSION_SDK_TOOLS "4333796"

ENV ANDROID_HOME "/sdk"
ENV PATH "$PATH:${ANDROID_HOME}/tools"
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get -qq update && \
apt-get install -qqy --no-install-recommends \
bzip2 \
curl \
git-core \
html2text \
openjdk-8-jdk \
libc6-i386 \
lib32stdc++6 \
lib32gcc1 \
lib32z1 \
gnupg2 \
unzip \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN rm -f /etc/ssl/certs/java/cacerts; \
/var/lib/dpkg/info/ca-certificates-java.postinst configure

RUN curl -s https://dl.google.com/android/repository/sdk-tools-linux-${VERSION_SDK_TOOLS}.zip > /sdk.zip && \
unzip /sdk.zip -d /sdk && \
rm -v /sdk.zip

RUN mkdir -p $ANDROID_HOME/licenses/ \
&& echo "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > $ANDROID_HOME/licenses/android-sdk-license \
&& echo "84831b9409646a918e30573bab4c9c91346d8abd" > $ANDROID_HOME/licenses/android-sdk-preview-license

ADD packages.txt /sdk
RUN mkdir -p /root/.android && \
touch /root/.android/repositories.cfg && \
${ANDROID_HOME}/tools/bin/sdkmanager --update

RUN while read -r package; do PACKAGES="${PACKAGES}${package} "; done < /sdk/packages.txt && \
yes | ${ANDROID_HOME}/tools/bin/sdkmanager ${PACKAGES}

RUN echo "Installing Yarn Deb Source" \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN echo "Installing Node.JS" \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash -

ENV BUILD_PACKAGES git yarn nodejs build-essential imagemagick librsvg2-bin ruby ruby-dev wget libcurl4-openssl-dev
RUN echo "Installing Additional Libraries" \
&& rm -rf /var/lib/gems \
&& apt-get update && apt-get install $BUILD_PACKAGES -qqy --no-install-recommends

RUN echo "Installing Fastlane" \
&& gem install fastlane badge -N \
&& gem cleanup

ENV GRADLE_HOME /opt/gradle
ENV GRADLE_VERSION 5.4.1

RUN echo "Downloading Gradle" \
&& wget --no-verbose --output-document=gradle.zip "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip"

RUN echo "Installing Gradle" \
&& unzip gradle.zip \
&& rm gradle.zip \
&& mv "gradle-${GRADLE_VERSION}" "${GRADLE_HOME}/" \
&& ln --symbolic "${GRADLE_HOME}/bin/gradle" /usr/bin/gradle

ENV LC_ALL "en_US.UTF-8"
ENV LANG "en_US.UTF-8"

WORKDIR /app
9 changes: 9 additions & 0 deletions ci/packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
add-ons;addon-google_apis-google-24
build-tools;28.0.3
extras;android;m2repository
extras;google;m2repository
extras;google;google_play_services
extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2
extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2
platform-tools
platforms;android-28
7 changes: 1 addition & 6 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ end

platform :android do
def bundle_offline_js
sh("cd .. && "\
"react-native bundle --platform android"\
" --dev false"\
" --entry-file index.js"\
" --bundle-output android/app/src/main/assets/index.android.bundle"\
" --assets-dest android/app/src/main/res")
sh("cd .. && yarn bundle-android-js")
end

def build_release
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"ios": "react-native run-ios",
"test:unit": "jest",
"lint": "tsc --noEmit --skipLibCheck && tslint -p . 'src/**/*.{ts,tsx}' 'tests/**/*.{ts,tsx}'",
"ci": "yarn lint && yarn test:unit && util_scripts/check-headers.sh"
"ci": "yarn lint && yarn test:unit && util_scripts/check-headers.sh",
"bundle-android-js": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res"
},
"devDependencies": {
"@types/enzyme": "^3.1.11",
Expand Down

0 comments on commit 8b36d7f

Please sign in to comment.