-
Notifications
You must be signed in to change notification settings - Fork 2
/
bitrise.yml
178 lines (175 loc) · 5.42 KB
/
bitrise.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
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