Twidere-App-Android-Twitter.../.travis.yml

100 lines
3.3 KiB
YAML

language: android
sudo: required
jdk: oraclejdk8
android:
components:
- tools
- tools # To fix https://github.com/travis-ci/travis-ci/issues/6040
- platform-tools
- build-tools-25.0.2
- android-25
# Additional components
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
licenses:
- 'android-sdk-preview-license-.+'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
env:
global:
# COMPONENT_GOOGLE_REPO
- secure: "OQ/wkORxY2qv4CmAdMxyW4ihRt5GRyxKxQRZpsdjMbwIKf3DlY6vBoNIEQ46sRRLAKOzkQ3LirodbWRCBlDN9WFw4XRsLTveqqtslMGeLf04peazXMIa6rJ22BCDGEmnzRNx6r3JRb9wEK1plNv4u4G9DgQ7ShzbwdZ8A5grlg8="
addons:
apt:
packages:
- curl
- tar
- gzip
- patch
- openssh-client
- git
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.m2/
before_install:
- openssl aes-256-cbc -K $encrypted_9b8203f9524d_key -iv $encrypted_9b8203f9524d_iv -in travis/configs/twidere_private_config.tar.gz.enc -out travis/configs/twidere_private_config.tar.gz -d
install:
# Extracts build configs into source tree
- tar zxf travis/configs/twidere_private_config.tar.gz
# Make sure ~/.ssh/ exists
- mkdir -p ~/.ssh/
# Make it secure
- chmod 700 ~/.ssh/
# Append ssh_config
- cat private/ssh_config >> ~/.ssh/config
# Append known_hosts
- cat private/ssh_known_hosts >> ~/.ssh/known_hosts
# Clone Google components
- ssh-agent bash -c "ssh-add private/ssh_id_rsa; git clone $COMPONENT_GOOGLE_REPO twidere/src/google" > /dev/null 2>&1
# Force reset to required commit id
- git -C twidere/src/google reset --hard `cat twidere/src/.google.commit-id` > /dev/null 2>&1
# Dropbox accessToken for uploading logs
- cat private/dropbox_uploader >> ~/.dropbox_uploader
before_script:
# Validate if patches work
- patch --dry-run -d twidere < twidere/patches/remove_closed_source_dependencies.patch
# Validate if Google components fetched successfully
- test -f twidere/src/google/AndroidManifest.xml
script:
- ./gradlew clean build
after_failure:
- curl "https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh" -o travis/scripts/dropbox_uploader.sh
- chmod +x travis/scripts/dropbox_uploader.sh
- find /tmp -maxdepth 1 -name 'kotlin-daemon.*.log' -exec sh -c 'travis/scripts/dropbox_uploader.sh upload $1 $TRAVIS_BUILD_ID/$(basename $1)' find-sh {} \;
- find ~/.gradle/daemon/ -name 'daemon-*.log' -exec sh -c 'travis/scripts/dropbox_uploader.sh upload $1 $TRAVIS_BUILD_ID/gradle-$(basename $1)' find-sh {} \;
- dmesg > dmesg.log; travis/scripts/dropbox_uploader.sh upload dmesg.log $TRAVIS_BUILD_ID/dmesg.log
deploy:
- provider: releases
prerelease: true
api_key:
secure: "WKtKwda3hegqO9QVujdonNoL2ESJUR80WHNq/13wDsbCABo/GNnuqHNYZmml3wAifEKKeCEYfNZRUuHQ8eHs54Lj5BlGRX5i+1LrGhhgnVFQgmrhIv4RJuVQ663kDEh+Jwo4vowJ2mxNDvLvOhfZwxjULPDiknqy6u5PyW3id5M="
file_glob: true
file: '**/*-release.apk'
on:
repo: TwidereProject/Twidere-Android
tags: true
- provider: script
script: ./gradlew publishGoogleRelease
on:
repo: TwidereProject/Twidere-Android
tags: true