This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
forked from vahidlazio/steps-gradle-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitrise.yml
242 lines (221 loc) · 7.27 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
format_version: "6"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
envs:
# define these here, or in your .bitrise.secrets.yml (if required)
- ANDROID_HOME: $ANDROID_HOME
- ORIG_BITRISE_SOURCE_DIR: $BITRISE_SOURCE_DIR
- BRANCH: master
workflows:
ci:
before_run:
- audit-this-step
- go-tests
after_run:
- test
- test-gradlew-path
- test-multiple-tasks
- test-subdir
- test-no-root-buildfile
- test-apk-split
test:
description: "CI workflow - this should always pass!"
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-sdk22.git
- GRADLE_FILE: ./build.gradle
- GRADLE_TASK: assembleDebug
- GRADLEW_PATH: ./gradlew
- APK_FILE_EXCLUDE_FILTER: "*-unaligned.apk"
- MAPPING_FILE_INCLUDE_FILTER: "*/release/mapping.txt"
after_run:
- _common
test-gradlew-path:
description: "CI workflow - this should always pass!"
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-sdk22.git
- GRADLE_FILE: ./build.gradle
- GRADLE_TASK: assembleDebug
- GRADLEW_PATH: gradlew
- APK_FILE_EXCLUDE_FILTER: "*-unaligned.apk"
- MAPPING_FILE_INCLUDE_FILTER: "*/release/mapping.txt"
after_run:
- _common
test-multiple-tasks:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-sdk22.git
- GRADLE_FILE: ./build.gradle
- GRADLE_TASK: assembleDebug assembleRelease
- GRADLEW_PATH: ./gradlew
- APK_FILE_EXCLUDE_FILTER: "*-unaligned.apk"
- MAPPING_FILE_INCLUDE_FILTER: "*/release/mapping.txt"
after_run:
- _common
test-subdir:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-sdk22-subdir.git
- GRADLE_FILE: ./src/build.gradle
- GRADLE_TASK: assembleDebug
- GRADLEW_PATH: ./src/gradlew
- APK_FILE_EXCLUDE_FILTER: "*-unaligned.apk"
- MAPPING_FILE_INCLUDE_FILTER: "*/release/mapping.txt"
after_run:
- _common
test-no-gradlew-error:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/android-sdk22-no-gradlew.git
- GRADLE_FILE: ./build.gradle
- GRADLE_TASK: assembleDebug
- GRADLEW_PATH: ""
- APK_FILE_EXCLUDE_FILTER: "*-unaligned.apk"
- MAPPING_FILE_INCLUDE_FILTER: "*/release/mapping.txt"
after_run:
- _common
test-no-root-buildfile:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/android-empty-library.git
- GRADLE_FILE: ""
- GRADLE_TASK: assembleDebug
- GRADLEW_PATH: "./gradlew"
- APK_FILE_EXCLUDE_FILTER: "*-unaligned.apk"
- MAPPING_FILE_INCLUDE_FILTER: "*/release/mapping.txt"
after_run:
- _common
test-apk-split:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-abi-split.git
- GRADLE_FILE: ""
- GRADLE_TASK: assembleDebug
- GRADLEW_PATH: "./gradlew"
- APK_FILE_EXCLUDE_FILTER: "*-unaligned.apk"
- MAPPING_FILE_INCLUDE_FILTER: "*/release/mapping.txt"
after_run:
- _common
_common:
steps:
- script:
title: recreate _tmp directory
inputs:
- content: rm -rf "$ORIG_BITRISE_SOURCE_DIR/_tmp" && mkdir "$ORIG_BITRISE_SOURCE_DIR/_tmp"
- change-workdir:
title: Switch working dir to _tmp dir
description: |-
To prevent step testing issues, like referencing relative
files with just './some-file', which would work for local tests
but not if the step is included in another bitrise.yml!
run_if: true
inputs:
- path: "$ORIG_BITRISE_SOURCE_DIR/_tmp"
- script:
inputs:
- content: |-
#!/usr/bin/env bash
if [[ -z "${SAMPLE_APP_URL}" ]]; then
echo "error: there is no SAMPLE_APP_URL env var specified"
exit 1
elif [[ -z "${COMMIT}" && -z "${BRANCH}" ]]; then
echo "error: can't checkout: there is no BRANCH or COMMIT env var specified"
exit 1
fi
git init
git remote add origin "${SAMPLE_APP_URL}"
git fetch || exit 1
[[ -n "${COMMIT}" ]] && git checkout "${COMMIT}" || git checkout "${BRANCH}"
- path::./:
inputs:
- gradle_file: $GRADLE_FILE
- gradle_task: $GRADLE_TASK
- gradlew_path: $GRADLEW_PATH
- apk_file_include_filter: $APK_FILE_INCLUDE_FILTER
- apk_file_exclude_filter: $APK_FILE_EXCLUDE_FILTER
- mapping_file_include_filter: $MAPPING_FILE_INCLUDE_FILTER
- mapping_file_exclude_filter: $MAPPING_FILE_EXCLUDE_FILTER
- script:
inputs:
- content: |-
#!/bin/bash
echo "[output] BITRISE_APK_PATH: ${BITRISE_APK_PATH}"
echo "[output] BITRISE_APK_PATH_LIST: ${BITRISE_APK_PATH_LIST}"
echo "[output] BITRISE_MAPPING_PATH: ${BITRISE_MAPPING_PATH}"
echo "[output] BITRISE_CACHE_INCLUDE_PATHS: ${BITRISE_CACHE_INCLUDE_PATHS}"
echo "[output] BITRISE_CACHE_EXCLUDE_PATHS: ${BITRISE_CACHE_EXCLUDE_PATHS}"
set -x
ls -alh "$BITRISE_DEPLOY_DIR"
go-tests:
before_run:
- _install-test-tools
steps:
- script:
title: Export go files to test
inputs:
- content: |-
#!/bin/bash
set -ex
no_vendor_paths="$(go list ./... | grep -v vendor)"
envman add --key GOLIST_WITHOUT_VENDOR --value "$no_vendor_paths"
- script:
title: Err check
inputs:
- content: |-
#!/bin/bash
set -ex
errcheck -asserts=true -blank=true $GOLIST_WITHOUT_VENDOR
- script:
title: Go lint
inputs:
- content: |-
#!/bin/bash
set -ex
while read -r line; do
echo "-> Linting: $line"
golint_out="$(golint $line)"
if [[ "${golint_out}" != "" ]] ; then
echo "=> Golint issues found:"
echo "${golint_out}"
exit 1
fi
done <<< "$GOLIST_WITHOUT_VENDOR"
- script:
title: Go test
inputs:
- content: |-
#!/bin/bash
set -ex
go test ./...
_install-test-tools:
steps:
- script:
title: Install required testing tools
inputs:
- content: |-
#!/bin/bash
set -ex
# Check for unhandled errors
go get -u -v github.com/kisielk/errcheck
# Go lint
go get -u -v github.com/golang/lint/golint
# ----------------------------------------------------------------
# --- Utility workflows
dep-update:
title: Dep update
description: |
Used for updating bitrise dependencies with dep
steps:
- script:
title: Dependency update
inputs:
- content: |-
#!/bin/bash
set -ex
go get -u -v github.com/golang/dep/cmd/dep
dep ensure -v
dep ensure -v -update
# ----------------------------------------------------------------
# --- workflows to Share this step into a Step Library
audit-this-step:
steps:
- script:
inputs:
- content: |-
#!/bin/bash
set -ex
stepman audit --step-yml ./step.yml