forked from abarisain/dmix
-
Notifications
You must be signed in to change notification settings - Fork 5
/
.travis.yml
50 lines (46 loc) · 3.49 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
language: scala
scala:
- 2.11.2
before_install:
- git fetch origin 'refs/tags/*:refs/tags/*'
- (mkdir -p android/; cd android; test -e android-sdk-linux || wget "$(wget http://developer.android.com/sdk/index.html -O-|grep -o 'http://[^"]*-linux[.][^"]*')" -O- | tar zx)
- export ANDROID_HOME="${PWD}/android/android-sdk-linux"
- export PATH="${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}"
- if [ `uname -m` = x86_64 ]; then sudo apt-get update -qq; sudo apt-get install -qq --force-yes libgd2-xpm lib32stdc++6 lib32z1 > /dev/null; fi
- export TOOLS=$(android list sdk --no-ui > listing.new; android list sdk -a --no-ui > listing; for i in 'Android SDK Platform-tools' 'Android SDK Build-tools' 'SDK Platform Android' 'Android Support Library' 'System Image'; do grep "$(grep "$i" listing |head -1|cut -f2- -d-)" listing.new; done|cut -f1 -d-|tr -d \ |paste -sd,)
- echo Updating $TOOLS
- test -n "$TOOLS" && echo yes |android -s update sdk --filter $TOOLS --no-ui --force
- test -d ${ANDROID_HOME}/build-tools/17.0.0 || uname -p|grep -q 64 || (echo yes |android -s update sdk --filter build-tools-17.0.0 -a --no-ui --force && cd ${ANDROID_HOME}/build-tools && cd "$(ls -rv1)" && cp ../17.0.0/aapt .)
- sed -i '/java.\(source\|target\)/s/1.5/1.7/' ${ANDROID_HOME}/tools/ant/build.xml
- (mkdir -p scala/; cd scala/; test -e scala-$TRAVIS_SCALA_VERSION || wget http://www.scala-lang.org/files/archive/scala-$TRAVIS_SCALA_VERSION.tgz -O - |tar zx)
- export SCALA_PATH="${PWD}/scala/scala-$TRAVIS_SCALA_VERSION"
- echo git clone --depth 1 https://github.com/imsizon/ant-android-scala.git
- export AAS="${PWD}/ant-android-scala"
- sed -i s/{source.dir}/{scala.source.dir}/g ${AAS}/build-scala.xml
- openssl aes-128-cbc -d -salt -in .travis-debug.enc -out .travis-debug -k $key
- export KEY_STORE="${PWD}/.travis-debug"
- ls -1 android/|grep -q ^apache-ant- || (cd android; ant_mirror=http://mirrors.ukfast.co.uk/sites/ftp.apache.org//ant/binaries/; wget "$ant_mirror$(wget $ant_mirror -O - |sed -n 's/.*>\([^<]*\.bz2\)<.*/\1/p')" -O - |tar jx)
- export PATH="$(ls -drv1 ${PWD}/android/apache-ant-*|head -1)/bin:${PATH}"
- export APP="$(sed 's/.*"app_name"[^>]*>\([^<]*\).*/\1/p' -n ./main/res/values-de/strings.xml)"
script:
- v=$(ls -v1 $ANDROID_HOME/platforms|tail -1); for i in */project.properties; do sed -i "s/^target=android-.*/target=$v/" $i; done
- cd ./main
- envsubst < $(test -e ../local.properties.tmpl && echo ../)local.properties.tmpl |tee local.properties
- cp ${SCALA_PATH}/lib/scala-library.jar libs/
- ant clean
- if grep -q release local.properties; then ant release; else ant debug; fi
env:
global:
secure: YAXKp+63QcUZdFNAXrFA7iAC8WEiKg6qXWFlIWkHZIs+Vajylv+IFsh9f4TSUK1LC8HwzOgA0KlZE0v32E9hA3LHu/mPvocvKE8psYO6yR/ozLcBDy+9dA6/M5WUqieHnjNazdmF4NWjrLkN91qkX/g7hy3erHWCBTWC+MDmSz4=
after_success:
- cat ../.travis.hosts >> $HOME/.ssh/known_hosts
- openssl aes-128-cbc -d -salt -in ../.travis-deploy.enc -out .travis-deploy -k $key
- chmod 600 .travis-deploy
- ssh-agent bash -c "ssh-add .travis-deploy; git clone --depth=1 --branch=downloads git@github.com:${TRAVIS_REPO_SLUG} downloads"
- cd downloads
- find ../bin -name '*.apk'|while read i; do cp $i ${APP}-${i#*-}; done
- git add \*.apk
- git config user.email "${USER}@$(hostname -f)"
- git config user.name "Travis CI"
- git commit -m "Travis build ${TRAVIS_BUILD_NUMBER} for ${TRAVIS_COMMIT} (${TRAVIS_BRANCH})"
- ssh-agent bash -c "ssh-add ../.travis-deploy; git push origin downloads:downloads"