Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AndroidのCI環境をCircleCIからWerckerにした話

 AndroidのCI環境をCircleCIからWerckerにした話

以下は本スライドに関連する記事になります。

AndroidのCI環境をCircleCIからWerckerに移行しました
http://tech.vasily.jp/entry/migrate_android_ci_from_circleci_to_wercker

CircleCIでbuild-toolsを23.0.2にした際にビルドが失敗する場合の対処方法
http://qiita.com/Horie1024/items/16901408c03154c70343

Androidのビルド用Dockerイメージの作成
http://qiita.com/Horie1024/items/7decc6f4b59285b85dce

WerckerでQuay.ioのPrivate Repositoryを使用する
http://qiita.com/Horie1024/items/f554f4eb7f2324b8fa06

WerckerでIP制限をかけたs3のバケットからkeystoreを取得しassembleReleaseを実行する
http://qiita.com/Horie1024/items/62eb4401daec1032cdec

Ryosuke Horie

June 09, 2016
Tweet

More Decks by Ryosuke Horie

Other Decks in Programming

Transcript

  1. Ϗϧυ؀ڥͷζϨʹΑΔϏϧυࣦഊ • CircleCIଆͰ༻ҙ͞ΕͨSDK͕࠷৽Ͱ͸ͳ͍ • ૺ۰ͨ͠ࣄྫ:-Android-SDK-Toolsͷrevision͕࠷৽Ͱແ͍ • toolsͷΞοϓσʔτͰճආ dependencies: override(΋͘͠͸ pre):

    - echo y | android update sdk --no-ui --all --filter "tools" - echo y | android update sdk --no-ui --all --filter "build-tools-23.0.2" ©"VASILY,"Inc.,"2016 19
  2. circle.ymlͱwercker.ymlͷରԠ • pipeline͸stepsͱ͍͏୯ҐͰߏ੒͞ΕΔ • wercker.ymlͰ͸ఆٛͨ͠pipelineηΫγϣϯຖʹstepsΛఆ͍ٛͯ͘͠ • stepsʹ͸छྨ͕͋Δ[^4] • Internal6steps:6Wercker͕։ൃͨ͠૊ࠐΈͷsteps •

    A:er6steps:6pipeline͕failed6or6passedͨ͠ࡍʹ࣮ߦ͞ΕΔsteps • script6steps:6shell6commandΛ࣮ߦ͢Δsteps • Installing6packages:6packageͷΠϯετʔϧΛ࣮ߦ͢Δsteps • ࣗ࡞:6ʮstep6registryʯʹొ࿥͢Δ͜ͱͰwercker.yml͔Β࢖༻Ͱ͖Δ [^4]h&p:/ /devcenter.wercker.com/docs/steps/index.html ©"VASILY,"Inc.,"2016 46
  3. circle.ymlͱwercker.ymlͷରԠ • ςετɺmasterϒϥϯνͷ৔߹ʹBetaͰͷ഑෍Λߦ͏cricle.yml machine: java: version: openjdk8 environment: ANDROID_HOME: /usr/local/android-sdk-linux

    dependencies: override: - echo y | android update sdk --no-ui --filter "android-23,build-tools-23.0.3" test: override: - ./gradlew testDebug deployment: master: branch: master commands: - ./gradlew assembleDebug crashlyticsUploadDistributionRelease ©"VASILY,"Inc.,"2016 47
  4. circle.ymlͱwercker.ymlͷରԠ • machineɺdependencies͸WerckerͰ͸DockerΠϝʔδ͕୲͏ • boxηΫγϣϯΛఆٛ • DockerHub͔Β࡞੒ͨ͠ΠϝʔδΛpull box: horie1024/wercker-android-build:0.1 test:

    override: - ./gradlew testDebug deployment: master: branch: master commands: - ./gradlew assembleDebug crashlyticsUploadDistributionRelease ©"VASILY,"Inc.,"2016 48
  5. circle.ymlͱwercker.ymlͷରԠ • test͸buildɺdeployment͸distribute0apkͱఆٛ box: horie1024/wercker-android-build:0.1 test: override: - ./gradlew testDebug

    deployment: master: branch: master commands: - ./gradlew assembleDebug crashlyticsUploadDistributionRelease ©"VASILY,"Inc.,"2016 49
  6. circle.ymlͱwercker.ymlͷରԠ • script(stepsͰcircle.ymlͱಉ͡Α͏ʹ࣮ߦ box: horie1024/wercker-android-build:0.1 build: steps: - script: name:

    Unit test code: | ./gradlew testDebug distribute-apk: steps: - script: name: Distribute APK code: | - ./gradlew assembleDebug crashlyticsUploadDistributionRelease ©"VASILY,"Inc.,"2016 50
  7. circle.ymlͱwercker.ymlͷରԠ • wercker.ymlΛGitHub΁ϓογϡ͢ΔͱϏϧυ͕։࢝ box: horie1024/wercker-android-build:0.1 build: steps: - script: name:

    Unit test code: | ./gradlew testDebug distribute-apk: steps: - script: name: Distribute APK code: | - ./gradlew assembleDebug crashlyticsUploadDistributionRelease ©"VASILY,"Inc.,"2016 51
  8. Google&Play΁ͷࣗಈΞοϓϩʔυ • gradle(play(publisherΛར༻ play { serviceAccountEmail = SERVICE_ACCOUNT_EMAIL pk12File =

    file(KEY_FILE_PATH) track = PLAY_TARGET_TRACK // 'production' or 'rollout' or 'beta' or 'alpha' } • gradle(taskͰ࣮ߦɺGooglePlay΁Ξοϓϩʔυ ./gradlew publishApkRelease ©"VASILY,"Inc.,"2016 57
  9. Google&Play΁ͷࣗಈΞοϓϩʔυ • werckerͷpipelineͰఆٛ upload-google-play: steps: - script: name: Upload APK

    to GooglePlay code: | ./gradlew publishApkRelease -PdisablePreDex crashlyticsUploadDistributionRelease ©"VASILY,"Inc.,"2016 58