-
Notifications
You must be signed in to change notification settings - Fork 40
/
.travis.yml
86 lines (75 loc) · 4.14 KB
/
.travis.yml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
if: (tag IS present) OR (type = pull_request)
language: android
env:
global:
- JAVA_TOOL_OPTIONS=-Dhttps.protocols=TLSv1.2
- BUILD_API=34
- BUILD_TOOLS=34.0.0
- ABI=x86
- EMU_API=22
- EMU_FLAVOR=default
- ANDROID_HOME=/usr/local/android-sdk
- TOOLS=${ANDROID_HOME}/cmdline-tools/latest
# PATH order is important, the 'emulator' script exists in more than one place
- PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
# If you want to run snapshot tests change value to 'true'. Build time will be increased by 6 minutes.
- RUN_SNAPSHOT_TESTS=false
- ROBOLECTRIC_SDK8_URL=https://repo1.maven.org/maven2/org/robolectric/android-all/8.0.0_r4-robolectric-r1/android-all-8.0.0_r4-robolectric-r1
- ROBOLECTRIC_SDK8_DIR=$HOME/.m2/repository/org/robolectric/android-all/8.0.0_r4-robolectric-r1
- ROBOLECTRIC_SDK8_FILE=${ROBOLECTRIC_SDK8_DIR}/android-all-8.0.0_r4-robolectric-r1
android:
components:
- tools
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
before_install:
- curl -s "https://get.sdkman.io" | bash
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk install java 17.0.2-open
- sdk use java 17.0.2-open
# Install cmdline-tools (older tools doesn't support Java 11)
- wget -q "https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip" -O android-commandline-tools-linux.zip
- mkdir -p ${ANDROID_HOME}/cmdline-tools
- unzip -q android-commandline-tools-linux.zip -d ${ANDROID_HOME}/cmdline-tools
- mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest
# Library for image manipulation in snapshot tests
- if [[ $RUN_SNAPSHOT_TESTS == true ]]; then python -m pip install Tools/Pillow-6.2.2-cp27-cp27mu-manylinux1_x86_64.whl --user; fi;
before_script:
# Install Android SDK and run emulator
- echo 'count=0' > /home/travis/.android/repositories.cfg # avoid harmless sdkmanager warning
- echo y | ${TOOLS}/bin/sdkmanager "platform-tools" >/dev/null
- echo y | ${TOOLS}/bin/sdkmanager "tools" >/dev/null
- echo y | ${TOOLS}/bin/sdkmanager "build-tools;$BUILD_TOOLS" >/dev/null
- echo y | ${TOOLS}/bin/sdkmanager "platforms;android-$EMU_API" >/dev/null
- echo y | ${TOOLS}/bin/sdkmanager "platforms;android-$BUILD_API" >/dev/null
- echo y | ${TOOLS}/bin/sdkmanager "extras;android;m2repository" >/dev/null
- if [[ $RUN_SNAPSHOT_TESTS == true ]]; then echo y | ${TOOLS}/bin/sdkmanager "system-images;android-$EMU_API;$EMU_FLAVOR;$ABI"; fi;
- if [[ $RUN_SNAPSHOT_TESTS == true ]]; then echo no | avdmanager create avd --force -n test -k "system-images;android-$EMU_API;$EMU_FLAVOR;$ABI" -c 100M; fi;
- if [[ $RUN_SNAPSHOT_TESTS == true ]]; then emulator -verbose -avd test -no-accel -no-snapshot -no-window -no-audio -camera-back none -camera-front none -selinux permissive -qemu -m 2048 & fi;
script:
# make sure Robolectric dependency is presented
- mkdir -p ${ROBOLECTRIC_SDK8_DIR}
- curl ${ROBOLECTRIC_SDK8_URL}.jar --output ${ROBOLECTRIC_SDK8_FILE}.jar
- curl ${ROBOLECTRIC_SDK8_URL}.jar.sha1 --output ${ROBOLECTRIC_SDK8_FILE}.jar.sha1
- curl ${ROBOLECTRIC_SDK8_URL}.pom --output ${ROBOLECTRIC_SDK8_FILE}.pom
- curl ${ROBOLECTRIC_SDK8_URL}.pom.sha1 --output ${ROBOLECTRIC_SDK8_FILE}.pom.sha1
- ls -la ${ROBOLECTRIC_SDK8_DIR}
- ./gradlew assembleRelease testReleaseUnitTest
# wait emulator to come alive and start snapshot tests
- if [[ $RUN_SNAPSHOT_TESTS == true ]]; then android-wait-for-emulator; fi;
- if [[ $RUN_SNAPSHOT_TESTS == true ]]; then adb shell input keyevent 82 & fi;
- if [[ $RUN_SNAPSHOT_TESTS == true ]]; then ./gradlew verifyDebugAndroidTestScreenshotTest; fi;
before_deploy:
- ./Tools/verifyTag.sh
- ./gradlew assembleRelease generatePomFileForAarPublication
after_deploy:
- ./Tools/triggerRondo.sh
- version=`cat sdk-version.txt`; if [[ $version != *"beta"* ]]; then ./Tools/triggerRN.sh; fi; # trigger ReactNative if not beta release
deploy:
- provider: script
skip_cleanup: true
script: ./gradlew artifactoryPublish publishAarPublicationToSonatypeRepository
on:
tags: true