From 7aeeb6ed1a8327194d2ed5123436038351b2dfc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denny=20Korsuk=C3=A9witz?= Date: Wed, 6 May 2020 11:32:26 +0200 Subject: [PATCH] =?UTF-8?q?Refactoring:=20Reorganise=20GitLab=20CI=20defin?= =?UTF-8?q?ition=20by=20splitting=20it=20up=20in=20dedicated,=20logical=20?= =?UTF-8?q?parts.=20Also=20introduce=20`SINGLETESTNAME`=20ENV=20to=20run?= =?UTF-8?q?=20single=20test=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 633 +----------------- .gitlab/ci/base.yml | 116 ++++ .gitlab/ci/browser-core.yml | 88 +++ .gitlab/ci/browser-core/api_client_php.yml | 17 + .gitlab/ci/browser-core/api_client_ruby.yml | 12 + .gitlab/ci/browser-core/autowizard_chrome.yml | 5 + .gitlab/ci/browser-core/autowizard_ff.yml | 5 + .gitlab/ci/browser-core/build.yml | 17 + .gitlab/ci/browser-core/capybara_chrome.yml | 5 + .gitlab/ci/browser-core/capybara_ff.yml | 5 + .gitlab/ci/browser-core/chrome.yml | 41 ++ .gitlab/ci/browser-core/firefox.yml | 42 ++ .gitlab/ci/browser-integration.yml | 51 ++ .../browser-integration/facebook_chrome.yml | 6 + .../ci/browser-integration/facebook_ff.yml | 6 + .../ci/browser-integration/idoit_chrome.yml | 6 + .../ci/browser-integration/otrs_chrome.yml | 5 + .../ci/browser-integration/zendesk_chrome.yml | 5 + .gitlab/ci/integration.yml | 30 + .gitlab/ci/integration/clearbit.yml | 7 + .../ci/integration/email_helper_deliver.yml | 10 + .gitlab/ci/integration/es.yml | 32 + .gitlab/ci/integration/facebook.yml | 7 + .gitlab/ci/integration/geo.yml | 8 + .gitlab/ci/integration/otrs.yml | 36 + .gitlab/ci/integration/slack.yml | 8 + .gitlab/ci/integration/user_agent.yml | 9 + .gitlab/ci/integration/zendesk.yml | 6 + .gitlab/ci/pre.yml | 33 + .gitlab/ci/rspec.yml | 22 + .gitlab/ci/rspec/mysql.yml | 5 + .gitlab/ci/rspec/postgresql.yml | 5 + .gitlab/ci/unit.yml | 24 + .gitlab/ci/unit/mysql.yml | 5 + .gitlab/ci/unit/postgresql.yml | 5 + 35 files changed, 703 insertions(+), 614 deletions(-) create mode 100644 .gitlab/ci/base.yml create mode 100644 .gitlab/ci/browser-core.yml create mode 100644 .gitlab/ci/browser-core/api_client_php.yml create mode 100644 .gitlab/ci/browser-core/api_client_ruby.yml create mode 100644 .gitlab/ci/browser-core/autowizard_chrome.yml create mode 100644 .gitlab/ci/browser-core/autowizard_ff.yml create mode 100644 .gitlab/ci/browser-core/build.yml create mode 100644 .gitlab/ci/browser-core/capybara_chrome.yml create mode 100644 .gitlab/ci/browser-core/capybara_ff.yml create mode 100644 .gitlab/ci/browser-core/chrome.yml create mode 100644 .gitlab/ci/browser-core/firefox.yml create mode 100644 .gitlab/ci/browser-integration.yml create mode 100644 .gitlab/ci/browser-integration/facebook_chrome.yml create mode 100644 .gitlab/ci/browser-integration/facebook_ff.yml create mode 100644 .gitlab/ci/browser-integration/idoit_chrome.yml create mode 100644 .gitlab/ci/browser-integration/otrs_chrome.yml create mode 100644 .gitlab/ci/browser-integration/zendesk_chrome.yml create mode 100644 .gitlab/ci/integration.yml create mode 100644 .gitlab/ci/integration/clearbit.yml create mode 100644 .gitlab/ci/integration/email_helper_deliver.yml create mode 100644 .gitlab/ci/integration/es.yml create mode 100644 .gitlab/ci/integration/facebook.yml create mode 100644 .gitlab/ci/integration/geo.yml create mode 100644 .gitlab/ci/integration/otrs.yml create mode 100644 .gitlab/ci/integration/slack.yml create mode 100644 .gitlab/ci/integration/user_agent.yml create mode 100644 .gitlab/ci/integration/zendesk.yml create mode 100644 .gitlab/ci/pre.yml create mode 100644 .gitlab/ci/rspec.yml create mode 100644 .gitlab/ci/rspec/mysql.yml create mode 100644 .gitlab/ci/rspec/postgresql.yml create mode 100644 .gitlab/ci/unit.yml create mode 100644 .gitlab/ci/unit/mysql.yml create mode 100644 .gitlab/ci/unit/postgresql.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a5f6f237..c781b0e93 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,21 @@ -image: registry.znuny.com/docker/zammad-ruby:2.6.5 +default: + image: registry.znuny.com/docker/zammad-ruby:2.6.5 + +include: + - local: '/.gitlab/ci/base.yml' + - local: '/.gitlab/ci/pre.yml' + - local: '/.gitlab/ci/integration.yml' + - local: '/.gitlab/ci/rspec.yml' + - local: '/.gitlab/ci/unit.yml' + - local: '/.gitlab/ci/browser-core.yml' + - local: '/.gitlab/ci/browser-integration.yml' + +# Stages +stages: + - pre + - test + - browser-core + - browser-integration # Global variables added to the ENV of each job variables: @@ -17,48 +34,6 @@ variables: MAIL_ADDRESS: "zammad@mail.test.dc.zammad.com" MAIL_PASS: "zammad" -# Artifacts are stored for failed jobs for 2 days -.artifacts_error_template: &artifacts_error - artifacts: - expire_in: 2 days - when: on_failure - paths: - - tmp/screenshot* - - tmp/screenshots/* - - log/*.log - -# Workaround to enable usage of mixed SSH and Docker GitLab CI runners -.docker_env_template: &docker_env - tags: - - docker - -# Workaround for blocked port 25 access on cloud provider infrastructure -.requires_mail_port_access_template: &requires_mail_port_access - tags: - - mail - -.base_env_template: &base_env - <<: *docker_env - <<: *artifacts_error - -# General required Docker services for different/random DB envs -.services_mysql_template: &services_mysql - services: - - name: registry.znuny.com/docker/zammad-mysql:latest - alias: mysql - -.services_postgresql_template: &services_postgresql - services: - - name: registry.znuny.com/docker/zammad-postgresql:latest - alias: postgresql - -.services_random_db_template: &services_random_db - services: - - name: registry.znuny.com/docker/zammad-mysql:latest - alias: mysql - - name: registry.znuny.com/docker/zammad-postgresql:latest - alias: postgresql - # Cache gems in between jobs and pipelines # ATTENTION: We use a combination of the Ruby major and minor version number # as a key for the cache to avoid cache growth and incompatibilities between @@ -70,577 +45,7 @@ cache: # Initialize application env before_script: + - env # todo delete me !!! - bundle install -j $(nproc) --path vendor - bundle exec ruby script/build/database_config.rb -# Stages -stages: - - pre - - test - - browser-core - - browser-integration - -# pre stage - -# Workaround to enable usage of mixed SSH and Docker GitLab CI runners -.pre_stage_template: &pre_stage - <<: *docker_env - stage: pre - before_script: - - '' # disable before_script for pre "non-application" env - -pre:rubocop: - <<: *pre_stage - script: - - bundle install -j $(nproc) --path vendor - - bundle exec rubocop - -pre:coffeelint: - <<: *pre_stage - script: - - coffeelint app/ - -pre:bundle-audit: - <<: *pre_stage - script: - - gem install bundler-audit - - bundle-audit update - - bundle-audit --ignore CVE-2015-9284 - -pre:github: - <<: *pre_stage - tags: - - deploy - script: - - script/build/sync_repo.sh git@github.com:zammad/zammad.git - -# test stage - -## RSpec - -.script_rspec_template: &script_rspec_definition - <<: *base_env - variables: - RAILS_ENV: "test" - script: - - bundle exec rake zammad:db:init - - bundle exec rspec -t ~type:system -t ~searchindex - -test:rspec:mysql: - stage: test - <<: *services_mysql - <<: *script_rspec_definition - -test:rspec:postgresql: - stage: test - <<: *services_postgresql - <<: *script_rspec_definition - -## Unit and Controller tests - -.script_unit_template: &script_unit_definition - <<: *base_env - variables: - RAILS_ENV: "test" - script: - - bundle exec rake zammad:db:init - - bundle exec rake test:units - - bundle exec rails test test/integration/object_manager_test.rb - - bundle exec rails test test/integration/package_test.rb - -test:unit:mysql: - stage: test - <<: *services_mysql - <<: *script_unit_definition - -test:unit:postgresql: - stage: test - <<: *services_postgresql - <<: *script_unit_definition - -## Integration tests - -.test_integration_template: &test_integration_definition - <<: *base_env - <<: *services_random_db - stage: test - variables: - RAILS_ENV: "test" - -test:integration:email_helper_deliver: - <<: *test_integration_definition - <<: *requires_mail_port_access - script: - - bundle exec rake zammad:db:unseeded - - bundle exec rails test test/integration/email_helper_test.rb - - bundle exec rails test test/integration/email_deliver_test.rb - - bundle exec rails test test/integration/email_keep_on_server_test.rb - - bundle exec rails test test/integration/email_postmaster_to_sender.rb - -test:integration:facebook: - <<: *test_integration_definition - script: - - bundle exec rake zammad:db:init - - bundle exec rails test test/integration/facebook_test.rb - allow_failure: true - -test:integration:geo: - <<: *test_integration_definition - script: - - bundle exec rake zammad:db:unseeded - - bundle exec rails test test/integration/geo_calendar_test.rb - - bundle exec rails test test/integration/geo_location_test.rb - - bundle exec rails test test/integration/geo_ip_test.rb - -test:integration:user_agent: - <<: *test_integration_definition - script: - - bundle exec rake zammad:db:unseeded - - bundle exec rails test test/integration/user_agent_test.rb - - export ZAMMAD_PROXY_TEST=true - - bundle exec rails test test/integration/user_agent_test.rb - allow_failure: true - -test:integration:slack: - <<: *test_integration_definition - script: - - bundle exec rake zammad:db:unseeded - - echo "gem 'slack-api'" >> Gemfile.local - - bundle install -j $(nproc) - - bundle exec rails test test/integration/slack_test.rb - -test:integration:clearbit: - <<: *test_integration_definition - script: - - bundle exec rake zammad:db:unseeded - - bundle exec rails test test/integration/clearbit_test.rb - allow_failure: true - -### Elasticsearch - -.script_integration_es_variables: &script_integration_es_variables - ES_INDEX_RAND: "true" - ES_URL: "http://elasticsearch:9200" - -.script_integration_es_template: &script_integration_es_definition - <<: *base_env - stage: test - variables: - <<: *script_integration_es_variables - RAILS_ENV: "test" - script: - - bundle exec rake zammad:db:unseeded - - bundle exec rails test test/integration/elasticsearch_active_test.rb - - bundle exec rails test test/integration/elasticsearch_test.rb - - bundle exec rspec --tag searchindex --tag ~type:system - - bundle exec rails test test/integration/report_test.rb - -test:integration:es:5.6: - <<: *script_integration_es_definition - services: - - name: registry.znuny.com/docker/zammad-mysql:latest - alias: mysql - - name: registry.znuny.com/docker/zammad-postgresql:latest - alias: postgresql - - name: registry.znuny.com/docker/zammad-elasticsearch:5.6 - alias: elasticsearch - -test:integration:es:6: - <<: *script_integration_es_definition - services: - - name: registry.znuny.com/docker/zammad-mysql:latest - alias: mysql - - name: registry.znuny.com/docker/zammad-postgresql:latest - alias: postgresql - - name: registry.znuny.com/docker/zammad-elasticsearch:6 - alias: elasticsearch - -test:integration:es:7: - <<: *script_integration_es_definition - services: - - name: registry.znuny.com/docker/zammad-mysql:latest - alias: mysql - - name: registry.znuny.com/docker/zammad-postgresql:latest - alias: postgresql - - name: registry.znuny.com/docker/zammad-elasticsearch:7 - alias: elasticsearch - -### Zendesk - -test:integration:zendesk: - <<: *base_env - <<: *services_random_db - stage: test - variables: - RAILS_ENV: "test" - script: - - bundle exec rake zammad:db:unseeded - - bundle exec rails test test/integration/zendesk_import_test.rb - -### OTRS - -.script_integration_otrs_template: &script_integration_otrs_definition - <<: *base_env - <<: *services_random_db - stage: test - script: - - bundle exec rake zammad:db:unseeded - - bundle exec rails test test/integration/otrs_import_test.rb - -test:integration:otrs_6: - <<: *script_integration_otrs_definition - variables: - RAILS_ENV: "test" - IMPORT_OTRS_ENDPOINT: "https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" - -test:integration:otrs_5: - <<: *script_integration_otrs_definition - variables: - RAILS_ENV: "test" - IMPORT_OTRS_ENDPOINT: "http://vz1109.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" - -test:integration:otrs_4: - <<: *script_integration_otrs_definition - variables: - RAILS_ENV: "test" - IMPORT_OTRS_ENDPOINT: "http://vz383.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" - -test:integration:otrs_33: - <<: *script_integration_otrs_definition - variables: - RAILS_ENV: "test" - IMPORT_OTRS_ENDPOINT: "http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" - -test:integration:otrs_32: - <<: *script_integration_otrs_definition - variables: - RAILS_ENV: "test" - IMPORT_OTRS_ENDPOINT: "http://vz382.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" - -test:integration:otrs_31: - <<: *script_integration_otrs_definition - variables: - RAILS_ENV: "test" - IMPORT_OTRS_ENDPOINT: "http://vz381.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" - -# Browser tests - -## preparation (asset precompile) - -browser:build: - <<: *base_env - <<: *services_postgresql - stage: test - variables: - RAILS_ENV: "production" - script: - - bundle exec rake zammad:db:unseeded - - bundle exec rake assets:precompile - artifacts: - expire_in: 1 week - paths: - - public/assets/.sprockets-manifest* - - public/assets/application-* - - public/assets/knowledge_base* - - public/assets/print-* - -.services_browser_template: &services_browser_definition - services: - - name: registry.znuny.com/docker/zammad-mysql:latest - alias: mysql - - name: registry.znuny.com/docker/zammad-postgresql:latest - alias: postgresql - - name: registry.znuny.com/docker/zammad-elasticsearch:stable - alias: elasticsearch - - name: docker.io/elgalu/selenium:3.141.59-p32 - alias: selenium - - name: registry.znuny.com/docker/docker-imap-devel:latest - alias: mail - -## Browser core tests - -.variables_browser_template: &variables_browser_definition - RAILS_ENV: "production" - APP_RESTART_CMD: "bundle exec rake environment zammad:ci:app:restart" - -.test_browser_core_template: &test_browser_core_definition - <<: *base_env - stage: browser-core - dependencies: - - browser:build - -## Capybara - -.test_capybara_template: &test_capybara_definition - <<: *test_browser_core_definition - script: - - bundle exec rake zammad:ci:test:prepare[with_elasticsearch] - - bundle exec rspec --fail-fast -t type:system - -.variables_capybara_chrome_template: &variables_capybara_chrome_definition - <<: *test_capybara_definition - variables: - <<: *script_integration_es_variables - RAILS_ENV: "test" - BROWSER: "chrome" - -.variables_capybara_ff_template: &variables_capybara_ff_definition - <<: *test_capybara_definition - variables: - <<: *script_integration_es_variables - RAILS_ENV: "test" - BROWSER: "firefox" - -test:browser:core:capybara_chrome: - <<: *variables_capybara_chrome_definition - <<: *services_browser_definition - -test:browser:core:capybara_ff: - <<: *variables_capybara_ff_definition - <<: *services_browser_definition - -### API clients - -test:browser:integration:api_client_ruby: - <<: *test_browser_core_definition - <<: *services_random_db - variables: - <<: *variables_browser_definition - script: - - RAILS_ENV=test bundle exec rake db:create - - cp contrib/auto_wizard_test.json auto_wizard.json - - bundle exec rake zammad:ci:test:start - - git clone https://github.com/zammad/zammad-api-client-ruby.git - - cd zammad-api-client-ruby - - bundle install -j $(nproc) - - bundle exec rspec - -test:browser:integration:api_client_php: - <<: *test_browser_core_definition - <<: *services_random_db - variables: - <<: *variables_browser_definition - ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_URL: "http://localhost:3000" - ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_USERNAME: "master@example.com" - ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_PASSWORD: "test" - script: - - RAILS_ENV=test bundle exec rake db:create - - RAILS_ENV=test bundle exec rake zammad:ci:test:start zammad:setup:auto_wizard - - git clone https://github.com/zammad/zammad-api-client-php.git - - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - - php composer-setup.php --install-dir=/usr/local/bin - - ln -s /usr/local/bin/composer.phar /usr/local/bin/composer - - cd zammad-api-client-php - - composer install - - vendor/bin/phpunit - -### Browser test slices - -#### Templates - -.script_browser_slice_template: &script_browser_slice_definition - 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 bundle exec rake db:create - - bundle exec rake zammad:ci:test:start[with_elasticsearch] - - time bundle exec rails test --fail-fast test/browser - -.test_browser_core_base_template: &test_browser_core_base_definition - <<: *test_browser_core_definition - <<: *script_browser_slice_definition - <<: *services_browser_definition - -#### Firefox - -test:browser:core:ff_1: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "firefox" - TEST_SLICE: "1" - -test:browser:core:ff_2: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "firefox" - TEST_SLICE: "2" - -test:browser:core:ff_3: - <<: *test_browser_core_base_definition - <<: *requires_mail_port_access - variables: - <<: *variables_browser_definition - BROWSER: "firefox" - TEST_SLICE: "3" - -test:browser:core:ff_4: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "firefox" - TEST_SLICE: "4" - -test:browser:core:ff_5: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "firefox" - TEST_SLICE: "5" - -test:browser:core:ff_6: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "firefox" - TEST_SLICE: "6" - -### Chrome - -test:browser:core:chrome_1: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "chrome" - TEST_SLICE: "1" - -test:browser:core:chrome_2: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "chrome" - TEST_SLICE: "2" - -test:browser:core:chrome_3: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "chrome" - TEST_SLICE: "3" - -test:browser:core:chrome_4: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "chrome" - TEST_SLICE: "4" - -test:browser:core:chrome_5: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "chrome" - TEST_SLICE: "5" - -test:browser:core:chrome_6: - <<: *test_browser_core_base_definition - variables: - <<: *variables_browser_definition - BROWSER: "chrome" - TEST_SLICE: "6" - -### Auto wizard - -.auto_wizard_services_template: &auto_wizard_services - services: - - name: registry.znuny.com/docker/zammad-postgresql:latest - alias: postgresql - - name: docker.io/elgalu/selenium:3.141.59-p32 - alias: selenium - -.test_browser_integration_template: &test_browser_integration_definition - <<: *base_env - <<: *auto_wizard_services - stage: browser-integration - dependencies: - - browser:build - -.script_integration_auto_wizard_template: &script_integration_auto_wizard_definition - script: - - RAILS_ENV=test bundle exec rake db:create - - cp $AUTO_WIZARD_FILE auto_wizard.json - - bundle exec rake zammad:ci:test:start - - bundle exec rails test $TEST_FILE - -.browser_core_auto_wizard_template: &browser_core_auto_wizard_definition - <<: *test_browser_core_definition - <<: *auto_wizard_services - <<: *script_integration_auto_wizard_definition - -test:browser:autowizard_chrome: - <<: *browser_core_auto_wizard_definition - 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 - 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:facebook_chrome: - <<: *browser_integration_auto_wizard_definition - 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 - 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 - 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" - RAILS_SERVE_STATIC_FILES: "true" - RAILS_ENV: "production" - -.browser_integration_import_template: &browser_integration_import_definition - <<: *test_browser_integration_definition - script: - - RAILS_ENV=test bundle exec rake db:create - - bundle exec rake zammad:ci:test:start - - bundle exec rails test $TEST_FILE - -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" diff --git a/.gitlab/ci/base.yml b/.gitlab/ci/base.yml new file mode 100644 index 000000000..30d768cc0 --- /dev/null +++ b/.gitlab/ci/base.yml @@ -0,0 +1,116 @@ +# Artifacts are stored for failed jobs for 2 days +.artifacts_error: &artifacts_error + artifacts: + expire_in: 2 days + when: on_failure + paths: + - tmp/screenshot* + - tmp/screenshots/* + - log/*.log + +.variables_es: &variables_es + variables: + ES_INDEX_RAND: "true" + ES_URL: "http://elasticsearch:9200" + +.variables_app_restart_cmd: &variables_app_restart_cmd + variables: + APP_RESTART_CMD: "bundle exec rake environment zammad:ci:app:restart" + +.rules_singletest: &rules_singletest + rules: + - if: $CI_MERGE_REQUEST_ID + when: never + - if: '$SINGLETESTNAME && $SINGLETESTNAME == $CI_JOB_NAME' + when: always + - if: '$SINGLETESTNAME && $SINGLETESTNAME != $CI_JOB_NAME' + when: never + - if: '$CI_JOB_NAME' + when: on_success + +# Workaround to enable usage of mixed SSH and Docker GitLab CI runners +.tags_docker: &tags_docker + tags: + - docker + +# Workaround for blocked port 25 access on cloud provider infrastructure +.tags_mail: &tags_mail + tags: + - mail + +.env_base: &env_base + <<: *tags_docker + <<: *artifacts_error + <<: *rules_singletest + +# DB Docker +.docker_mysql: &docker_mysql + name: registry.znuny.com/docker/zammad-mysql:latest + alias: mysql + +.docker_postgresql: &docker_postgresql + name: registry.znuny.com/docker/zammad-postgresql:latest + alias: postgresql + +# elasticsearch docker +.docker_elasticsearch: &docker_elasticsearch + name: registry.znuny.com/docker/zammad-elasticsearch:$ELASTICSEARCH_TAG + alias: elasticsearch + +# selenium docker +.docker_selenium: &docker_selenium + name: docker.io/elgalu/selenium:3.141.59-p32 + alias: selenium + +# selenium docker +.docker_imap: &docker_imap + name: registry.znuny.com/docker/docker-imap-devel:latest + alias: mail + + # service templates +.services_mysql: &services_mysql + services: + - <<: *docker_mysql + +.services_postgresql: &services_postgresql + services: + - <<: *docker_postgresql + +.services_mysql_postgresql: &services_mysql_postgresql + services: + - <<: *docker_mysql + - <<: *docker_postgresql + +.services_postgresql_selenium: &services_postgresql_selenium + services: + - <<: *docker_postgresql + - <<: *docker_selenium + +.services_mysql_postgresql_elasticsearch: &services_mysql_postgresql_elasticsearch + variables: + ELASTICSEARCH_TAG: 'stable' + services: + - <<: *docker_mysql + - <<: *docker_postgresql + - <<: *docker_elasticsearch + +.services_mysql_postgresql_elasticsearch_selenium_imap: &services_mysql_postgresql_elasticsearch_selenium_imap + variables: + ELASTICSEARCH_TAG: 'stable' + services: + - <<: *docker_mysql + - <<: *docker_postgresql + - <<: *docker_elasticsearch + - <<: *docker_selenium + - <<: *docker_imap + +# we need at least one job to store and include this template +# but we skip this via 'only' -> 'variables' -> '$IGNORE' +# $IGNORE is not defined +ignore: + stage: test + only: + variables: + - $IGNORE + script: + - '' \ No newline at end of file diff --git a/.gitlab/ci/browser-core.yml b/.gitlab/ci/browser-core.yml new file mode 100644 index 000000000..b3c059152 --- /dev/null +++ b/.gitlab/ci/browser-core.yml @@ -0,0 +1,88 @@ +include: + + # browser-core + - local: '/.gitlab/ci/browser-core/build.yml' + - local: '/.gitlab/ci/browser-core/autowizard_chrome.yml' + - local: '/.gitlab/ci/browser-core/autowizard_ff.yml' + - local: '/.gitlab/ci/browser-core/api_client_php.yml' + - local: '/.gitlab/ci/browser-core/api_client_ruby.yml' + - local: '/.gitlab/ci/browser-core/capybara_chrome.yml' + - local: '/.gitlab/ci/browser-core/capybara_ff.yml' + - local: '/.gitlab/ci/browser-core/chrome.yml' + - local: '/.gitlab/ci/browser-core/firefox.yml' + +.template_browser-core: &template_browser-core + stage: browser-core + dependencies: + - browser:build + extends: + - .env_base + - .variables_es + - .variables_app_restart_cmd + - .services_mysql_postgresql_elasticsearch_selenium_imap + variables: + RAILS_ENV: "production" + script: + # temporary workaround to check Yahoo! mailbox only in 3_firefox* tests + - if [[ $CI_JOB_NAME != 3_firefox* ]]; then unset MAILBOX_AUTO1 ; fi + - if [[ $CI_JOB_NAME != 3_firefox* ]]; then unset MAILBOX_AUTO2 ; fi + - if [[ $CI_JOB_NAME != 3_firefox* ]]; then unset MAILBOX_MANUAL1 ; fi + - if [[ $CI_JOB_NAME != 3_firefox* ]]; then unset MAILBOX_MANUAL2 ; fi + - env + - script/build/test_slice_tests.sh $TEST_SLICE + - RAILS_ENV=test bundle exec rake db:create + - bundle exec rake zammad:ci:test:start[with_elasticsearch] + - time bundle exec rails test --fail-fast test/browser + +.template_browser-core_autowizard: &template_browser-core_autowizard + stage: browser-core + dependencies: + - browser:build + extends: + - .env_base + - .variables_app_restart_cmd + - .services_postgresql_selenium + variables: + RAILS_ENV: "production" + AUTO_WIZARD_FILE: "contrib/auto_wizard_example.json" + TEST_FILE: "test/integration/auto_wizard_browser_test.rb" + script: + - RAILS_ENV=test bundle exec rake db:create + - cp $AUTO_WIZARD_FILE auto_wizard.json + - bundle exec rake zammad:ci:test:start + - bundle exec rails test $TEST_FILE + +.template_browser-core_api_client: &template_browser-core_api_client + stage: browser-core + dependencies: + - browser:build + extends: + - .env_base + - .variables_app_restart_cmd + - .services_mysql_postgresql + variables: + RAILS_ENV: "production" + +.template_browser-core_capybara: &template_browser-core_capybara + stage: browser-core + dependencies: + - browser:build + extends: + - .env_base + - .variables_es + - .services_mysql_postgresql_elasticsearch_selenium_imap + variables: + RAILS_ENV: "test" + script: + - bundle exec rake zammad:ci:test:prepare[with_elasticsearch] + - bundle exec rspec --fail-fast -t type:system + +# we need at least one job to store and include this template +# $IGNORE is not defined +ignore: + stage: test + only: + variables: + - $IGNORE + script: + - '' diff --git a/.gitlab/ci/browser-core/api_client_php.yml b/.gitlab/ci/browser-core/api_client_php.yml new file mode 100644 index 000000000..a4ce45976 --- /dev/null +++ b/.gitlab/ci/browser-core/api_client_php.yml @@ -0,0 +1,17 @@ +api_client_php: + extends: + - .template_browser-core_api_client + variables: + ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_URL: "http://localhost:3000" + ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_USERNAME: "master@example.com" + ZAMMAD_PHP_API_CLIENT_UNIT_TESTS_PASSWORD: "test" + script: + - RAILS_ENV=test bundle exec rake db:create + - RAILS_ENV=test bundle exec rake zammad:ci:test:start zammad:setup:auto_wizard + - git clone https://github.com/zammad/zammad-api-client-php.git + - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + - php composer-setup.php --install-dir=/usr/local/bin + - ln -s /usr/local/bin/composer.phar /usr/local/bin/composer + - cd zammad-api-client-php + - composer install + - vendor/bin/phpunit diff --git a/.gitlab/ci/browser-core/api_client_ruby.yml b/.gitlab/ci/browser-core/api_client_ruby.yml new file mode 100644 index 000000000..b26bfc387 --- /dev/null +++ b/.gitlab/ci/browser-core/api_client_ruby.yml @@ -0,0 +1,12 @@ +api_client_ruby: + extends: + - .template_browser-core_api_client + script: + - RAILS_ENV=test bundle exec rake db:create + - cp contrib/auto_wizard_test.json auto_wizard.json + - bundle exec rake zammad:ci:test:start + - git clone https://github.com/zammad/zammad-api-client-ruby.git + - cd zammad-api-client-ruby + - bundle install -j $(nproc) + - bundle exec rspec + diff --git a/.gitlab/ci/browser-core/autowizard_chrome.yml b/.gitlab/ci/browser-core/autowizard_chrome.yml new file mode 100644 index 000000000..83f55eac0 --- /dev/null +++ b/.gitlab/ci/browser-core/autowizard_chrome.yml @@ -0,0 +1,5 @@ +autowizard_chrome: + extends: + - .template_browser-core_autowizard + variables: + BROWSER: "chrome" \ No newline at end of file diff --git a/.gitlab/ci/browser-core/autowizard_ff.yml b/.gitlab/ci/browser-core/autowizard_ff.yml new file mode 100644 index 000000000..874d4ce8e --- /dev/null +++ b/.gitlab/ci/browser-core/autowizard_ff.yml @@ -0,0 +1,5 @@ +autowizard_ff: + extends: + - .template_browser-core_autowizard + variables: + BROWSER: "firefox" \ No newline at end of file diff --git a/.gitlab/ci/browser-core/build.yml b/.gitlab/ci/browser-core/build.yml new file mode 100644 index 000000000..443d9b143 --- /dev/null +++ b/.gitlab/ci/browser-core/build.yml @@ -0,0 +1,17 @@ +browser:build: + stage: test + extends: + - .tags_docker + - .services_postgresql + artifacts: + expire_in: 1 week + paths: + - public/assets/.sprockets-manifest* + - public/assets/application-* + - public/assets/knowledge_base* + - public/assets/print-* + variables: + RAILS_ENV: "production" + script: + - bundle exec rake zammad:db:unseeded + - bundle exec rake assets:precompile diff --git a/.gitlab/ci/browser-core/capybara_chrome.yml b/.gitlab/ci/browser-core/capybara_chrome.yml new file mode 100644 index 000000000..15646ddd4 --- /dev/null +++ b/.gitlab/ci/browser-core/capybara_chrome.yml @@ -0,0 +1,5 @@ +capybara_chrome: + extends: + - .template_browser-core_capybara + variables: + BROWSER: "chrome" \ No newline at end of file diff --git a/.gitlab/ci/browser-core/capybara_ff.yml b/.gitlab/ci/browser-core/capybara_ff.yml new file mode 100644 index 000000000..e76ab04ec --- /dev/null +++ b/.gitlab/ci/browser-core/capybara_ff.yml @@ -0,0 +1,5 @@ +capybara_ff: + extends: + - .template_browser-core_capybara + variables: + BROWSER: "firefox" \ No newline at end of file diff --git a/.gitlab/ci/browser-core/chrome.yml b/.gitlab/ci/browser-core/chrome.yml new file mode 100644 index 000000000..ed674e5d0 --- /dev/null +++ b/.gitlab/ci/browser-core/chrome.yml @@ -0,0 +1,41 @@ +1_chrome: + extends: + - .template_browser-core + variables: + BROWSER: "chrome" + TEST_SLICE: "1" + +2_chrome: + extends: + - .template_browser-core + variables: + BROWSER: "chrome" + TEST_SLICE: "2" + +3_chrome: + extends: + - .template_browser-core + variables: + BROWSER: "chrome" + TEST_SLICE: "3" + +4_chrome: + extends: + - .template_browser-core + variables: + BROWSER: "chrome" + TEST_SLICE: "4" + +5_chrome: + extends: + - .template_browser-core + variables: + BROWSER: "chrome" + TEST_SLICE: "5" + +6_chrome: + extends: + - .template_browser-core + variables: + BROWSER: "chrome" + TEST_SLICE: "6" diff --git a/.gitlab/ci/browser-core/firefox.yml b/.gitlab/ci/browser-core/firefox.yml new file mode 100644 index 000000000..0a757e57f --- /dev/null +++ b/.gitlab/ci/browser-core/firefox.yml @@ -0,0 +1,42 @@ +1_firefox: + extends: + - .template_browser-core + variables: + BROWSER: "firefox" + TEST_SLICE: "1" + +2_firefox: + extends: + - .template_browser-core + variables: + BROWSER: "firefox" + TEST_SLICE: "2" + +3_firefox: + extends: + - .template_browser-core + - .tags_mail + variables: + BROWSER: "firefox" + TEST_SLICE: "3" + +4_firefox: + extends: + - .template_browser-core + variables: + BROWSER: "firefox" + TEST_SLICE: "4" + +5_firefox: + extends: + - .template_browser-core + variables: + BROWSER: "firefox" + TEST_SLICE: "5" + +6_firefox: + extends: + - .template_browser-core + variables: + BROWSER: "firefox" + TEST_SLICE: "6" diff --git a/.gitlab/ci/browser-integration.yml b/.gitlab/ci/browser-integration.yml new file mode 100644 index 000000000..6314e3b34 --- /dev/null +++ b/.gitlab/ci/browser-integration.yml @@ -0,0 +1,51 @@ +include: + + # browser-integration + - local: '/.gitlab/ci/browser-integration/facebook_chrome.yml' + - local: '/.gitlab/ci/browser-integration/facebook_ff.yml' + - local: '/.gitlab/ci/browser-integration/idoit_chrome.yml' + - local: '/.gitlab/ci/browser-integration/otrs_chrome.yml' + - local: '/.gitlab/ci/browser-integration/zendesk_chrome.yml' + +.template_browser-integration: &template_browser-integration + stage: browser-integration + dependencies: + - browser:build + extends: + - .env_base + - .variables_app_restart_cmd + - .services_postgresql_selenium + variables: + RAILS_ENV: "production" + AUTO_WIZARD_FILE: "contrib/auto_wizard_test.json" + script: + - RAILS_ENV=test bundle exec rake db:create + - cp $AUTO_WIZARD_FILE auto_wizard.json + - bundle exec rake zammad:ci:test:start + - bundle exec rails test $TEST_FILE + +.template_browser-integration_import: &template_browser-integration_import + stage: browser-integration + dependencies: + - browser:build + extends: + - .env_base + - .services_postgresql_selenium + variables: + RAILS_ENV: "production" + BROWSER: "chrome" + RAILS_SERVE_STATIC_FILES: "true" + script: + - RAILS_ENV=test bundle exec rake db:create + - bundle exec rake zammad:ci:test:start + - bundle exec rails test $TEST_FILE + +# we need at least one job to store and include this template +# $IGNORE is not defined +ignore: + stage: test + only: + variables: + - $IGNORE + script: + - '' diff --git a/.gitlab/ci/browser-integration/facebook_chrome.yml b/.gitlab/ci/browser-integration/facebook_chrome.yml new file mode 100644 index 000000000..b9362b8da --- /dev/null +++ b/.gitlab/ci/browser-integration/facebook_chrome.yml @@ -0,0 +1,6 @@ +facebook_chrome: + extends: + - .template_browser-integration + variables: + BROWSER: "chrome" + TEST_FILE: "test/integration/facebook_browser_test.rb" \ No newline at end of file diff --git a/.gitlab/ci/browser-integration/facebook_ff.yml b/.gitlab/ci/browser-integration/facebook_ff.yml new file mode 100644 index 000000000..2ddfe2687 --- /dev/null +++ b/.gitlab/ci/browser-integration/facebook_ff.yml @@ -0,0 +1,6 @@ +facebook_ff: + extends: + - .template_browser-integration + variables: + BROWSER: "firefox" + TEST_FILE: "test/integration/facebook_browser_test.rb" \ No newline at end of file diff --git a/.gitlab/ci/browser-integration/idoit_chrome.yml b/.gitlab/ci/browser-integration/idoit_chrome.yml new file mode 100644 index 000000000..9e583541f --- /dev/null +++ b/.gitlab/ci/browser-integration/idoit_chrome.yml @@ -0,0 +1,6 @@ +idoit_chrome: + extends: + - .template_browser-integration + variables: + BROWSER: "chrome" + TEST_FILE: "test/integration/idoit_browser_test.rb" diff --git a/.gitlab/ci/browser-integration/otrs_chrome.yml b/.gitlab/ci/browser-integration/otrs_chrome.yml new file mode 100644 index 000000000..fb8d230b4 --- /dev/null +++ b/.gitlab/ci/browser-integration/otrs_chrome.yml @@ -0,0 +1,5 @@ +otrs_chrome: + extends: + - .template_browser-integration_import + variables: + TEST_FILE: "test/integration/otrs_import_browser_test.rb" \ No newline at end of file diff --git a/.gitlab/ci/browser-integration/zendesk_chrome.yml b/.gitlab/ci/browser-integration/zendesk_chrome.yml new file mode 100644 index 000000000..e5d1b79c8 --- /dev/null +++ b/.gitlab/ci/browser-integration/zendesk_chrome.yml @@ -0,0 +1,5 @@ +zendesk_chrome: + extends: + - .template_browser-integration_import + variables: + TEST_FILE: "test/integration/zendesk_import_browser_test.rb" \ No newline at end of file diff --git a/.gitlab/ci/integration.yml b/.gitlab/ci/integration.yml new file mode 100644 index 000000000..c2c12f26d --- /dev/null +++ b/.gitlab/ci/integration.yml @@ -0,0 +1,30 @@ +include: + - local: '/.gitlab/ci/integration/clearbit.yml' + - local: '/.gitlab/ci/integration/email_helper_deliver.yml' + - local: '/.gitlab/ci/integration/es.yml' + - local: '/.gitlab/ci/integration/facebook.yml' + - local: '/.gitlab/ci/integration/geo.yml' + - local: '/.gitlab/ci/integration/otrs.yml' + - local: '/.gitlab/ci/integration/slack.yml' + - local: '/.gitlab/ci/integration/user_agent.yml' + - local: '/.gitlab/ci/integration/zendesk.yml' + +.template_integration: &template_integration + extends: + - .env_base + - .services_mysql_postgresql + tags: + - integration + stage: test + variables: + RAILS_ENV: "test" + +# we need at least one job to store and include this template +# $IGNORE is not defined +ignore: + stage: test + only: + variables: + - $IGNORE + script: + - '' \ No newline at end of file diff --git a/.gitlab/ci/integration/clearbit.yml b/.gitlab/ci/integration/clearbit.yml new file mode 100644 index 000000000..f70c8919c --- /dev/null +++ b/.gitlab/ci/integration/clearbit.yml @@ -0,0 +1,7 @@ +clearbit: + extends: + - .template_integration + script: + - bundle exec rake zammad:db:unseeded + - bundle exec rails test test/integration/clearbit_test.rb + allow_failure: true \ No newline at end of file diff --git a/.gitlab/ci/integration/email_helper_deliver.yml b/.gitlab/ci/integration/email_helper_deliver.yml new file mode 100644 index 000000000..148fd3572 --- /dev/null +++ b/.gitlab/ci/integration/email_helper_deliver.yml @@ -0,0 +1,10 @@ +email_helper_deliver: + extends: + - .template_integration + - .tags_mail + script: + - bundle exec rake zammad:db:unseeded + - bundle exec rails test test/integration/email_helper_test.rb + - bundle exec rails test test/integration/email_deliver_test.rb + - bundle exec rails test test/integration/email_keep_on_server_test.rb + - bundle exec rails test test/integration/email_postmaster_to_sender.rb \ No newline at end of file diff --git a/.gitlab/ci/integration/es.yml b/.gitlab/ci/integration/es.yml new file mode 100644 index 000000000..6317dd090 --- /dev/null +++ b/.gitlab/ci/integration/es.yml @@ -0,0 +1,32 @@ +.template_integration_es: &template_integration_es + extends: + - .env_base + - .services_mysql_postgresql_elasticsearch + - .variables_es + stage: test + tags: + - integration + script: + - bundle exec rake zammad:db:unseeded + - bundle exec rails test test/integration/elasticsearch_active_test.rb + - bundle exec rails test test/integration/elasticsearch_test.rb + - bundle exec rspec --tag searchindex --tag ~type:system + - bundle exec rails test test/integration/report_test.rb + +es:5.6: + <<: *template_integration_es + variables: + ELASTICSEARCH_TAG: '5.6' + RAILS_ENV: "test" + +es:6: + <<: *template_integration_es + variables: + ELASTICSEARCH_TAG: '6' + RAILS_ENV: "test" + +es:7: + <<: *template_integration_es + variables: + ELASTICSEARCH_TAG: '7' + RAILS_ENV: "test" diff --git a/.gitlab/ci/integration/facebook.yml b/.gitlab/ci/integration/facebook.yml new file mode 100644 index 000000000..fc216fdaa --- /dev/null +++ b/.gitlab/ci/integration/facebook.yml @@ -0,0 +1,7 @@ +facebook: + extends: + - .template_integration + script: + - bundle exec rake zammad:db:init + - bundle exec rails test test/integration/facebook_test.rb + allow_failure: true \ No newline at end of file diff --git a/.gitlab/ci/integration/geo.yml b/.gitlab/ci/integration/geo.yml new file mode 100644 index 000000000..e0498776b --- /dev/null +++ b/.gitlab/ci/integration/geo.yml @@ -0,0 +1,8 @@ +geo: + extends: + - .template_integration + script: + - bundle exec rake zammad:db:unseeded + - bundle exec rails test test/integration/geo_calendar_test.rb + - bundle exec rails test test/integration/geo_location_test.rb + - bundle exec rails test test/integration/geo_ip_test.rb diff --git a/.gitlab/ci/integration/otrs.yml b/.gitlab/ci/integration/otrs.yml new file mode 100644 index 000000000..696d09a63 --- /dev/null +++ b/.gitlab/ci/integration/otrs.yml @@ -0,0 +1,36 @@ +.template_integration_otrs: &template_integration_otrs + extends: + - .template_integration + script: + - bundle exec rake zammad:db:unseeded + - bundle exec rails test test/integration/otrs_import_test.rb + +otrs:6: + <<: *template_integration_otrs + variables: + IMPORT_OTRS_ENDPOINT: "https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" + +otrs:5: + <<: *template_integration_otrs + variables: + IMPORT_OTRS_ENDPOINT: "http://vz1109.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" + +otrs:4: + <<: *template_integration_otrs + variables: + IMPORT_OTRS_ENDPOINT: "http://vz383.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" + +otrs:33: + <<: *template_integration_otrs + variables: + IMPORT_OTRS_ENDPOINT: "http://vz305.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" + +otrs:32: + <<: *template_integration_otrs + variables: + IMPORT_OTRS_ENDPOINT: "http://vz382.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" + +otrs:31: + <<: *template_integration_otrs + variables: + IMPORT_OTRS_ENDPOINT: "http://vz381.demo.znuny.com/otrs/public.pl?Action=ZammadMigrator" diff --git a/.gitlab/ci/integration/slack.yml b/.gitlab/ci/integration/slack.yml new file mode 100644 index 000000000..7ce7b6439 --- /dev/null +++ b/.gitlab/ci/integration/slack.yml @@ -0,0 +1,8 @@ +slack: + extends: + - .template_integration + script: + - bundle exec rake zammad:db:unseeded + - echo "gem 'slack-api'" >> Gemfile.local + - bundle install -j $(nproc) + - bundle exec rails test test/integration/slack_test.rb \ No newline at end of file diff --git a/.gitlab/ci/integration/user_agent.yml b/.gitlab/ci/integration/user_agent.yml new file mode 100644 index 000000000..5ae5ecc7d --- /dev/null +++ b/.gitlab/ci/integration/user_agent.yml @@ -0,0 +1,9 @@ +user_agent: + extends: + - .template_integration + script: + - bundle exec rake zammad:db:unseeded + - bundle exec rails test test/integration/user_agent_test.rb + - export ZAMMAD_PROXY_TEST=true + - bundle exec rails test test/integration/user_agent_test.rb + allow_failure: true \ No newline at end of file diff --git a/.gitlab/ci/integration/zendesk.yml b/.gitlab/ci/integration/zendesk.yml new file mode 100644 index 000000000..67d6ecd97 --- /dev/null +++ b/.gitlab/ci/integration/zendesk.yml @@ -0,0 +1,6 @@ +zendesk: + extends: + - .template_integration + script: + - bundle exec rake zammad:db:unseeded + - bundle exec rails test test/integration/zendesk_import_test.rb diff --git a/.gitlab/ci/pre.yml b/.gitlab/ci/pre.yml new file mode 100644 index 000000000..1eb9bb380 --- /dev/null +++ b/.gitlab/ci/pre.yml @@ -0,0 +1,33 @@ +# Workaround to enable usage of mixed SSH and Docker GitLab CI runners +.template_pre: &template_pre + stage: pre + extends: + - .tags_docker + - .rules_singletest + before_script: + - '' # disable before_script for pre "non-application" env + +rubocop: + <<: *template_pre + script: + - bundle install -j $(nproc) --path vendor + - bundle exec rubocop + +coffeelint: + <<: *template_pre + script: + - coffeelint app/ + +bundle-audit: + <<: *template_pre + script: + - gem install bundler-audit + - bundle-audit update + - bundle-audit --ignore CVE-2015-9284 + +github: + <<: *template_pre + tags: + - deploy + script: + - script/build/sync_repo.sh git@github.com:zammad/zammad.git \ No newline at end of file diff --git a/.gitlab/ci/rspec.yml b/.gitlab/ci/rspec.yml new file mode 100644 index 000000000..ca77ef36d --- /dev/null +++ b/.gitlab/ci/rspec.yml @@ -0,0 +1,22 @@ +include: + - local: '/.gitlab/ci/rspec/mysql.yml' + - local: '/.gitlab/ci/rspec/postgresql.yml' + +.template_rspec: &template_rspec + extends: + - .env_base + variables: + RAILS_ENV: "test" + script: + - bundle exec rake zammad:db:init + - bundle exec rspec -t ~type:system -t ~searchindex + +# we need at least one job to store and include this template +# $IGNORE is not defined +ignore: + stage: test + only: + variables: + - $IGNORE + script: + - '' \ No newline at end of file diff --git a/.gitlab/ci/rspec/mysql.yml b/.gitlab/ci/rspec/mysql.yml new file mode 100644 index 000000000..00b06954b --- /dev/null +++ b/.gitlab/ci/rspec/mysql.yml @@ -0,0 +1,5 @@ +rspec:mysql: + stage: test + extends: + - .services_mysql + - .template_rspec \ No newline at end of file diff --git a/.gitlab/ci/rspec/postgresql.yml b/.gitlab/ci/rspec/postgresql.yml new file mode 100644 index 000000000..2d7c0665a --- /dev/null +++ b/.gitlab/ci/rspec/postgresql.yml @@ -0,0 +1,5 @@ +rspec:postgresql: + stage: test + extends: + - .services_postgresql + - .template_rspec \ No newline at end of file diff --git a/.gitlab/ci/unit.yml b/.gitlab/ci/unit.yml new file mode 100644 index 000000000..38f19e863 --- /dev/null +++ b/.gitlab/ci/unit.yml @@ -0,0 +1,24 @@ +include: + - local: '/.gitlab/ci/unit/mysql.yml' + - local: '/.gitlab/ci/unit/postgresql.yml' + +.template_unit: &template_unit + extends: + - .env_base + variables: + RAILS_ENV: "test" + script: + - bundle exec rake zammad:db:init + - bundle exec rake test:units + - bundle exec rails test test/integration/object_manager_test.rb + - bundle exec rails test test/integration/package_test.rb + +# we need at least one job to store and include this template +# $IGNORE is not defined +ignore: + stage: test + only: + variables: + - $IGNORE + script: + - '' \ No newline at end of file diff --git a/.gitlab/ci/unit/mysql.yml b/.gitlab/ci/unit/mysql.yml new file mode 100644 index 000000000..e4d617b70 --- /dev/null +++ b/.gitlab/ci/unit/mysql.yml @@ -0,0 +1,5 @@ +unit:mysql: + stage: test + extends: + - .services_mysql + - .template_unit \ No newline at end of file diff --git a/.gitlab/ci/unit/postgresql.yml b/.gitlab/ci/unit/postgresql.yml new file mode 100644 index 000000000..26ce8a638 --- /dev/null +++ b/.gitlab/ci/unit/postgresql.yml @@ -0,0 +1,5 @@ +unit:postgresql: + stage: test + extends: + - .services_postgresql + - .template_unit \ No newline at end of file