TravisCI,CircleCI使いたいけど、料金が。。でも、Jenkinsとか自前で作るのもメンドイ。。と、いう方はwerckerが良いかもしれません。
以下の記事をパクって、deploygateでやるときの設定を書いていきます。ありがとうございます。
http://b.fly1tkg.com/2014/06/android-ci-testfairy/
http://blog.wercker.com/2013/09/19/Gettingstarted-with-android-part-1.html
werckerの初期設定
省略。werckerのアカウント取得手順や、werckerbotとの連携、github,bitbucketとの連携は上記を参考にすればイケるはず。
wercker.ymlを作成・リポジトリに追加する
werckerを使うためには、Androidプロジェクトディレクトリの直下にwercker.ymlファイルを追加してリポジトリにpushするだけです。
内容は以下のような感じになります。
box: fly1tkg/android
# Build definition
build:
# The steps that will be executed on build
steps:
- android-sdk-update:
filter: sysimg-18
- script:
name: run gradle
code: |
gradle --full-stacktrace -q --project-cache-dir=$WERCKER_CACHE_DIR build
after-steps:
# Use the build results
- script:
name: inspect build result
code: |
pwd
ls -la ./[your_app]/build/outputs/apk
cp ./[your_app]/build/outputs/apk/*.apk $WERCKER_REPORT_ARTIFACTS_DIR
deploy:
steps:
- script:
name: upload to deploygate
code: |
curl -F file=@[your_app]/build/outputs/apk/app-release.apk -F token="$DEPLOYGATE_API_KEY" https://deploygate.com/api/users/[user_name]/apps
buildタスクで、ソースを落としてきて、buildして、werckerのフォルダにapkを安置してます。
deployタスクで、安置されてるapkをcurlでdeploygateにpostしています。
※[your_app]には、AndroidStudioとかで作成したAndroidプロジェクト名を入力します。
※Environment Variableで、
DEPLOYGATE_API_KEY: <deploygateのAPIキー>
を設定しておきます。
これで、指定したブランチに差分をpushしたタイミングで自動でビルド、アプリの配信が行われるはずです。
スーパー便利。
-
追記 [2014-09-05]
google play servicesの5.0.89を使いたかったのでgradleに
compile 'com.google.android.gms:play-services:5.0.89'
って追加しwerckerでビルドしたらエラーがでた。
- android-sdk-update:
filter: sysimg-19,extra-google-google_play_services,extra-android-m2repository,extra-google-m2repository
上記のように、必要なリポジトリを追加したら無事に通りました。よかった。