-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
246 lines (234 loc) · 6.73 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
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
243
244
245
246
stages:
# - linter
- test
- deploy
- show
variables:
DOCKER_IMAGE_NAME: "registry.docker.ppl.cs.ui.ac.id/ppld1"
APP_NAME: "scrum-booster"
#FlutterLint:
# stage: linter
# image: jro7/flutter_lcov
# script:
# - flutter analyze
# except:
# changes:
# - scrum-booster-api/**/*
FlutterTest:
stage: test
image: jro7/flutter_lcov
script:
- echo Testing $APP_NAME
- flutter doctor -v
- flutter test --coverage
- lcov --summary coverage/lcov.info
- genhtml coverage/lcov.info --output=coverage
coverage: '/lines......: \d+\.\d+\%/'
artifacts:
name: mobile-coverage
paths:
- $CI_PROJECT_DIR/coverage
BackendTest:
stage: test
image: python:3.6
only:
changes:
- scrum-booster-api/**/*
before_script:
- cd scrum-booster-api
- pip install -r requirements.txt
- python manage.py makemigrations
- python manage.py migrate
- python manage.py collectstatic --no-input
- python manage.py runserver 8000 &
when: on_success
script:
- coverage run manage.py test
- coverage report -m
BackendDeployToProduction:
variables:
ENV_NAME: "production"
stage: deploy
image: gitlab/dind:latest
only:
changes:
- scrum-booster-api/**/*
refs:
- master
before_script:
- docker info
script:
- DOCKER_IMAGE_TAG=$DOCKER_IMAGE_NAME/scrumboosterapi/$ENV_NAME
- docker build -t $DOCKER_IMAGE_TAG ./scrum-booster-api
- docker push $DOCKER_IMAGE_TAG
tags:
- docker
- build
environment:
name: production
BackendDeployToStaging:
variables:
ENV_NAME: "staging"
stage: deploy
image: gitlab/dind:latest
only:
changes:
- scrum-booster-api/**/*
refs:
- staging
before_script:
- docker info
script:
- DOCKER_IMAGE_TAG=$DOCKER_IMAGE_NAME/scrumboosterapi/$ENV_NAME
- docker build -t $DOCKER_IMAGE_TAG ./scrum-booster-api
- docker push $DOCKER_IMAGE_TAG
tags:
- docker
- build
environment:
name: staging
BackendDeployToDevelopment:
variables:
ENV_NAME: "development"
stage: deploy
image: gitlab/dind:latest
only:
changes:
- scrum-booster-api/**/*
refs:
- /^US-.*$/
before_script:
- docker info
script:
- DOCKER_IMAGE_TAG=$DOCKER_IMAGE_NAME/scrumboosterapi/$ENV_NAME
- docker build -t $DOCKER_IMAGE_TAG ./scrum-booster-api
- docker push $DOCKER_IMAGE_TAG
tags:
- docker
- build
environment:
name: development
FlutterDeployToProduction:
variables:
ENV_NAME: "production"
image: runmymind/docker-android-sdk:latest
stage: deploy
tags:
- docker
- build
only:
refs:
- master
before_script:
- wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz && tar xf flutter.tar.xz -C /
- export PATH=$PATH:/flutter/bin
- apt-get update && apt-get install gnupg -y
- curl -sL https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y nodejs
- flutter doctor -v
- flutter packages get
- npm install --global appcenter-cli
script:
- flutter build apk --release --build-name=$APP_NAME --build-number=1
- appcenter
- appcenter login --token $APP_CENTER_API_KEY
- appcenter distribute release -f build/app/outputs/apk/release/app-release.apk --app $APP_CENTER_APP_NAME_PROD --group $APP_CENTER_GROUP_TARGET
environment:
name: production
FlutterDeployToStaging:
variables:
ENV_NAME: "staging"
image: runmymind/docker-android-sdk:latest
stage: deploy
tags:
- docker
- build
only:
refs:
- staging
before_script:
- wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz && tar xf flutter.tar.xz -C /
- export PATH=$PATH:/flutter/bin
- apt-get update && apt-get install gnupg -y
- curl -sL https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y nodejs
- flutter doctor -v
- flutter packages get
- npm install --global appcenter-cli
script:
- flutter build apk --release --build-name=$APP_NAME-$ENV_NAME --build-number=1
- appcenter
- appcenter login --token $APP_CENTER_API_KEY
- appcenter distribute release -f build/app/outputs/apk/release/app-release.apk --app $APP_CENTER_APP_NAME_STAGING --group $APP_CENTER_GROUP_TARGET
environment:
name: staging
FlutterDeployToDevelopment:
variables:
ENV_NAME: "development"
image: runmymind/docker-android-sdk:latest
stage: deploy
tags:
- docker
- build
only:
refs:
- /^US-.*$/
except:
changes:
- scrum-booster-api/**/*
before_script:
- wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz && tar xf flutter.tar.xz -C /
- export PATH=$PATH:/flutter/bin
- apt-get update && apt-get install gnupg -y
- curl -sL https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y nodejs
- flutter doctor -v
- flutter packages get
- npm install --global appcenter-cli
script:
- flutter build apk --release --build-name=$APP_NAME-$ENV_NAME --build-number=1
- appcenter
- appcenter login --token $APP_CENTER_API_KEY
- appcenter distribute release -f build/app/outputs/apk/release/app-release.apk --app $APP_CENTER_APP_NAME_DEV --group $APP_CENTER_GROUP_TARGET
environment:
name: development
FlutterDeployToColdfix:
variables:
ENV_NAME: "coldfix"
image: runmymind/docker-android-sdk:latest
stage: deploy
tags:
- docker
- build
only:
refs:
- /^coldfix-.*$/
except:
changes:
- scrum-booster-api/**/*
before_script:
- wget --quiet --output-document=flutter.tar.xz https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz && tar xf flutter.tar.xz -C /
- export PATH=$PATH:/flutter/bin
- apt-get update && apt-get install gnupg -y
- curl -sL https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y nodejs
- flutter doctor -v
- flutter packages get
- npm install --global appcenter-cli
script:
- flutter build apk --release --build-name=$APP_NAME-$ENV_NAME --build-number=1
- appcenter
- appcenter login --token $APP_CENTER_API_KEY
- appcenter distribute release -f build/app/outputs/apk/release/app-release.apk --app $APP_CENTER_APP_NAME_COLDFIX --group $APP_CENTER_GROUP_TARGET
environment:
name: coldfix
FlutterShowCoverage:
image: alpine
stage: show
dependencies:
- FlutterTest
script:
- mkdir -p mobile-coverage/
- mv coverage/* mobile-coverage/
artifacts:
paths:
- $CI_PROJECT_DIR/mobile-coverage/
except:
changes:
- scrum-booster-api/**/*