forked from revoltchat/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
787 lines (682 loc) · 19 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
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
variables:
Z_LOCALES: "en-us:de-de"
.artifacts_error_template: &artifacts_error
artifacts:
expire_in: 2 days
when: on_failure
paths:
- tmp/screenshot*
- log/*.log
before_script:
- ruby -v
- which ruby
- env
- test -n "$RNAME" && script/build/test_db_config.sh
- test -n "$RNAME" && bundle install -j $(nproc)
stages:
- pre
- test
- browser-core
- browser-integration
# pre stage
pre:rubocop:
stage: pre
tags:
- core
script:
- bundle exec rubocop
pre:coffeelint:
stage: pre
tags:
- core
script:
- coffeelint app/
pre:bundle-audit:
stage: pre
tags:
- core
script:
- gem install bundler-audit
- bundle-audit update
- bundle-audit
pre:github:
stage: pre
tags:
- deploy
script:
- script/build/sync_repo.sh [email protected]:zammad/zammad.git
# test stage
## RSpec
.script_rspec_template: &script_rspec_definition
<<: *artifacts_error
variables:
RAILS_ENV: "test"
script:
- rake zammad:db:init
- bundle exec rspec
- rake db:drop
test:rspec:mysql:
stage: test
tags:
- core
- mysql
<<: *script_rspec_definition
test:rspec:postgresql:
stage: test
tags:
- core
- postgresql
<<: *script_rspec_definition
## Unit and Controller tests
.script_unit_template: &script_unit_definition
<<: *artifacts_error
variables:
RAILS_ENV: "test"
script:
- rake zammad:db:init
- rake test:units
- ruby -I test/ test/integration/object_manager_test.rb
- ruby -I test/ test/integration/object_manager_attributes_controller_test.rb
- ruby -I test/ test/integration/package_test.rb
- ruby -I test/ test/integration/monitoring_controller_test.rb
- rake db:drop
test:unit:mysql:
stage: test
tags:
- core
- mysql
<<: *script_unit_definition
test:unit:postgresql:
stage: test
tags:
- core
- postgresql
<<: *script_unit_definition
## Integration tests
test:integration:email_helper_deliver:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:unseeded
- ruby -I test/ test/integration/email_helper_test.rb
- ruby -I test/ test/integration/email_deliver_test.rb
- ruby -I test/ test/integration/email_keep_on_server_test.rb
- rake db:drop
test:integration:twitter:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core-twitter
script:
- rake zammad:db:init
- ruby -I test/ test/integration/twitter_test.rb
- rake db:drop
allow_failure: true
test:integration:facebook:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core-facebook
script:
- rake zammad:db:init
- ruby -I test/ test/integration/facebook_test.rb
- rake db:drop
allow_failure: true
test:integration:geo:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:unseeded
- ruby -I test/ test/integration/geo_calendar_test.rb
- ruby -I test/ test/integration/geo_location_test.rb
- ruby -I test/ test/integration/geo_ip_test.rb
- rake db:drop
test:integration:user_agent:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:unseeded
- ruby -I test/ test/integration/user_agent_test.rb
- export ZAMMAD_PROXY_TEST=true
- ruby -I test/ test/integration/user_agent_test.rb
- rake db:drop
allow_failure: true
test:integration:user_device:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:unseeded
- ruby -I test/ test/integration/user_device_controller_test.rb
- rake db:drop
test:integration:slack:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:unseeded
- echo "gem 'slack-api'" >> Gemfile.local
- bundle install -j $(nproc)
- ruby -I test test/integration/slack_test.rb
- rake db:drop
test:integration:clearbit:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:unseeded
- ruby -I test test/integration/clearbit_test.rb
- rake db:drop
allow_failure: true
test:integration:telegram:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:init
- ruby -I test test/integration/telegram_controller_test.rb
- rake db:drop
test:integration:twilio:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:init
- ruby -I test test/integration/twilio_sms_controller_test.rb
- rake db:drop
test:integration:idoit:
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
tags:
- core
script:
- rake zammad:db:init
- ruby -I test test/integration/idoit_controller_test.rb
- rake db:drop
### Elasticsearch
.script_elasticsearch_template: &script_elasticsearch_definition
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
ES_INDEX_RAND: "true"
ES_URL: "http://localhost:9200"
script:
- rake zammad:db:unseeded
- ruby -I test/ test/integration/elasticsearch_active_test.rb
- ruby -I test/ test/integration/elasticsearch_test.rb
- ruby -I test/ test/integration/report_test.rb
- bundle exec rspec --tag searchindex
- rake db:drop
test:integration:es_mysql:
tags:
- core
- mysql
<<: *script_elasticsearch_definition
test:integration:es_postgresql:
tags:
- core
- postgresql
<<: *script_elasticsearch_definition
### Zendesk
.script_integration_zendesk_template: &script_integration_zendesk_definition
<<: *artifacts_error
stage: test
variables:
RAILS_ENV: "test"
script:
- rake zammad:db:unseeded
- ruby -I test/ test/integration/zendesk_import_test.rb
- rake db:drop
allow_failure: true
test:integration:zendesk_mysql:
tags:
- core
- mysql
<<: *script_integration_zendesk_definition
test:integration:zendesk_postgresql:
tags:
- core
- postgresql
<<: *script_integration_zendesk_definition
### OTRS
.script_integration_otrs_template: &script_integration_otrs_definition
<<: *artifacts_error
stage: test
script:
- rake zammad:db:unseeded
- ruby -I test/ test/integration/otrs_import_test.rb
- rake db:drop
.variables_integration_otrs_6_template: &variables_integration_otrs_6_definition
variables:
RAILS_ENV: "test"
IMPORT_OTRS_ENDPOINT: "https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator"
test:integration:otrs_6_mysql:
tags:
- core
- mysql
<<: *script_integration_otrs_definition
<<: *variables_integration_otrs_6_definition
test:integration:otrs_6_postgresql:
tags:
- core
- postgresql
<<: *script_integration_otrs_definition
<<: *variables_integration_otrs_6_definition
test:integration:otrs_5:
tags:
- core
variables:
RAILS_ENV: "test"
IMPORT_OTRS_ENDPOINT: "http://vz1109.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator"
<<: *script_integration_otrs_definition
test:integration:otrs_4:
tags:
- core
variables:
RAILS_ENV: "test"
IMPORT_OTRS_ENDPOINT: "http://vz383.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator"
<<: *script_integration_otrs_definition
test:integration:otrs_33:
tags:
- core
variables:
RAILS_ENV: "test"
IMPORT_OTRS_ENDPOINT: "http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator"
<<: *script_integration_otrs_definition
test:integration:otrs_32:
tags:
- core
variables:
RAILS_ENV: "test"
IMPORT_OTRS_ENDPOINT: "http://vz382.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator"
<<: *script_integration_otrs_definition
test:integration:otrs_31:
tags:
- core
variables:
RAILS_ENV: "test"
IMPORT_OTRS_ENDPOINT: "http://vz381.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator"
<<: *script_integration_otrs_definition
# Browser tests
## preparation (asset precompile)
browser:build:
stage: test
tags:
- core
variables:
RAILS_ENV: "production"
script:
- rake zammad:db:unseeded
- rake assets:precompile
- rake db:drop
artifacts:
expire_in: 1 week
paths:
- public/assets/.sprockets-manifest*
- public/assets/application-*
- public/assets/print-*
## Browser core tests
.variables_browser_template: &variables_browser_definition
RAILS_SERVE_STATIC_FILES: "true"
RAILS_ENV: "production"
BROWSER_URL: "http://$IP:$BROWSER_PORT"
APP_RESTART_CMD: "rake zammad:ci:app:restart"
.test_browser_core_template: &test_browser_core_definition
<<: *artifacts_error
stage: browser-core
dependencies:
- browser:build
### API clients
test:browser:integration:api_client_ruby:
<<: *test_browser_core_definition
variables:
<<: *variables_browser_definition
TEST_URL: "http://$IP:$BROWSER_PORT/"
tags:
- browser
script:
- RAILS_ENV=test rake db:create
- cp contrib/auto_wizard_test.json auto_wizard.json
- rake zammad:ci:test:start
- git clone [email protected]:zammad/zammad-api-client-ruby.git || rake zammad:ci:test:fail
- cd zammad-api-client-ruby
- bundle install -j $(nproc)
- bundle exec rspec || (cd .. && rake zammad:ci:test:fail)
- cd .. && rake zammad:ci:test:stop
test:browser:integration:api_client_php:
<<: *test_browser_core_definition
variables:
<<: *variables_browser_definition
ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_URL: "http://$IP:$BROWSER_PORT"
ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_USERNAME: "[email protected]"
ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_PASSWORD: "test"
tags:
- browser
script:
- RAILS_ENV=test rake db:create
- rake zammad:ci:test:start zammad:setup:auto_wizard
- git clone [email protected]:zammad/zammad-api-client-php || rake zammad:ci:test:fail
- cd zammad-api-client-php
- composer install
- vendor/bin/phpunit || (cd .. && rake zammad:ci:test:fail)
- cd .. && rake zammad:ci:test:stop
### Browser test slices
#### Templates
.script_browser_slice_template: &script_browser_slice_definition
stage: browser-core
dependencies:
- browser:build
script:
# temporary workaround to check Yahoo! mailbox only in test:browser:core:ff_3_* tests
- if [[ $CI_JOB_NAME != test:browser:core:ff_3_* ]]; then unset MAILBOX_AUTO1 ; fi
- if [[ $CI_JOB_NAME != test:browser:core:ff_3_* ]]; then unset MAILBOX_AUTO2 ; fi
- if [[ $CI_JOB_NAME != test:browser:core:ff_3_* ]]; then unset MAILBOX_MANUAL1 ; fi
- if [[ $CI_JOB_NAME != test:browser:core:ff_3_* ]]; then unset MAILBOX_MANUAL2 ; fi
- env
- script/build/test_slice_tests.sh $TEST_SLICE
- RAILS_ENV=test rake db:create
- rake zammad:ci:test:start[with_elasticsearch]
- rake test:browser || rake zammad:ci:test:fail
- rake zammad:ci:test:stop
.test_browser_core_postgresql_template: &test_browser_core_postgresql_definition
<<: *test_browser_core_definition
tags:
- browser
- postgresql
<<: *script_browser_slice_definition
.test_browser_core_mysql_template: &test_browser_core_mysql_definition
<<: *test_browser_core_definition
tags:
- browser
- mysql
<<: *script_browser_slice_definition
#### Firefox
test:browser:core:ff_1_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "1"
test:browser:core:ff_2_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "2"
test:browser:core:ff_3_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "3"
test:browser:core:ff_4_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "4"
test:browser:core:ff_5_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "5"
test:browser:core:ff_6_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "6"
test:browser:core:ff_1_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "1"
test:browser:core:ff_2_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "2"
test:browser:core:ff_3_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "3"
test:browser:core:ff_4_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "4"
test:browser:core:ff_5_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "5"
test:browser:core:ff_6_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
TEST_SLICE: "6"
### Chrome
test:browser:core:chrome_1_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "1"
test:browser:core:chrome_2_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "2"
test:browser:core:chrome_3_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "3"
test:browser:core:chrome_4_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "4"
test:browser:core:chrome_5_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "5"
test:browser:core:chrome_6_mysql:
<<: *test_browser_core_mysql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "6"
test:browser:core:chrome_1_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "1"
test:browser:core:chrome_2_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "2"
test:browser:core:chrome_3_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "3"
test:browser:core:chrome_4_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "4"
test:browser:core:chrome_5_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "5"
test:browser:core:chrome_6_postgresql:
<<: *test_browser_core_postgresql_definition
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
TEST_SLICE: "6"
### Auto wizard
.test_browser_integration_template: &test_browser_integration_definition
<<: *artifacts_error
stage: browser-integration
dependencies:
- browser:build
.script_integration_auto_wizard_template: &script_integration_auto_wizard_definition
script:
- RAILS_ENV=test rake db:create
- cp $AUTO_WIZARD_FILE auto_wizard.json
- rake zammad:ci:test:start[with_elasticsearch]
- ruby -I test/ $TEST_FILE || rake zammad:ci:test:fail
- rake zammad:ci:test:stop
.browser_core_auto_wizard_template: &browser_core_auto_wizard_definition
<<: *test_browser_core_definition
<<: *script_integration_auto_wizard_definition
test:browser:autowizard_chrome:
<<: *browser_core_auto_wizard_definition
tags:
- browser
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
AUTO_WIZARD_FILE: "contrib/auto_wizard_example.json"
TEST_FILE: "test/integration/auto_wizard_browser_test.rb"
test:browser:autowizard_ff:
<<: *browser_core_auto_wizard_definition
tags:
- browser
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
AUTO_WIZARD_FILE: "contrib/auto_wizard_example.json"
TEST_FILE: "test/integration/auto_wizard_browser_test.rb"
### Browser integration tests
.browser_integration_auto_wizard_template: &browser_integration_auto_wizard_definition
<<: *test_browser_integration_definition
<<: *script_integration_auto_wizard_definition
test:browser:integration:twitter_chrome:
<<: *browser_integration_auto_wizard_definition
tags:
- browser
- twitter
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
AUTO_WIZARD_FILE: "contrib/auto_wizard_test.json"
TEST_FILE: "test/integration/twitter_browser_test.rb"
test:browser:integration:twitter_ff:
<<: *browser_integration_auto_wizard_definition
tags:
- browser
- twitter
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
AUTO_WIZARD_FILE: "contrib/auto_wizard_test.json"
TEST_FILE: "test/integration/twitter_browser_test.rb"
test:browser:integration:facebook_chrome:
<<: *browser_integration_auto_wizard_definition
tags:
- browser
- facebook
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
AUTO_WIZARD_FILE: "contrib/auto_wizard_test.json"
TEST_FILE: "test/integration/facebook_browser_test.rb"
test:browser:integration:facebook_ff:
<<: *browser_integration_auto_wizard_definition
tags:
- browser
- facebook
variables:
<<: *variables_browser_definition
BROWSER: "firefox"
AUTO_WIZARD_FILE: "contrib/auto_wizard_test.json"
TEST_FILE: "test/integration/facebook_browser_test.rb"
test:browser:integration:idoit_chrome:
<<: *browser_integration_auto_wizard_definition
tags:
- browser
variables:
<<: *variables_browser_definition
BROWSER: "chrome"
AUTO_WIZARD_FILE: "contrib/auto_wizard_test.json"
TEST_FILE: "test/integration/idoit_browser_test.rb"
### Browser integration tests
.variables_browser_import_template: &variables_browser_import_definition
BROWSER: "chrome"
BROWSER_URL: "http://$IP:$BROWSER_PORT"
.browser_integration_import_template: &browser_integration_import_definition
<<: *test_browser_integration_definition
tags:
- browser
script:
- RAILS_ENV=test rake db:create
- rake zammad:ci:test:start
- ruby -I test/ $TEST_FILE
- rake zammad:ci:test:stop
test:browser:integration:otrs_chrome:
<<: *browser_integration_import_definition
variables:
<<: *variables_browser_import_definition
TEST_FILE: "test/integration/otrs_import_browser_test.rb"
test:browser:integration:zendesk_chrome:
<<: *browser_integration_import_definition
variables:
<<: *variables_browser_import_definition
TEST_FILE: "test/integration/zendesk_import_browser_test.rb"