fmr
7/21/2015 - 4:52 AM

CI for Titanium SDK, based on https://github.com/yuchi/ti-cross-ci-experiments

#!/usr/bin/env bash

[[ "$PLATFORM" != "android" ]] && echo "Platform $PLATFORM is not android, skipping." && exit 0

echo "# Executing https://raw.github.com/embarkmobile/android-sdk-installer"

INSTALL_SCRIPT_URL=https://raw.github.com/embarkmobile/android-sdk-installer/version-2/android-sdk-installer
COMPONENTS=build-tools-19.1.0,android-17,sys-img-armeabi-v7a-android-17
INSTALLER_DIR=$HOME/.android-sdk-installer

if [[ ! -e "$INSTALLER_DIR/env" ]]; then
    echo "# Downloading SDK installer"
    curl -L $INSTALL_SCRIPT_URL | bash /dev/stdin --install=$COMPONENTS
fi

echo "# Setting environment variables"
source "$INSTALLER_DIR/env"

echo "# Creating AVD"
echo no | android create avd --force -n test -t android-17 --abi armeabi-v7a
language: objective-c
env:
  - TI_SDK=3.5.0.GA PLATFORM=ios
  - TI_SDK=3.5.1.GA PLATFORM=ios
  - TI_SDK=3.5.0.GA PLATFORM=android
  - TI_SDK=3.5.1.GA PLATFORM=android
script:
  - ti build $TI_OPTS -p $PLATFORM
before_install:
  - ./set_up_android.sh
  - export TI_OPTS="--build-only --no-progress-bars --no-prompt --no-banner --log-level info"
  - npm install -g titanium
  - npm install -g alloy
  - npm install
  - mkdir -p $HOME/.titanium
  - echo '{"loggedIn":true}' > $HOME/.titanium/auth_session.json
  - titanium sdk install "$TI_SDK" $TI_OPTS
  - sed -i -e "s/\(<sdk-version>\)\(.*\)\(<\/sdk-version>\)/\1${TI_SDK}\3/" tiapp.xml