-
Notifications
You must be signed in to change notification settings - Fork 32
/
.gitlab-ci.yml
647 lines (612 loc) · 21.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
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# Variables to add in Gitalb UI : Settings > CI/CD
# - NEW_RELIC_LICENSE_KEY // Optional
# - TEST_UPDATE_DEPLOYMENTS // Optional, enables test:deploy job
# - GITLAB_PROJECT_ACCESS_TOKEN // Required by test:deploy job. To be created in Gitlab project UI with read_api and read_repository permissions
# - GITLAB_PROJECT_BASIC_AUTH // Required by test:deploy job. Encoded credentials to pass Gitlab basic auth, if any
variables:
GIT_DEPTH: "1"
THEME_PATH: "" # Update to enable front jobs (web/themes/custom/XXX)
STORYBOOK_PATH: "" # Update to enable storybook job (themes/custom/XXX/dist/storybook/index.html)
GIT_STRATEGY: fetch
REVIEW_DOMAIN: "XXX.XXX.com" # Mandatory, should equal to DNS of available runner server with docker + compose + traefik
IMAGE_PHP: skilldlabs/php:83
image: $IMAGE_PHP
# Tags defines which runner to use (expected shell runner)
.runner_tag_selection:
tags:
- XXX # Mandatory, should equal to tag of available runner server with docker + compose + traefik
before_script:
- date
- pwd
- ls -lah
- whoami
- id
- cat /etc/os-release
- env
- echo $CI_PIPELINE_SOURCE
stages:
- sniffers
- prepare
- build
- update
- tests
- more tests
sniffers:clang:
stage: sniffers
script:
- make clang
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
sniffers:compose:
stage: sniffers
script:
- composer -vvv -V
- time composer validate --profile
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
sniffers:front:
stage: sniffers
script:
- make front-install # Dependencies are required for js imports to pass linters
- make lintval
cache:
key:
files:
# Until https://gitlab.com/gitlab-org/gitlab/issues/118466 lands ...
- web/themes/custom/XXX/package.json # ... this path has to be hardcoded
- web/themes/custom/XXX/yarn.lock # ... this path has to be hardcoded
paths:
- ${THEME_PATH}/node_modules/ # Populated during yarn install
artifacts:
name: "${CI_COMMIT_REF_NAME}:${CI_COMMIT_SHA}:front"
expire_in: 1d
paths:
- ${THEME_PATH}/node_modules/ # Populated during yarn install
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline' && $THEME_PATH
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $THEME_PATH
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $THEME_PATH
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_TAG && $THEME_PATH
sniffers:phpcs:
stage: sniffers
image: skilldlabs/docker-phpcs-drupal
script:
- docker -v
- make phpcs
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
sniffers:newlineeof:
stage: sniffers
script:
- make newlineeof
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
prepare:back:
stage: prepare
script:
- docker --version
- docker run -e "COMPOSER_MEMORY_LIMIT=1G" --user 1000:1000 --rm --init -v `pwd`:`pwd` -w `pwd` "$IMAGE_PHP" /bin/ash -c "composer --version && composer install --no-interaction --prefer-dist -o -v --ignore-platform-reqs && composer create-required-files" # Make back on the fly, using --ignore-platform-reqs as additional PHP-extensions could be missing
cache:
key:
files:
- composer.json
- composer.lock
paths:
- vendor/
- web/core/
- web/libraries/
- web/modules/contrib/
- web/profiles/contrib/
- web/themes/contrib/
- drush/contrib/
dependencies: []
artifacts:
name: "${CI_COMMIT_REF_NAME}:${CI_COMMIT_SHA}:back"
expire_in: 1d
paths:
- vendor/
- web/
- drush/
exclude:
- web/modules/custom/
- web/themes/custom/
- web/profiles/contrib/
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_TAG
prepare:front:
stage: prepare
script:
- make front-install
- make front-build
dependencies:
- sniffers:front
artifacts:
name: "${CI_COMMIT_REF_NAME}:${CI_COMMIT_SHA}:front"
expire_in: 1d
paths:
- ${THEME_PATH}/dist/ # Populated during yarn build
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline' && $THEME_PATH
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $THEME_PATH
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $THEME_PATH
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_TAG && $THEME_PATH
.deploy_template: &deploy_template
stage: build
script:
- echo "Deploy ${CI_ENVIRONMENT_URL} review app to ${BUILD_DIR}."
- echo "CI_ENVIRONMENT_NAME=${CI_ENVIRONMENT_NAME}"
- echo "CI_ENVIRONMENT_SLUG=${CI_ENVIRONMENT_SLUG}"
- echo "CI_COMMIT_REF_SLUG=${CI_COMMIT_REF_SLUG}"
- echo "CI_ENVIRONMENT_URL=${CI_ENVIRONMENT_URL}"
- echo "CI_PROJECT_PATH_SLUG=${CI_PROJECT_PATH_SLUG}"
- echo "CI_PROJECT_NAME=${CI_PROJECT_NAME}"
- echo "REVIEW_DOMAIN=${REVIEW_DOMAIN}"
- mkdir -p ${BUILD_DIR}
- rsync -ah --exclude=.git --exclude=.cache --delete ./ ${BUILD_DIR}
- cd ${BUILD_DIR}
- echo "COMPOSE_PROJECT_NAME=${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}" >> .env.default
- echo "MAIN_DOMAIN_NAME=${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}" >> .env.default
- docker --version
- docker compose version
- make all_ci
- make drush config-set system.site name '${CI_COMMIT_REF_SLUG}' -- -y
- echo "Copying DB and files to make them accessible to artifact creator"
- docker compose exec -T --user root php ash -c "chmod -R 775 .cache/ web/sites/"
- cp -r .cache/ ${CI_PROJECT_DIR} && cp -r web/sites/ ${CI_PROJECT_DIR}/web/ # https://gitlab.com/gitlab-org/gitlab-foss/-/issues/15530#note_533732001
after_script:
- docker network prune -f
- docker container prune -f
- echo "Started ${CI_ENVIRONMENT_URL} composition in ${BUILD_DIR} from Makefile."
dependencies:
- prepare:back
- prepare:front
allow_failure: false # https://gitlab.com/gitlab-org/gitlab-foss/-/issues/25892#note_26909808
extends: .runner_tag_selection
.deploy_template_environment_ttl_long: &deploy_template_environment_ttl_long
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
auto_stop_in: 1 month
.deploy_template_environment_ttl_mid: &deploy_template_environment_ttl_mid
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
auto_stop_in: 1 week
.deploy_template_environment_ttl_short: &deploy_template_environment_ttl_short
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
auto_stop_in: 1 day
build:review:
<<: *deploy_template
<<: *deploy_template_environment_ttl_mid
when: manual
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline' && $CI_MERGE_REQUEST_IID
changes:
- {{ project.path }}/**/*
build:master:
<<: *deploy_template
<<: *deploy_template_environment_ttl_long
when: always
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline' && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
build:tag:
<<: *deploy_template
<<: *deploy_template_environment_ttl_short
when: manual
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline' && $CI_COMMIT_TAG
artifacts:
name: "${CI_PROJECT_NAME}-raw_build_db_and_files-tag-artifact"
expire_in: 1 week
paths:
- web/sites/*/files/
- .cache
stop_review:
stage: build
variables:
GIT_STRATEGY: none
dependencies: []
script:
- echo "Clean-up build dir ${BUILD_DIR}"
- (if [ -d ${BUILD_DIR} ]; then date; cd ${BUILD_DIR}; pwd; make clean; cd -; rm -rf ${BUILD_DIR}; fi)
- echo "Removed previous review app ${CI_ENVIRONMENT_URL} from ${BUILD_DIR}."
when: manual
environment:
name: review/${CI_COMMIT_REF_NAME}
action: stop
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_TAG
generate:logins:
stage: build
dependencies: []
script:
- cd ${BUILD_DIR}
- make info
when: manual
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
test:deploy:
stage: update
extends: .runner_tag_selection
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- cd ${BUILD_DIR}
- ls -lah
- ls -lah .cache/
- ls -lah web/sites/*/files/
- printf "\033[1m- Getting name of last tag created...\n\033[0m"
- export LAST_TAG=$(curl --header "Authorization:${GITLAB_PROJECT_BASIC_AUTH}" --header "PRIVATE-TOKEN:${GITLAB_PROJECT_ACCESS_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/tags" | jq -r '.[0] | .name')
- |
if [ "${LAST_TAG}" = "null" ]; then printf "\033[1m- No tag was found. Nothing to do here.\n\033[0m"; else \
printf "\033[1m- Tag found! (${LAST_TAG}) Downloading it's artifacts...\n\033[0m" && \
curl --location --output artifacts.zip --header "Authorization:${GITLAB_PROJECT_BASIC_AUTH}" --header "PRIVATE-TOKEN:${GITLAB_PROJECT_ACCESS_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/artifacts/${LAST_TAG}/download?job=build:tag" && \
printf "\033[1m- Artifacts were successfully downloaded from tag ${LAST_TAG}\n\033[0m" && \
printf "\033[1m- Replacing DB and files of ${CI_ENVIRONMENT_URL} from those of ${LAST_TAG} tag artifacts\n\033[0m" && \
docker compose exec -T --user root php ash -c "chmod -R 775 .cache/ web/sites/*/files/" && \
rm -rf .cache/* web/sites/*/files/* && \
unzip -o artifacts.zip && \
printf "\033[1m- DB and files from ${CI_ENVIRONMENT_URL} were successfully replaced from those of the artifacts\n\033[0m" && \
make drush cr && \
# Disabling config_ignore so that all configs will be imported bellow
if [ $(docker compose exec -T php sh -c "drush config:status --state=Any --format=list | grep config_ignore.settings | wc -l") -gt 0 ]; then make drush config:delete config_ignore.settings -- -y && make drush cr; fi && \
printf "\033[1m- Simulating deployment against tag ${LAST_TAG}...\n\033[0m" && \
make drush deploy -- -y && \
printf "\033[1m- Successful deployment simulation of ${CI_COMMIT_REF_NAME} against tag ${LAST_TAG} using ${CI_ENVIRONMENT_URL} review app.\n\033[0m"; fi
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline' && $TEST_UPDATE_DEPLOYMENTS == "TRUE"
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $TEST_UPDATE_DEPLOYMENTS == "TRUE"
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $TEST_UPDATE_DEPLOYMENTS == "TRUE"
changes:
- {{ project.path }}/**/*
test:storybook:
stage: tests
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- cd ${BUILD_DIR}
- make build-storybook
- echo "- Storybook is accessible here :" && echo "${CI_ENVIRONMENT_URL}/${STORYBOOK_PATH}"
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline' && $STORYBOOK_PATH
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $STORYBOOK_PATH
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $STORYBOOK_PATH
changes:
- {{ project.path }}/**/*
test:behat:
stage: tests
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- BEHAT_ARGS='--colors -f pretty -o std -f junit -o features/junit' make behat
after_script:
- cd ${BUILD_DIR}
- make browser_driver_stop
- rm -rf web/screenshots
- mkdir web/screenshots
- mv features/*.png web/screenshots/
- echo "- Screenshots are available here :" && cd web/screenshots && ls -h *.png | xargs -i echo "${CI_ENVIRONMENT_URL}/screenshots/{}"
- mv ${BUILD_DIR}/features/junit ${CI_PROJECT_DIR}
retry:
max: 2
when: script_failure
dependencies:
- build:review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
artifacts:
expire_in: 1 week
when: always
paths:
- junit/*.xml
reports:
junit: junit/*.xml
test:cinsp:
stage: tests
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- make cinsp
dependencies:
- build:review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
test:drupalrector:
stage: tests
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- make drupalrectorval
dependencies:
- build:review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
test:lighthouse:
stage: tests
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- cat lighthouserc.yml
- docker run --tty --rm --init -d -v `pwd`:`pwd` -w `pwd` -u $(id -u):$(id -g) --entrypoint="/bin/bash" --name "${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse" cypress/browsers:node14.15.0-chrome86-ff82
- docker exec --tty ${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse node -v
- docker exec --tty ${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse npm -v
- docker exec --tty -u root ${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse npm install -g @lhci/[email protected]
- docker exec --tty ${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse lhci --version
- docker exec --tty ${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse lhci healthcheck
- docker exec --tty ${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse lhci collect --url=https://${RA_BASIC_AUTH_USERNAME}:${RA_BASIC_AUTH_PASSWORD}@${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
- docker exec --tty ${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse lhci assert
after_script:
- if [ -n `docker ps -f 'name=${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse' -q` ]; then echo 'Stopping container'; docker rm --force ${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}_lighthouse; fi
- cd ${BUILD_DIR}
- if [ -d .lighthouseci ]; then mv .lighthouseci web/lighthouseci; echo "- Reports are available here :" && for i in $(find web/lighthouseci/ -name "*.html"); do basename $i;done | xargs -i echo "${CI_ENVIRONMENT_URL}/lighthouseci/{}"; fi
dependencies:
- build:review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
test:contentgen:
stage: tests
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- make contentgen
dependencies:
- build:review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
when: manual
test:patch:
stage: tests
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- make patchval
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline' && $RUN_PATCHVAL_CI_JOB != "FALSE"
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $RUN_PATCHVAL_CI_JOB != "FALSE"
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $RUN_PATCHVAL_CI_JOB != "FALSE"
changes:
- {{ project.path }}/**/*
# Use $RUN_PATCHVAL_CI_JOB=TRUE only in case patching upstream is not possible at all, like private packages
test:statusreport:
stage: 'more tests'
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- make statusreportval
dependencies:
- build:review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
test:upgradestatus:
stage: 'more tests'
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- make upgradestatusval
dependencies:
- build:review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*
test:watchdog:
stage: 'more tests'
environment:
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
name: review/${CI_COMMIT_REF_NAME}
on_stop: stop_review
script:
- echo "Starting job script in ${BUILD_DIR}"
- cd ${BUILD_DIR}
- make watchdogval
dependencies:
- build:review
extends: .runner_tag_selection
rules:
- if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
changes:
- {{ project.path }}/**/*
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
changes:
- {{ project.path }}/**/*
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- {{ project.path }}/**/*