-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
383 lines (342 loc) · 8.98 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
services:
- docker:dind
stages:
- test
- build
- package
- release
include:
template: Dependency-Scanning.gitlab-ci.yml
variables:
# Rust (core)
CARGO_HOME: $CI_PROJECT_DIR/cargo_home
RUST_ENV: test
RUST_VERSION: nightly-2019-10-13
RUST_BACKTRACE: 1
RUST_IMAGE: rust:latest
# mobile
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.2"
ANDROID_SDK_TOOLS: "4333796"
FLUTTER_VERSION: "https://storage.googleapis.com/flutter_infra/releases/dev/linux/flutter_linux_v1.10.14-dev.tar.xz"
# desktop
NODE_ENV: test
NODE_VERSION: lts
# server
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_HOST: postgres
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres?sslmode=disable
HOST: http://localhost:8000
AWS_SECRET_ACCESS_KEY: test
AWS_ACCESS_KEY_ID: test
AWS_REGION: test
S3_BUCKET: test
S3_BASE_URL: test
SENTRY_SERVER_URL: test
SENTRY_WEBAPP_URL: test
SMTP_HOST: test
SMTP_USERNAME: test
SMTP_PASSWORD: test
STRIPE_PUBLIC_KEY: test
STRIPE_SECRET_KEY: test
# blog
ZOLA_VERSION: "v0.9.0"
cache:
paths:
- cargo_home/
- core/target/
- desktop/node_modules/
- website/node_modules/
- server/target/
####################################################################################################
## Test
####################################################################################################
test:core:
stage: test
image: 'rust:stretch'
tags:
- docker
script:
- apt update && apt install -y gcc make git libsodium-dev libc6-dev
- rustup default $RUST_VERSION
- rustup component add rustfmt clippy
- cd core
- make fmt_check
- make lint
- make test
test:mobile:
stage: test
image: openjdk:8-jdk
tags:
- docker
script:
- cd mobile
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 build-essential
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
# flutter sdk setup
- cd $HOME && wget --output-document=flutter-sdk.tar.xz $FLUTTER_VERSION
&& tar -xf flutter-sdk.tar.xz && export PATH=$PATH:$HOME/flutter/bin
&& cd -
- echo flutter.sdk=$HOME/flutter > android/local.properties
- flutter config --no-analytics
- make assets
- make fmt_check
- make lint
- make test
test:desktop:
stage: test
image: node:$NODE_VERSION
tags:
- docker
script:
- cd desktop
- make assets
- make install
#- make test
- make lint
test:server:
stage: test
image: $RUST_IMAGE
tags:
- docker
script:
- cd server
- apt update && apt install -y gcc make git
- rustup default $RUST_VERSION
- rustup component add rustfmt clippy
- cp bloom.default.sane bloom.sane
- make assets
- make fmt_check
- make lint
- make test
services:
- postgres:11
####################################################################################################
## Build
####################################################################################################
# TODO
build:core:
stage: build
image: 'rust:stretch'
tags:
- docker
script:
- apt update && apt install -y gcc make git libsodium-dev libc6-dev
- rustup default $RUST_VERSION
- cd core
- make build
# build:desktop: Commented because we need to implement the native addon build
# stage: build
# image: node:$NODE_VERSION
# tags:
# - docker
# script:
# - cd desktop
# - make assets
# - make install
# - make build
build:mobile:
stage: build
image: openjdk:8-jdk
tags:
- docker
script:
- cd mobile
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 build-essential
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
# flutter sdk setup
- cd $HOME && wget --output-document=flutter-sdk.tar.xz $FLUTTER_VERSION
&& tar -xf flutter-sdk.tar.xz && export PATH=$PATH:$HOME/flutter/bin
&& cd -
- echo flutter.sdk=$HOME/flutter > android/local.properties
- flutter config --no-analytics
- make assets
- make build
build:server:
stage: build
image: $RUST_IMAGE
tags:
- docker
script:
- cd server
- apt update && apt install -y gcc make git
- rustup default $RUST_VERSION
- make assets
- make build
artifacts:
paths:
- server/dist
build:the_guide:
stage: build
image: python:alpine
tags:
- docker
script:
- cd the_guide
- apk add --update make
- pip install mkdocs pymdown-extensions
- make assets
- make build
####################################################################################################
## Package
####################################################################################################
package:server:
stage: package
dependencies:
- build:server
image: docker:stable
tags:
- docker
cache: {}
script:
- cd server
- apk update && apk add make
- make docker_build
####################################################################################################
## Release
####################################################################################################
pages: # release:blog
image: debian:stretch
stage: release
script:
- cd blog
- apt update && apt install curl make -y
- curl -L https://github.com/getzola/zola/releases/download/$ZOLA_VERSION/zola-$ZOLA_VERSION-x86_64-unknown-linux-gnu.tar.gz > zola.tar.gz
- tar -xzf zola.tar.gz
- ./zola build
- mv public/ ..
artifacts:
paths:
- public/
release:status_page:
image: docker:stable
stage: release
tags:
- docker
only:
- /^status_page-v.*$/
except:
- branches
script:
- cd status_page/
- apk update && apk add make
- make build
- make docker_login
- make release
# pages: # release:website
# image: node:lts
# stage: release
# tags:
# - docker
# only:
# - /^website-v.*$/
# except:
# - branches
# script:
# - cd website/
# - make install
# - make build
# - mv dist public
# artifacts:
# paths:
# - website/public
release:server:nightly:
only:
- schedules
stage: release
dependencies:
- build:server
image: docker:stable
tags:
- docker
cache: {}
script:
- cd server
- apk update && apk add make
- make docker_build
- make docker_login
- make docker_release_nightly
release:server:stable:
# only:
# - tags
only:
- /^server-v.*$/
except:
- branches
stage: release
dependencies:
- build:server
image: docker:stable
tags:
- docker
cache: {}
script:
- cd server
- apk update && apk add make
- make docker_build
- make docker_login
- make docker_release
# release the_guide
# pages:
# stage: release
# only:
# - master
# script:
# - make build
# - mv dist public
# artifacts:
# paths:
# - public
# variables:
# CARGO_HOME: $CI_PROJECT_DIR/cargo_home
# default:
# image: rust:latest
# before_script:
# - export PATH="$PATH:$CARGO_HOME/bin"
# - mdbook --version || cargo install --debug mdbook
# cache:
# paths:
# - $CARGO_HOME/bin
# test:android:
# stage: test
# script:
# - cd android
# - ./gradlew -Pci --console=plain :app:testDebug
# build:apk:
# stage: build
# script:
# - flutter build apk
# artifacts:
# paths:
# - build/app/outputs/apk
# build:bundle:
# stage: build
# script:
# - flutter build appbundle
# artifacts:
# paths:
# - build/app/outputs/bundle