Last active
September 10, 2018 17:39
-
-
Save bassaer/4b71bcdd4ceb002d0732b8c297fe1637 to your computer and use it in GitHub Desktop.
CircleCI 2.0でAndroidライブラリの自動デプロイ ref: http://qiita.com/bassaer/items/6b9aedae4571d59f0fdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
branches: | |
only: | |
- master | |
- develop | |
docker: | |
# specify the version you desire here | |
- image: circleci/android:api-26-alpha | |
environment: | |
# Customize the JVM maximum heap limit | |
JVM_OPTS: -Xmx3200m | |
TERM: dumb | |
steps: | |
- checkout | |
# Download and cache dependencies | |
- restore_cache: | |
key: jars-{{ checksum "build.gradle" }}-{{ checksum "chatmessageview/build.gradle" }} | |
- run: | |
name: update android sdk | |
command: | | |
echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-26 | |
echo y | android update sdk --no-ui --all --filter build-tools-26.0.0 | |
- run: | |
name: gradle dependencies | |
command: ./gradlew androidDependencies | |
- save_cache: | |
paths: ~/.gradle | |
key: jars-{{ checksum "build.gradle" }}-{{ checksum "chatmessageview/build.gradle" }} | |
# run unit tests! | |
- run: | |
name: unit test | |
command: | | |
./gradlew test | |
./gradlew lint test | |
- run: | |
name: Show list of system-images | |
command: sdkmanager --list --verbose | grep system-images | |
- run: | |
name: Setup Emulator | |
command: sdkmanager "system-images;android-24;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-24;default;armeabi-v7a" | |
- run: | |
name: Launch Emulator | |
command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on | |
background: true | |
- run: | |
name: Wait emulator | |
command: | | |
circle-android wait-for-boot | |
adb shell input keyevent 82 | |
- run: | |
name: Run UI test | |
command: ./gradlew example:connectedAndroidTest | |
- run: | |
name: Distribute Bintray | |
command: | | |
if [ $CIRCLE_BRANCH = "master" ]; then | |
sh ./deploy.sh | |
else | |
echo "Bintray distribution was skipped." | |
fi | |
- run: | |
name: Update version | |
command: | | |
if [ $CIRCLE_BRANCH = "master" ]; then | |
sh ./version.sh | |
else | |
echo "Version update was skipped." | |
fi | |
- store_test_results: | |
path: example/build/test-results | |
- store_artifacts: | |
path: example/build/reports | |
destination: reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
branches: | |
only: | |
- master | |
- develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: Run UI test | |
command: ./gradlew example:connectedAndroidTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: Distribute Bintray | |
command: | | |
if [ $CIRCLE_BRANCH = "master" ]; then | |
sh ./deploy.sh | |
else | |
echo "Bintray distribution was skipped." | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile 'com.github.bassaer:chatmessageview:1.3.5' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker: | |
# specify the version you desire here | |
- image: circleci/android:api-26-alpha |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: タスク名 | |
command: 実行したいコマンド | |
- run: | |
name: 複数のコマンドがある場合 | |
command: | | |
command1 | |
command2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: update android sdk | |
command: | | |
echo y | android update sdk --no-ui --all --filter tool,extra-android-m2repository,extra-google-google_play_services,extra-google-m2repository,android-26 | |
echo y | android update sdk --no-ui --all --filter build-tools-26.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: unit test | |
command: | | |
./gradlew test | |
./gradlew lint test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: Show list of system-images | |
command: sdkmanager --list --verbose | grep system-images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: Setup Emulator | |
command: sdkmanager "system-images;android-24;default;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-24;default;armeabi-v7a" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: Launch Emulator | |
command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on | |
background: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- run: | |
name: Wait emulator | |
command: | | |
circle-android wait-for-boot | |
adb shell input keyevent 82 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version=1.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 続き | |
REPOSITORY="[email protected]:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git" | |
git config --global user.name "CircleCI" | |
git config --global user.email "[email protected]" | |
git add ./README.md | |
git commit -m "update version [ci skip]" | |
git tag -a $VERSION -m "version $VERSION" | |
git push origin master | |
git push origin --tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment