-
Notifications
You must be signed in to change notification settings - Fork 0
Travis Config
kawa89 edited this page Mar 16, 2017
·
4 revisions
LINK sprawdzanie poprawności .travis.yml
language: android
sudo: true
android:
components:
- tools
- build-tools-25.0.2
- platform-tools
- extra-android-m2repository
- extra-google-android-support
- android-25
jdk: oraclejdk8
os:
- linux
before_script:
- chmod +x gradlew
script:
- ./gradlew assembleDebug --stacktrace
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
language: android
sudo: true
android:
components:
- tools
- build-tools-25.0.2
- platform-tools
- extra-android-m2repository
- extra-google-android-support
- android-25
jdk: oraclejdk8
os:
- linux
before_script:
- chmod +x ./travis/test.sh
- chmod +x gradlew
script:
- ./travis/test.sh
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
Dodatkowo utwórz katalog (w głównym katalogu projektu)travis
a w nim plik test.sh
. Przykładowy plik:
./gradlew clean testDebugUnitTest
EXIT_CODE=$?
if [ ${EXIT_CODE} != 0 ]
then
echo "Exit code of testDebugUnitTest is " ${EXIT_CODE}
exit ${EXIT_CODE}
fi
echo "Building started"
./gradlew clean assembleDebug
3. Wszystkie testy - może być problem z Espresso - Zadanie7MainActivityLifecycle; wykorzystaj branch all_tests
.travis.yml
language: android
sudo: true
android:
components:
- tools
- build-tools-25.0.2
- platform-tools
- extra-android-m2repository
- extra-google-android-support
- android-25
- android-22
- sys-img-armeabi-v7a-android-22
jdk: oraclejdk8
os:
- linux
# Fix for permission denied
before_script:
- chmod +x ./travis/test.sh
- chmod +x gradlew
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
script:
- ./travis/test.sh
#Fix for licence not accepted
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
cache:
directories:
- $HOME/.m2
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
notifications:
email:
recipients:
- TWOJ_MAIL@POCZTA.PL
on_success: always
on_failure: always
test.sh
./gradlew clean testDebugUnitTest
EXIT_CODE=$?
if [ ${EXIT_CODE} != 0 ]
then
echo "Exit code of testDebugUnitTest is " ${EXIT_CODE}
exit ${EXIT_CODE}
fi
./gradlew connectedAndroidTest --info
EXIT_CODE_ANDROID_TEST=$?
if [ ${EXIT_CODE_ANDROID_TEST} != 0 ]
then
echo "Exit code of connectedAndroidTest is " ${EXIT_CODE_ANDROID_TEST}
exit ${EXIT_CODE_ANDROID_TEST}
fi
echo "Build started"
./gradlew clean assembleDebug
LINK zmienne środowiskowe Travis-CI
Przykłady zmiennych:
- TRAVIS_BRANCH
- TRAVIS_BUILD_NUMBER
- TRAVIS_COMMIT
- TRAVIS_COMMIT_MESSAGE
- TRAVIS_COMMIT_RANGE
w test.sh możemy sprawdzić np. na jaką branch budujemy -
if [ "${TRAVIS_BRANCH}" = "develop" ]; then
echo "Build develop branch!"
./gradlew clean assembleDebug
elif [ "${TRAVIS_BRANCH}" = "master" ]; then
echo "Build Master branch!"
fi