forked from bitrise-steplib/steps-google-play-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitrise.yml
175 lines (158 loc) · 5.21 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
format_version: "2"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-realmtasks.git
- BRANCH: master
- GRADLE_TASK: assembleRelease
- GRADLEW_PATH: "./gradlew"
- PACKAGE_NAME: "io.bitrise.realmtasks"
# define these in your .bitrise.secrets.yml
- SERVICE_ACCOUNT_JSON_KEY_PATH: $SERVICE_ACCOUNT_JSON_KEY_PATH
- VERSION_CODE: "$VERSION_CODE"
- TRACK: $TRACK
- BITRISEIO_GOOGLE_SERVICES_JSON_URL: $BITRISEIO_GOOGLE_SERVICES_JSON_URL
- BITRISEIO_ANDROID_KEYSTORE_URL: $BITRISEIO_ANDROID_KEYSTORE_URL
- BITRISEIO_ANDROID_KEYSTORE_PASSWORD: $BITRISEIO_ANDROID_KEYSTORE_PASSWORD
- BITRISEIO_ANDROID_KEYSTORE_ALIAS: $BITRISEIO_ANDROID_KEYSTORE_ALIAS
- BITRISEIO_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD: $BITRISEIO_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD
workflows:
test:
before_run:
- audit-this-step
- go-tests
steps:
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
rm -rf ./_tmp
if [ ! -d "$ANDROID_HOME/ndk-bundle/toolchains/mips64el-linux-android-4.9" ]
then
curl "https://dl.google.com/android/repository/android-ndk-r16b-darwin-x86_64.zip" -o /tmp/ndk.zip
rm -rf $ANDROID_HOME/ndk-bundle
unzip -q /tmp/ndk.zip -d $ANDROID_HOME/
mv $ANDROID_HOME/android-ndk-r16b $ANDROID_HOME/ndk-bundle
rm -rf /tmp/ndk.zip
envman add --key "ANDROID_NDK_HOME" --value "$ANDROID_HOME/ndk-bundle"
fi
- change-workdir:
title: Switch working dir to test/_tmp dir
run_if: true
inputs:
- path: ./_tmp
- is_create_path: true
- 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}"
- install-missing-android-tools:
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
curl -o "./app/google-services.json" "$BITRISEIO_GOOGLE_SERVICES_JSON_URL"
- change-android-versioncode-and-versionname:
inputs:
- build_gradle_path: "./app/build.gradle"
- new_version_code: $VERSION_CODE
- gradle-runner:
inputs:
- gradle_task: "$GRADLE_TASK"
- gradlew_path: "$GRADLEW_PATH"
- sign-apk:
inputs:
- apk_path: $BITRISE_APK_PATH_LIST
- path::./:
title: Step Test
inputs:
- service_account_json_key_path: $SERVICE_ACCOUNT_JSON_KEY_PATH
- package_name: $PACKAGE_NAME
- apk_path: $BITRISE_SIGNED_APK_PATH
- track: $TRACK
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: |-
#!/usr/bin/env bash
set -ex
go get -u -v github.com/kisielk/errcheck
go get -u -v github.com/golang/lint/golint
# ----------------------------------------------------------------
# --- Utility workflows
dep-update:
title: Update the locked versions of all dependencies
steps:
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -x
go get -u -v github.com/golang/dep/cmd/dep
dep ensure -update -v
# ----------------------------------------------------------------
# --- workflow 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