sh Codeship Android构建脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Codeship Android构建脚本相关的知识,希望对你有一定的参考价值。

cd /tmp
pwd
#Download Android SDK from Google and unzip it
wget http://dl.google.com/android/android-sdk_r24.1.2-linux.tgz
tar zxvf android-sdk_r24.1.2-linux.tgz
rm android-sdk_r24.1.2-linux.tgz
#Set extracted SDK location to $PATH so we can use commands
export ANDROID_HOME="/tmp/android-sdk-linux"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"

#Thanks to https://github.com/makinacorpus/android-archetypes/wiki/Getting-started:-Configure-your-environment for the command lines
#While loop is for auto-accept licence terms (press y every 1 sec)
#Install build tools
( sleep 1 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-21.1.2
#Now we want at least two SDK to test our build
#Install max SDK (API 22: should be your target SDK!)
( sleep 1 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --no-ui --all --filter android-22,sys-img-armeabi-v7a-android-22,addon-google_apis-google-22
#Install min SDK (API 8) (Drop if you want to test only 1 SDK)
( sleep 1 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --no-ui --all --filter android-8,sysimg-8,addon-google_apis-google-8

#Your extras here (Drop the ones you don't need it will speed up your build)
#( sleep 1 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk --no-ui --all --filter extra-android-m2repository,extra-android-support,extra-google-admob_ads_sdk,extra-google-analytics_sdk_v2,extra-google-google_play_services_froyo,extra-google-google_play_services,extra-google-m2repository,extra-google-play_apk_expansion,extra-google-play_billing,extra-google-play_licensing,extra-google-webdriver

#Go back to initial folder
cd -
touch local.properties
echo "sdk.dir=$ANDROID_HOME" >> local.properties

#Run build
./gradlew assembleDebug

#TEST SECTION, IGNORE IT IF YOU JUST WANT TO BUILD

#Create the AVD
#Use 'android list targets' to see targets ID, 1 should be API 8 and 2 API 22
mkdir avds
( sleep 1 && while [ 1 ]; do sleep 1; echo no; done ) | android create avd -t 1 -n API8 -c 512M -b armeabi
( sleep 1 && while [ 1 ]; do sleep 1; echo no; done ) | android create avd -t 2 -n API22 -c 512M -b armeabi
emulator -avd API8 -no-skin -no-audio -no-window &
adb wait-for-device #wait for device spawn
emulator -avd API22 -no-skin -no-audio -no-window &
adb wait-for-device #wait for second device spawn
./gradlew connectedCheck
./gradlew connectedAndroidTest

以上是关于sh Codeship Android构建脚本的主要内容,如果未能解决你的问题,请参考以下文章

sh WPEngine的Codeship Custom Deploy脚本

sh Neo4j - 在Codeship构建盒上下载并启动带有空间插件的Neo4j

sh Codeship - NodeJS +业力测试

sh Codeship - Symfony2与mysql - phpunit

sh 在特定端口上运行的Codeship上设置Neo4j

ruby 用于检查Codeship状态的简单Ruby脚本