Permalink
Fetching contributors…
Cannot retrieve contributors at this time
179 lines (175 sloc) 5.42 KB
---
format_version: '3'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
workflows:
run-test-docker:
steps:
- activate-ssh-key@3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@3.5.1: {}
- script@1.1.4:
title: run test use docker
inputs:
- content: |-
rm -rf local.properties
docker run --rm \
-v $BITRISE_SOURCE_DIR:$DOCKER_HOME \
-w $DOCKER_HOME \
-e BITRISE_IO=true \
-e GIT_REPOSITORY_URL=$GIT_REPOSITORY_URL \
-e BITRISE_PULL_REQUEST=$BITRISE_PULL_REQUEST \
$DOCKERHUB_IMG_ID bash -c \
"
# bundle install
# bundle exec danger
./gradlew :multilinedivider:testDebug -PdisablePreDex
"
before_run:
- docker-build
after_run:
- cache-push
run-test-docker-use-cache:
steps:
- activate-ssh-key@3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@3.5.1: {}
- script@1.1.4:
title: run test use docker
inputs:
- content: |-
rm -rf local.properties
docker run --rm \
-v $BITRISE_SOURCE_DIR:$DOCKER_HOME \
-w $DOCKER_HOME \
-e GRADLE_USER_HOME=$DOCKER_HOME/.gradle \
-e BITRISE_IO=true \
-e GIT_REPOSITORY_URL=$GIT_REPOSITORY_URL \
-e BITRISE_PULL_REQUEST=$BITRISE_PULL_REQUEST \
$DOCKERHUB_IMG_ID bash -c \
"
# bundle install
# bundle exec danger
./gradlew :multilinedivider:testDebug -PdisablePreDex
"
before_run:
- docker-build-with-cache
after_run:
- cache-push-with-docker
run-test:
steps:
- activate-ssh-key@3.1.1:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@3.5.1: {}
- cache-pull@1.0.0: {}
- script@1.1.4:
title: run danger
inputs:
- content: |-
# bundle install
# bundle exec danger
- script@1.1.4:
inputs:
- content: |-
./gradlew :multilinedivider:testDebug -PdisablePreDex
after_run:
- cache-push
local-run-test-docker:
steps:
- script@1.1.4:
title: local run test use docker
inputs:
- content: |-
rm -rf local.properties
docker run --rm \
-v $BITRISE_SOURCE_DIR:$DOCKER_HOME \
-w $DOCKER_HOME \
-e GRADLE_USER_HOME=$DOCKER_HOME/.gradle \
-e BITRISE_IO=true \
-e GIT_REPOSITORY_URL=$GIT_REPOSITORY_URL \
-e BITRISE_PULL_REQUEST=$BITRISE_PULL_REQUEST \
-e DANGER_GITHUB_API_TOKEN=$DANGER_GITHUB_API_TOKEN \
$DOCKERHUB_IMG_ID bash -c \
"
bundle install
bundle exec danger local
./gradlew :multilinedivider:testDebug -PdisablePreDex
"
before_run:
- docker-build
envs:
- BITRISE_PULL_REQUEST: 18
- GIT_REPOSITORY_URL: git@github.com:sakebook/MultiLineDivider.git
docker-build-with-cache:
steps:
- cache-pull@1.0.0: {}
- script@1.1.4:
title: docker login or pull use cache
inputs:
- content: |-
if [ -e $BITRISE_CACHE_DIR/$DOCKER_CACHE_IMG ]; then
echo "Exist cache"
docker load < $BITRISE_CACHE_DIR/$DOCKER_CACHE_IMG
else
echo "Cache is not found"
docker login -u $USERNAME -p $PASSWORD
docker pull $DOCKERHUB_IMG_ID
fi
docker-build:
steps:
- cache-pull@1.0.0: {}
- script@1.1.4:
title: docker login & pull
inputs:
- content: |-
docker login -u $USERNAME -p $PASSWORD
docker pull $DOCKERHUB_IMG_ID
cache-push:
steps:
- cache-push@1.1.3:
inputs:
- cache_paths: |-
$BITRISE_SOURCE_DIR/.gradle
$BITRISE_SOURCE_DIR/.m2
$HOME/.gradle
$HOME/.m2
- ignore_check_on_paths: |-
$HOME/.gradle/caches/*.lock
$HOME/.gradle/*.bin
$BITRISE_SOURCE_DIR/.gradle/*.lock
$BITRISE_SOURCE_DIR./.gradle/*.bin
cache-push-with-docker:
steps:
- script@1.1.4:
title: docker image save
inputs:
- content: |-
docker save $DOCKERHUB_IMG_ID > $BITRISE_CACHE_DIR/$DOCKER_CACHE_IMG
- cache-push@1.1.3:
inputs:
- cache_paths: |-
$BITRISE_SOURCE_DIR/.gradle
$BITRISE_SOURCE_DIR/.m2
$BITRISE_CACHE_DIR
$HOME/.gradle
- ignore_check_on_paths: |-
$HOME/.gradle/caches/*.lock
$HOME/.gradle/*.bin
$BITRISE_SOURCE_DIR/.gradle/*.lock
$BITRISE_SOURCE_DIR./.gradle/*.bin
app:
envs:
- GRADLEW_PATH: "./gradlew"
- GRADLE_BUILD_FILE_PATH: build.gradle
- DOCKER_HOME: "/root"
- DOCKER_IMG_NAME: docker-android-alpine
- DOCKER_IMG_TAG: 25.0.3_3
- DOCKERHUB_IMG_ID: sakebook/$DOCKER_IMG_NAME:$DOCKER_IMG_TAG
- DOCKER_CACHE_IMG: $DOCKER_IMG_NAME-$DOCKER_IMG_TAG.tar
# for local bitrise cli
- BITRISE_CACHE_DIR: $BITRISE_SOURCE_DIR
trigger_map:
- push_branch: "*"
workflow: run-test-docker
- pull_request_source_branch: "*"
workflow: run-test