-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
203 lines (184 loc) · 9.44 KB
/
.gitlab-ci.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
image: azabost/android-sdk-28:latest
stages:
- build
- quality
- package
before_script:
- export ANDROID_HOME="/home/gitlab-runner/android-sdk"
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export ANDROID_APK_PATH=$PWD/app/build/outputs/apk
#### BUILD ####
.build_template: &build_template_def
stage: build
artifacts:
expire_in: 2 weeks
paths:
- app/build/outputs/
- .android/
build_onprogress:
<<: *build_template_def
stage: build
only:
- schedules
- web
except:
- develop
- master
script:
- echo "org.gradle.jvmargs=-Xmx1536m" >> gradle.properties
- echo "SYMBOLIC_REDIRECT_URI=$SYMBOLIC_REDIRECT_URI_STAG" >> gradle.properties
- echo "PANTAU_BASE_URL=$PANTAU_BASE_URL_STAG" >> gradle.properties
- echo "PANTAU_BASE_URL_NO_SCHEME=$PANTAU_BASE_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "PANTAU_OAUTH_URL=$PANTAU_OAUTH_URL_STAG" >> gradle.properties
- echo "WORD_STADIUM_BASE_URL=$WORD_STADIUM_BASE_URL_STAG" >> gradle.properties
- echo "SYMBOLIC_URL=$SYMBOLIC_URL_STAG" >> gradle.properties
- echo "SYMBOLIC_URL_NO_SCHEME=$SYMBOLIC_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "SYMBOLIC_CLIENT_ID=$SYMBOLIC_CLIENT_ID_STAG" >> gradle.properties
- echo "SYMBOLIC_CLIENT_SECRET=$SYMBOLIC_CLIENT_SECRET_STAG" >> gradle.properties
- echo "FACEBOOK_APP_ID=$FACEBOOK_APP_ID_STAG" >> gradle.properties
- echo "FACEBOOK_LOGIN_PROTOCOL_SCHEME=$FACEBOOK_LOGIN_PROTOCOL_SCHEME_STAG" >> gradle.properties
- echo "TWITTER_API_KEY=$TWITTER_API_KEY_STAG" >> gradle.properties
- echo "TWITTER_SECRET=$TWITTER_SECRET_STAG" >> gradle.properties
- echo "PANTAU_CLIENT_ID=$PANTAU_CLIENT_ID_STAG" >> gradle.properties
- echo "PANTAU_CLIENT_SECRET=$PANTAU_CLIENT_SECRET_STAG" >> gradle.properties
- echo "PANTAU_WEB_URL=$PANTAU_WEB_URL_STAG" >> gradle.properties
- echo "PANTAU_WEB_URL_NO_SCHEME=$PANTAU_WEB_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "android.useAndroidX=true" >> gradle.properties
- echo "android.enableJetifier=true" >> gradle.properties
- ./gradlew assembleStagingDebug
build_staging:
<<: *build_template_def
stage: build
only:
- develop
# - schedules
- web
except:
- onprogress
- master
script:
- echo "org.gradle.jvmargs=-Xmx1536m" >> gradle.properties
- echo "SYMBOLIC_REDIRECT_URI=$SYMBOLIC_REDIRECT_URI_STAG" >> gradle.properties
- echo "PANTAU_BASE_URL=$PANTAU_BASE_URL_STAG" >> gradle.properties
- echo "PANTAU_BASE_URL_NO_SCHEME=$PANTAU_BASE_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "PANTAU_OAUTH_URL=$PANTAU_OAUTH_URL_STAG" >> gradle.properties
- echo "WORD_STADIUM_BASE_URL=$WORD_STADIUM_BASE_URL_STAG" >> gradle.properties
- echo "SYMBOLIC_URL=$SYMBOLIC_URL_STAG" >> gradle.properties
- echo "SYMBOLIC_URL_NO_SCHEME=$SYMBOLIC_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "SYMBOLIC_CLIENT_ID=$SYMBOLIC_CLIENT_ID_STAG" >> gradle.properties
- echo "SYMBOLIC_CLIENT_SECRET=$SYMBOLIC_CLIENT_SECRET_STAG" >> gradle.properties
- echo "FACEBOOK_APP_ID=$FACEBOOK_APP_ID_STAG" >> gradle.properties
- echo "FACEBOOK_LOGIN_PROTOCOL_SCHEME=$FACEBOOK_LOGIN_PROTOCOL_SCHEME_STAG" >> gradle.properties
- echo "TWITTER_API_KEY=$TWITTER_API_KEY_STAG" >> gradle.properties
- echo "TWITTER_SECRET=$TWITTER_SECRET_STAG" >> gradle.properties
- echo "PANTAU_CLIENT_ID=$PANTAU_CLIENT_ID_STAG" >> gradle.properties
- echo "PANTAU_CLIENT_SECRET=$PANTAU_CLIENT_SECRET_STAG" >> gradle.properties
- echo "PANTAU_WEB_URL=$PANTAU_WEB_URL_STAG" >> gradle.properties
- echo "PANTAU_WEB_URL_NO_SCHEME=$PANTAU_WEB_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "android.useAndroidX=true" >> gradle.properties
- echo "android.enableJetifier=true" >> gradle.properties
- ./gradlew assembleStagingDebug
build_release:
<<: *build_template_def
stage: build
only:
# - master
# - schedules
- web
except:
- onprogress
- develop
script:
- echo "org.gradle.jvmargs=-Xmx1536m" >> gradle.properties
- echo "SYMBOLIC_REDIRECT_URI=$SYMBOLIC_REDIRECT_URI_PROD" >> gradle.properties
- echo "PANTAU_BASE_URL=$PANTAU_BASE_URL_PROD" >> gradle.properties
- echo "PANTAU_BASE_URL_NO_SCHEME=$PANTAU_BASE_URL_NO_SCHEME_PROD" >> gradle.properties
- echo "PANTAU_OAUTH_URL=$PANTAU_OAUTH_URL_PROD" >> gradle.properties
- echo "WORD_STADIUM_BASE_URL=$WORD_STADIUM_BASE_URL_PROD" >> gradle.properties
- echo "SYMBOLIC_URL=$SYMBOLIC_URL_PROD" >> gradle.properties
- echo "SYMBOLIC_URL_NO_SCHEME=$SYMBOLIC_URL_NO_SCHEME_PROD" >> gradle.properties
- echo "SYMBOLIC_CLIENT_ID=$SYMBOLIC_CLIENT_ID_PROD" >> gradle.properties
- echo "SYMBOLIC_CLIENT_SECRET=$SYMBOLIC_CLIENT_SECRET_PROD" >> gradle.properties
- echo "FACEBOOK_APP_ID=$FACEBOOK_APP_ID_PROD" >> gradle.properties
- echo "FACEBOOK_LOGIN_PROTOCOL_SCHEME=$FACEBOOK_LOGIN_PROTOCOL_SCHEME_PROD" >> gradle.properties
- echo "TWITTER_API_KEY=$TWITTER_API_KEY_PROD" >> gradle.properties
- echo "TWITTER_SECRET=$TWITTER_SECRET_PROD" >> gradle.properties
- echo "PANTAU_CLIENT_ID=$PANTAU_CLIENT_ID_PROD" >> gradle.properties
- echo "PANTAU_CLIENT_SECRET=$PANTAU_CLIENT_SECRET_PROD" >> gradle.properties
- echo "PANTAU_WEB_URL=$PANTAU_WEB_URL_PROD" >> gradle.properties
- echo "PANTAU_WEB_URL_NO_SCHEME=$PANTAU_WEB_URL_NO_SCHEME_PROD" >> gradle.properties
- echo "android.useAndroidX=true" >> gradle.properties
- echo "android.enableJetifier=true" >> gradle.properties
- ./gradlew assembleProductionRelease
#### QUALITY ####
quality_check:
stage: quality
only:
# - master
- develop
script:
- echo "org.gradle.jvmargs=-Xmx1536m" >> gradle.properties
- echo "SYMBOLIC_REDIRECT_URI=$SYMBOLIC_REDIRECT_URI_STAG" >> gradle.properties
- echo "PANTAU_BASE_URL=$PANTAU_BASE_URL_STAG" >> gradle.properties
- echo "PANTAU_BASE_URL_NO_SCHEME=$PANTAU_BASE_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "PANTAU_OAUTH_URL=$PANTAU_OAUTH_URL_STAG" >> gradle.properties
- echo "WORD_STADIUM_BASE_URL=$WORD_STADIUM_BASE_URL_STAG" >> gradle.properties
- echo "SYMBOLIC_URL=$SYMBOLIC_URL_STAG" >> gradle.properties
- echo "SYMBOLIC_URL_NO_SCHEME=$SYMBOLIC_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "SYMBOLIC_CLIENT_ID=$SYMBOLIC_CLIENT_ID_STAG" >> gradle.properties
- echo "SYMBOLIC_CLIENT_SECRET=$SYMBOLIC_CLIENT_SECRET_STAG" >> gradle.properties
- echo "FACEBOOK_APP_ID=$FACEBOOK_APP_ID_STAG" >> gradle.properties
- echo "FACEBOOK_LOGIN_PROTOCOL_SCHEME=$FACEBOOK_LOGIN_PROTOCOL_SCHEME_STAG" >> gradle.properties
- echo "TWITTER_API_KEY=$TWITTER_API_KEY_STAG" >> gradle.properties
- echo "TWITTER_SECRET=$TWITTER_SECRET_STAG" >> gradle.properties
- echo "PANTAU_CLIENT_ID=$PANTAU_CLIENT_ID_STAG" >> gradle.properties
- echo "PANTAU_CLIENT_SECRET=$PANTAU_CLIENT_SECRET_STAG" >> gradle.properties
- echo "PANTAU_WEB_URL=$PANTAU_WEB_URL_STAG" >> gradle.properties
- echo "PANTAU_WEB_URL_NO_SCHEME=$PANTAU_WEB_URL_NO_SCHEME_STAG" >> gradle.properties
- echo "android.useAndroidX=true" >> gradle.properties
- echo "android.enableJetifier=true" >> gradle.properties
- ./gradlew ktlint
artifacts:
name: "reports_${CI_PROJECT_NAME}_${CI_BUILD_REF_NAME}"
when: on_failure
expire_in: 4 days
paths:
- app/build/reports/
#### PACKAGE ####
.package_template: &package_template_def
before_script:
- mkdir -p deliverables
- touch ./deliverables/info.txt
- echo "Build date $(date)" >> ./deliverables/info.txt
- echo "Git branch ${CI_COMMIT_REF_NAME}" >> ./deliverables/info.txt
- echo "Git commit ${CI_COMMIT_SHA}" >> ./deliverables/info.txt
- echo "Gitlab pipeline ${CI_PIPELINE_ID}" >> ./deliverables/info.txt
- export ANDROID_APK_PATH=$PWD/app/build/outputs/apk
package_onprogress:
<<: *package_template_def
stage: package
environment: Development
only:
- schedules
- web
script:
- mv $ANDROID_APK_PATH/staging/debug/app-staging-debug*.apk $ANDROID_APK_PATH/staging/debug/app-onprogress-${CI_COMMIT_SHA}.apk
- curl -F file=@$ANDROID_APK_PATH/staging/debug/app-onprogress-${CI_COMMIT_SHA}.apk -F channels=$SLACK_CHANNEL_ANDROID -F token=$SLACK_TOKEN https://slack.com/api/files.upload
package_staging:
<<: *package_template_def
stage: package
environment: Development
only:
- develop
script:
- mv $ANDROID_APK_PATH/staging/debug/app-staging-debug*.apk $ANDROID_APK_PATH/staging/debug/app-staging-${CI_COMMIT_SHA}.apk
- curl -F file=@$ANDROID_APK_PATH/staging/debug/app-staging-${CI_COMMIT_SHA}.apk -F channels=$SLACK_CHANNEL_ANDROID -F token=$SLACK_TOKEN https://slack.com/api/files.upload
#package_release:
# <<: *package_template_def
# stage: package
# environment: Release
# only:
## - master
# script:
# - mv $ANDROID_APK_PATH/production/release/app-production-release*.apk $ANDROID_APK_PATH/production/release/app-production-${CI_COMMIT_SHA}.apk
# - curl -F file=@$ANDROID_APK_PATH/production/release/app-production-${CI_COMMIT_SHA}.apk -F channels=$SLACK_CHANNEL_ANDROID -F token=$SLACK_TOKEN https://slack.com/api/files.upload