forked from aebruno/whisperfish
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
595 lines (556 loc) · 15.9 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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
variables: &variables
SFOS_VERSION: 4.4.0.58
GIT_FETCH_EXTRA_FLAGS: --tags
RUST_BACKTRACE: full
include:
# Awesome OpenRepos script by @nobodyinperson/Yann Büchau
- https://gitlab.com/nobodyinperson/python3-openrepos-webclient/-/raw/master/openrepos-upload-rpm.gitlab-ci.yml
# The MergeRequest-Pipelines template makes your pipelines run for the default branch, tags, and all types of merge request pipelines.
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
- project: "dependabot-gitlab/dependabot-standalone"
file: ".gitlab-ci.yml"
.dependabot-gitlab:
stage: deploy
stages:
- build
- test
- format
- deploy
.rust: &rust
cache: &rust-cache
paths:
- target/
- cargo/bin/
- cargo/registry/index/
- cargo/registry/cache/
- cargo/git/db/
before_script:
- apt-get update
- apt-get install -y --no-install-recommends libsqlcipher-dev qtbase5-dev qtbase5-private-dev qt5-qmake cmake qtdeclarative5-dev qtbase5-dev-tools qttools5-dev-tools protobuf-compiler libdbus-1-dev libqt5opengl5-dev libssl-dev
- cargo --version
- rustc --version
.rust-stable: &rust-stable
<<: *rust
image: rust
cache:
<<: *rust-cache
key:
prefix: rust-stable
files:
- Cargo.lock
.rust-nightly: &rust-nightly
<<: *rust
variables:
QT_SELECT: 5
<<: *variables
image: rustlang/rust:nightly
allow_failure: true
cache:
<<: *rust-cache
key:
prefix: rust-nightly
files:
- Cargo.lock
.build-sailfishos: &build-sailfishos
image: registry.gitlab.com/whisperfish/sailo-rs/rust-$MER_ARCH-$SFOS_VERSION:latest
stage: build
variables:
CARGO_HOME: /home/mersdk/cargo
artifacts:
paths:
- RPMS/*.rpm
# i686 is the "native" target, so we catch them in the `target` dir directly.
- target/release/whisperfish-migration-dry-run
- target/release/fetch-signal-attachment
- target/release/harbour-whisperfish
- target/*/release/whisperfish-migration-dry-run
- target/*/release/fetch-signal-attachment
- target/*/release/harbour-whisperfish
cache:
paths:
- cargo/bin/
- cargo/registry/index/
- cargo/registry/cache/
- cargo/git/db/
key: target-$MER_ARCH
script:
- .ci/build-with-mb2.sh
build:sailfishos:latest:armv7hl:
extends: .build-sailfishos
variables:
<<: *variables
MER_ARCH: armv7hl
TARGET_VERSION: $SFOS_VERSION
DIST: .sf4
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
build:sailfishos:3.4:armv7hl:
extends: .build-sailfishos
variables:
<<: *variables
MER_ARCH: armv7hl
TARGET_VERSION: 3.4.0.24
SFOS_VERSION: 4.1.0.24
DIST: .sf3
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
build:sailfishos:latest:i486:
extends: .build-sailfishos
variables:
<<: *variables
MER_ARCH: i486
TARGET_VERSION: $SFOS_VERSION
DIST: .sf4
cache:
<<: *rust-cache
key: "target-i486-$CI_COMMIT_REF_SLUG"
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
## We don't build 3.4 for i486, because
# in that case, rust 1.52 gets installed without the sb2 passthrough,
# and the 3.4 runtime doesn't provide all necessary dependencies.
# If this bothers someone (I don't think there's any i486 device that doesn't support 4.3;
# check conversation at https://matrix.to/#/!clfpfblSRQUbEUGwsD:rubdos.be/$QANC2ZqJuGElnp2Bkvll_4KLmmSmZUqPgthzzT1KRT0?via=libera.chat&via=matrix.org&via=rubdos.be)
# build:sailfishos:3.4:i486:
# extends: .build-sailfishos
# variables:
# <<: *variables
# MER_ARCH: i486
# TARGET_VERSION: 3.4.0.24
# DIST: .sf3
# rules:
# - if: $CI_PIPELINE_SOURCE == "schedule"
# when: never
# - when: on_success
build:sailfishos:latest:aarch64:
extends: .build-sailfishos
variables:
<<: *variables
MER_ARCH: aarch64
TARGET_VERSION: $SFOS_VERSION
DIST: .sf4
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
build:sailfishos:3.4:aarch64:
extends: .build-sailfishos
variables:
<<: *variables
MER_ARCH: aarch64
TARGET_VERSION: 3.4.0.24
SFOS_VERSION: 4.1.0.24
DIST: .sf3
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
build:host:stable:
<<: *rust-stable
stage: build
script:
- cargo build --features bundled-sqlcipher
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
build:host:nightly:
<<: *rust-nightly
stage: build
needs:
# Run only if stable already succeeded. We don't use the results of this
# job and run it only to test future versions of rust. See the discussion
# in https://gitlab.com/whisperfish/whisperfish/-/merge_requests/202
- build:host:stable
script:
- cargo build --features bundled-sqlcipher
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
build:host:stable:docs:
<<: *rust-stable
stage: build
needs:
- build:host:stable
script:
- cargo doc --no-deps --document-private-items -p harbour-whisperfish -p libsignal-service -p libsignal-protocol -p zkgroup -p whisperfish
artifacts:
paths:
- target/doc
# This job has no large overhead. Thus, we fetch only the cache from the
# build job and don't interfere with later tests jobs.
cache:
<<: *rust-cache
key:
prefix: rust-stable
files:
- Cargo.lock
policy: pull
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
build:host:stable:tarball:
<<: *rust-stable
stage: build
needs:
- build:host:stable
before_script:
- export P="${CI_PROJECT_NAME}-${CI_COMMIT_TAG#v}"
script:
- git archive --prefix="${P}/" -o ${P}.tar ${CI_COMMIT_TAG}
- cargo vendor ${P}/vendor
- tar --append -f ${P}.tar ${P}
- gzip ${P}.tar
after_script:
- echo TGZ_JOB_ID=${CI_JOB_ID} >> build.env
- echo PACKAGE_NAME="${CI_PROJECT_NAME}-${CI_COMMIT_TAG#v}" >> build.env
artifacts:
paths:
- ./*.tar.gz
reports:
dotenv: build.env
cache:
<<: *rust-cache
key:
prefix: rust-stable
files:
- Cargo.lock
policy: pull
only:
- tags
qmllint:
<<: *rust
stage: format
image: rust
cache: {}
script:
- "qmllint qml/**/*.qml"
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
test:stable:
<<: *rust-stable
stage: test
needs:
- build:host:stable
script:
- cargo test --features whisperfish/bundled-sqlcipher
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
test:stable:diesel-schema:
<<: *rust-stable
stage: test
needs:
- build:host:stable
script:
- rustup component add rustfmt
# Diesel is not running a long time/often. We don't need the release
# version here and the debug version is enough. We save a lot of
# compilation time for small overhead when running the binary.
- cargo install -f --debug diesel_cli --version ^2 --features "sqlite-bundled"
- export PATH="$CARGO_HOME/bin:$PATH"
- export DATABASE_URL=test_whisperfish.db
- diesel setup
- diesel migration run
- diesel print-schema > whisperfish-store/src/schema.rs
- cargo fmt -- --check whisperfish-store/src/schema.rs
# Diesel does not need to access build artifacts of other stages.
cache: {}
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
fmt:stable:
<<: *rust-stable
stage: format
needs:
- build:host:stable
# Cargo fmt does not need external packages.
before_script: []
script:
- rustup component add rustfmt
- cargo fmt -- --check
# Cargo fmt does not need to access the cache. With it's own cache, it does
# not interfere with `coverage:stable` and `clippy:stable`. There is nothing
# to store in the cache either.
cache: {}
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
coverage:stable:
<<: *rust-stable
image: xd009642/tarpaulin
stage: format
needs:
- test:stable
variables:
<<: *variables
# Not needed anymore after the Tarpaulin image is on Debian Bullseye
QT_SELECT: qt5
script:
# Add --all-features and --all-targets some time in the future. Tarpaulin
# runs only at linux-x86 and would need the whisperfish sdk to build all
# features.
- cargo tarpaulin --features bundled-sqlcipher -v --exclude-files cargo/* --out Xml
artifacts:
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
reports:
coverage_report:
coverage_format: cobertura
path: cobertura.xml
coverage: '/^\d+.\d+% coverage/'
# Tarpaulin needs its own cache as many more information are stored from
# other crates. In addition, `clippy:stable` can pull/push the cache from
# `test:stable` and the tarpaulin job does not interfere with the clippy
# cache.
cache:
<<: *rust-cache
key:
prefix: rust-stable-tarpaulin
files:
- Cargo.lock
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
clippy:stable:
<<: *rust-stable
stage: format
needs:
- test:stable
script:
- rustup component add clippy
# the following command should be used but needs sailfish SDK
# - cargo clippy --all-targets --all-features -- -D warnings
#
# Two allows are put in globally, because they occur from macro invocations.
# derive_partial_eq_without_eq occurs by prost, and prost suggests to disable the lint globally:
# https://github.com/tokio-rs/prost/issues/661
# useless-transmute
- cargo clippy --all-targets -- -A clippy::derive_partial_eq_without_eq -A clippy::useless_transmute
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
clippy:stable-warnings:
<<: *rust-stable
stage: format
allow_failure: true
needs:
- test:stable
script:
- rustup component add clippy
# the following command should be used but needs sailfish SDK
# - cargo clippy --all-targets --all-features -- -D warnings
#
# For allows, see above
- cargo clippy --all-targets -- -D warnings -A clippy::derive_partial_eq_without_eq -A clippy::useless_transmute
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
.translations: &translations
image: debian
needs: []
before_script:
- apt-get update
- apt-get install --no-install-recommends -y git curl qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qttools5-dev-tools ca-certificates
translations:check:
<<: *translations
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
script:
- .ci/check-translations.sh
translations:update:
<<: *translations
stage: deploy
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
variables:
# Clone with full depth for translation contribution analysis
GIT_STRATEGY: clone
GIT_DEPTH: 0
script:
- .ci/update-translation-contributors.sh
- .ci/update-translations.sh
test:sailfishos:validate-rpms:
stage: test
image: registry.gitlab.com/whisperfish/sailo-rs/rpm-validator:latest
allow_failure: true
dependencies:
- build:sailfishos:latest:armv7hl
- build:sailfishos:latest:aarch64
- build:sailfishos:latest:i486
needs:
- build:sailfishos:latest:armv7hl
- build:sailfishos:latest:aarch64
- build:sailfishos:latest:i486
script:
- for rpm in RPMS/*.rpm; do rpmvalidation.sh $rpm; done
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- when: on_success
notify_matrix_build_ready:
stage: deploy
image: debian
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
environment:
name: Whisperfish Matrix channel
url: $MATRIX_HOME_SERVER
needs:
- build:sailfishos:latest:armv7hl
- build:sailfishos:latest:aarch64
- build:sailfishos:latest:i486
before_script:
- apt-get update
- apt-get install --no-install-recommends -y git curl jq ca-certificates
script:
- .ci/send-matrix-build-notification.sh
pages:
dependencies:
- build:host:stable:docs
needs:
- build:host:stable:docs
stage: deploy
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
script:
- mkdir -p public
- mv target/doc public/
artifacts:
paths:
- public
.deploy:openrepos: &deploy-openrepos
stage: deploy
extends: .openrepos-upload-rpm
variables: &openrepos-vars
OPENREPOS_UPLOAD_RPM_PLATFORM: SailfishOS
OPENREPOS_UPLOAD_RPM_CATEGORY: Applications
needs: &openrepos-needs
- build:sailfishos:latest:armv7hl
- build:sailfishos:latest:i486
- build:sailfishos:latest:aarch64
- build:sailfishos:3.4:armv7hl
# - build:sailfishos:3.4:i486
- build:sailfishos:3.4:aarch64
- test:stable
dependencies:
- build:sailfishos:latest:armv7hl
- build:sailfishos:latest:i486
- build:sailfishos:latest:aarch64
- build:sailfishos:3.4:armv7hl
# - build:sailfishos:3.4:i486
- build:sailfishos:3.4:aarch64
only:
- tags
deploy:openrepos:wf-sf3:
<<: *deploy-openrepos
variables:
<<: *openrepos-vars
OPENREPOS_UPLOAD_RPM_APPNAME: "Whisperfish (SailfishOS 3.4)"
environment:
name: OpenRepos SF3
url: https://openrepos.net/content/rubdos/whisperfish-sailfishos-34
before_script:
- mv RPMS/*.sf3.*.rpm .
- rm *shareplugin*rpm
- ls *.rpm
deploy:openrepos:wf-sf4:
<<: *deploy-openrepos
variables:
<<: *openrepos-vars
OPENREPOS_UPLOAD_RPM_APPNAME: Whisperfish
environment:
name: OpenRepos
url: https://openrepos.net/content/rubdos/whisperfish
before_script:
- mv RPMS/*.sf4.*.rpm .
- rm *shareplugin*rpm
- ls *.rpm
deploy:openrepos:wf-shareplugin-sf3:
<<: *deploy-openrepos
variables:
<<: *openrepos-vars
OPENREPOS_UPLOAD_RPM_APPNAME: "Whisperfish shareplugin (SailfishOS 4.2 or below)"
environment:
name: "OpenRepos shareplugin 4.3"
url: https://openrepos.net/content/rubdos/whisperfish-shareplugin-sailfishos-42-or-below
before_script:
- mv RPMS/*shareplugin*.sf3.*.rpm .
- ls *.rpm
deploy:openrepos:wf-shareplugin-sf4:
<<: *deploy-openrepos
variables:
<<: *openrepos-vars
OPENREPOS_UPLOAD_RPM_APPNAME: "Whisperfish shareplugin (SailfishOS 4.3+)"
environment:
name: "OpenRepos shareplugin 4.3"
url: https://openrepos.net/content/rubdos/whisperfish-shareplugin-sailfishos-43
before_script:
- mv RPMS/*shareplugin*.sf4.*.rpm .
- ls *.rpm
deploy:gitlab:tarball:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: build:host:stable:tarball
artifacts: true
script:
- echo "Running release job"
release:
name: Release ${CI_COMMIT_TAG}
description: Created using the release-cli
tag_name: ${CI_COMMIT_TAG}
ref: ${CI_COMMIT_TAG}
assets:
links:
- name: ${PACKAGE_NAME}.tar.gz
url: ${CI_PROJECT_URL}/-/jobs/${TGZ_JOB_ID}/artifacts/raw/${PACKAGE_NAME}.tar.gz
only:
- tags
dry-run:triage:
stage: test
image: ruby:2.4
script:
- gem install gitlab-triage
- gitlab-triage --help
- gitlab-triage --dry-run --token $PRIVATE_TOKEN --source projects --source-id $CI_PROJECT_PATH
when: manual
policy:run:
stage: deploy
image: ruby:2.4
script:
- gem install gitlab-triage
- gitlab-triage --token $PRIVATE_TOKEN --source projects --source-id $CI_PROJECT_PATH
when: manual
.schedule:policyrun:
stage: deploy
image: ruby:2.4
script:
- gem install gitlab-triage
- gitlab-triage --token $PRIVATE_TOKEN --source projects --source-id $CI_PROJECT_PATH
only:
- schedules