This repository was archived by the owner on Jan 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
72 lines (66 loc) · 3.38 KB
/
.gitlab-ci.yml
File metadata and controls
72 lines (66 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# This file is a template, and might need editing before it works on your project.
# Read more about this script on this blog post https://about.gitlab.com/2016/11/30/setting-up-gitlab-ci-for-android-projects/, by Greyson Parrelli
image: openjdk:8-jdk
variables:
LANG: "en_US.UTF-8"
ANDROID_HOME: "/opt/android-sdk"
ANDROID_NDK_HOME: "/opt/android-sdk/ndk-bundle"
ANDROID_COMPILE_SDK: "29"
ANDROID_BUILD_TOOLS: "29.0.3"
ANDROID_SDK_TOOLS: "26.1.1"
ANDROID_NDK_VERSION: "21"
TERM: "dumb"
GRADLE_OPTS: '-XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -Dorg.gradle.jvmargs="-Xmx1536m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=440m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" -Dorg.gradle.parallel=false -Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=true'
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
before_script:
- apt-get --quiet clean --yes
- apt-get --quiet update --yes
- apt-get --quiet install --yes locales wget zip unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=tools.zip https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
- unzip -q tools.zip
- rm -fr $ANDROID_HOME tools.zip
- mkdir -p $ANDROID_HOME
- mv tools $ANDROID_HOME/tools
# Fix gradle 3.0 problem
- mkdir --parents /root/.android && touch /root/.android/repositories.cfg
- mkdir $ANDROID_HOME/licenses || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}"
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "platform-tools"
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}"
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "extras;android;m2repository"
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "extras;google;google_play_services"
- echo y | $ANDROID_HOME/tools/bin/sdkmanager "extras;google;m2repository"
- wget --quiet --output-document=android-ndk.zip http://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip
- unzip -q android-ndk.zip
- rm -fr $ANDROID_NDK_HOME android-ndk.zip
- mv android-ndk-r${ANDROID_NDK_VERSION} $ANDROID_NDK_HOME
- export ANDROID_SDK_HOME=$ANDROID_HOME
- export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK_HOME
- chmod +x ./gradlew
stages:
- build
- test
build:
stage: build
script:
- ./gradlew assemble
artifacts:
paths:
- app/build/outputs/
unitTests:
stage: test
script:
- ./gradlew test
#functionalTests:
# stage: test
# script:
# - wget --quiet --output-document=android-wait-for-emulator https://raw.githubusercontent.com/travis-ci/travis-cookbooks/0f497eb71291b52a703143c5cd63a217c8766dc9/community-cookbooks/android-sdk/files/default/android-wait-for-emulator
# - chmod +x android-wait-for-emulator
# - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter sys-img-x86-google_apis-${ANDROID_COMPILE_SDK}
# - echo no | android-sdk-linux/tools/android create avd -n test -t android-${ANDROID_COMPILE_SDK} --abi google_apis/x86
# - android-sdk-linux/tools/emulator64-x86 -avd test -no-window -no-audio &
# - ./android-wait-for-emulator
# - adb shell input keyevent 82
# - ./gradlew cAT