prepare_shop:
  git:
    shop_ref: '{{ .Data.global.git.default_ref }}'

# {{ $ids := "ddoewysiwyg" }}ids: {{ print $ids }}
# {{ $org := "ddoe" }}organisation: {{ print $org }}
# {{ $name := "wysiwyg-editor-module" }}name: {{ print $name }}
install_module:
  matrix:
    testplan: '["-"]'
  cache:
    prefix: &install_module_prefix 'moduleInstallation-ce-{{ .Github.SHA }}-{{ .Github.RunID }}'
  ids: &ids '{{ print $ids }}'
  activate: |
    ddoemedialibrary
    ddoewysiwyg
  git:
    module:
      url: &git_module_url '{{ .Github.Repository }}'
      ref: '{{ .Github.RefName }}'
  package_name: &package_name '{{ print $org }}/{{ print $name }}'
  path: *ids

phpunit:
  matrix:
    testplan: '["tests/github_actions/defaults/module_phpunit_unit.yml","tests/github_actions/defaults/module_phpunit_integration.yml"]'
  load_shop: *install_module_prefix

codeception:
  matrix:
    testplan: '["-"]'
  load_shop: *install_module_prefix
  title: codeception
  container:
    options: '-e THEME_ID=apex -e SELENIUM_SERVER_HOST=selenium -e BROWSER_NAME=chrome -e XDEBUG_MODE=coverage'
  configuration: '/var/www/vendor/{{ print $org }}/{{ print $name }}/tests/codeception.yml'
  suite: 'Acceptance'
  additional_options: '--coverage-xml=/var/www/codeception_coverage.xml -g {{ print $ids }}'
  logfile:
    prefix: 'codeception'
  output:
    prefix: 'codeception-artifacts'
  coverage:
    path: 'source/codeception_coverage.xml'

runtest:
  matrix:
    testplan: 'skip'
  load_shop: *install_module_prefix

styles:
  matrix:
    testplan: '["-"]'
  load_shop: *install_module_prefix
  path: *ids
  module_ids: *ids

sonarcloud:
  matrix:
    testplan: '["-"]'
  project_key: 'OXID-eSales_ddoe-wysiwyg-editor-module'
  project_name: *package_name
  strip_path: '/var/www/dev-packages/{{ .Data.install_module.ids }}/'
  parameters: |
    -Dsonar.language=php
    -Dsonar.scm.provider=git
    -Dsonar.sources=src
    -Dsonar.tests=tests

finish:
  slack_title: 'Module {{ print $name }} ({{ .Data.global.git.shop_ref }}) on {{ .Github.Repository }} by {{ .Github.Actor }}'
