diff --git a/.github/oxid-esales/module-gdproptin.yaml b/.github/oxid-esales/module-gdproptin.yaml index b81ddfc..88b38fb 100644 --- a/.github/oxid-esales/module-gdproptin.yaml +++ b/.github/oxid-esales/module-gdproptin.yaml @@ -2,75 +2,124 @@ # {{ $org := "oxid-esales" }}organisation: {{ print $org }} # {{ $name := "gdpr-optin-module" }}name: {{ print $name }} # {{ $order := "01" }}order: {{ print $order }} -prepare_shop: - git: - shop_ref: '{{ .Data.global.git.default_ref }}' +#prepare_shop: +# git: +# shop_ref: '{{ .Data.global.git.default_ref }}' +# +#install_module: +# matrix: +# testplan: '["-"]' +# title: '{{ print $name }}-{{ print $order }}' +# cache: +# prefix: &install_module_prefix 'moduleInstallation-ce-{{ .Github.SHA }}-{{ .Github.RunID }}' +# ids: &ids '{{ print $ids }}' +# activate: *ids +# git: +# module: +# url: &git_module_url '{{ .Github.Repository }}' +# ref: '{{ .Github.RefName }}' +# package_name: &package_name '{{ print $org }}/{{ print $name }}' +# path: *ids +# +#phpunit: +# matrix: +# testplan: '["~/defaults/module_phpunit_unit.yaml","~/defaults/module_phpunit_integration.yaml"]' +# load_shop: *install_module_prefix +# +#codeception: +# matrix: +# testplan: '["-"]' +# load_shop: *install_module_prefix +# title: '{{ print $name }}-{{ print $order }}' +# container: +# options: '-e SELENIUM_SERVER_HOST=selenium -e BROWSER_NAME=chrome -e XDEBUG_MODE=coverage -e THEME_ID=apex' +# configuration: '/var/www/vendor/oxid-esales/gdpr-optin-module/tests/codeception.yml' +# suite: 'Acceptance' +# additional_options: '--coverage-xml=/var/www/codeception_coverage.xml' +# logfile: +# prefix: 'codeception' +# output: +# prefix: 'codeception-artifacts' +# coverage: +# path: 'source/codeception_coverage.xml' -install_module: - matrix: - testplan: '["-"]' - title: '{{ print $name }}-{{ print $order }}' - cache: - prefix: &install_module_prefix 'moduleInstallation-ce-{{ .Github.SHA }}-{{ .Github.RunID }}' - ids: &ids '{{ print $ids }}' - activate: *ids - git: - module: - url: &git_module_url '{{ .Github.Repository }}' - ref: '{{ .Github.RefName }}' - package_name: &package_name '{{ print $org }}/{{ print $name }}' - path: *ids +#runtest: +# matrix: +# testplan: 'skip' +# title: '{{ print $name }}-{{ print $order }}' +# load_shop: *install_module_prefix -phpunit: - matrix: - testplan: '["~/defaults/module_phpunit_unit.yaml","~/defaults/module_phpunit_integration.yaml"]' - load_shop: *install_module_prefix +#phpcs_tests: +# skip: true + +#styles: +# matrix: +# testplan: '["-"]' +# title: '{{ print $name }}-{{ print $order }}' +# load_shop: *install_module_prefix +# path: *ids +# module_ids: *ids + +install_shop_with_modules: + cache: + prepared_shop: false + composer: + transform: | + { + "require": { + "oxid-esales/oxideshop-ce": "{{ .Data.global.composer.dev_ref }}", + "oxid-esales/twig-component": "{{ .Data.global.composer.dev_ref }}", + "oxid-esales/twig-admin-theme": "{{ .Data.global.composer.dev_ref }}", + "oxid-esales/apex-theme": "{{ .Data.global.composer.dev_ref }}", + "oxid-esales/gdpr-optin-module": "{{ .Data.global.composer.ref_name }}" + }, + "repositories": { + "oxid-esales/gdpr-optin-module": { + "type": "git", + "url": "https://github.com/OXID-eSales/gdpr-optin-module.git" + } + } + } + custom_script_container: | + vendor/bin/oe-console oe:database:reset --db-host=mysql --db-port=3306 --db-name=example --db-user=root --db-password=root --force + vendor/bin/oe-console oe:module:activate oegdproptin + vendor/bin/oe-console oe:theme:activate apex -codeception: +runscript: &runscript matrix: - testplan: '["-"]' - load_shop: *install_module_prefix - title: '{{ print $name }}-{{ print $order }}' - container: - options: '-e SELENIUM_SERVER_HOST=selenium -e BROWSER_NAME=chrome -e XDEBUG_MODE=coverage -e THEME_ID=apex' - configuration: '/var/www/vendor/oxid-esales/gdpr-optin-module/tests/codeception.yml' - suite: 'Acceptance' - additional_options: '--coverage-xml=/var/www/codeception_coverage.xml' - logfile: - prefix: 'codeception' - output: - prefix: 'codeception-artifacts' - coverage: - path: 'source/codeception_coverage.xml' + script: | + [ + "gdpr_module:tests-unit", + "gdpr_module:tests-integration", + "gdpr_module:tests-codeception" + ] + composer: + early: true + gdpr_module: + path: 'vendor/oxid-esales/gdpr-optin-module' -runtest: +runslim: + <<: *runscript matrix: - testplan: 'skip' - title: '{{ print $name }}-{{ print $order }}' - load_shop: *install_module_prefix + script: | + [ + "gdpr_module:phpcs", + "gdpr_module:phpstan", + "gdpr_module:phpmd" + ] sonarcloud: matrix: testplan: '["-"]' - title: '{{ print $name }}-{{ print $order }}' - project_key: 'OXID-eSales_{{ print $name }}' - project_name: *package_name + strip_path: '/var/www/vendor/oxid-esales/gdpr-optin-module/' + project_key: 'OXID-eSales_gdpr-optin-module' + project_name: 'oxid-esales/gdpr-optin-module' parameters: | -Dsonar.language=php -Dsonar.scm.provider=git -Dsonar.sources=src -Dsonar.tests=tests - -phpcs_tests: - skip: true - -styles: - matrix: - testplan: '["-"]' - title: '{{ print $name }}-{{ print $order }}' - load_shop: *install_module_prefix - path: *ids - module_ids: *ids + -Dsonar.php.phpstan.reportPaths=coverage-reports/phpstan.report.json finish: slack_title: 'Module {{ print $name }} ({{ .Github.RefName }}) on {{ .Github.Repository }} by {{ .Github.Actor }}' diff --git a/.github/workflows/dispatch_module.yaml b/.github/workflows/dispatch_module.yaml index 9bc4a07..5704467 100644 --- a/.github/workflows/dispatch_module.yaml +++ b/.github/workflows/dispatch_module.yaml @@ -1,5 +1,4 @@ name: Manual trigger -# Matrix workflow using re-usable github actions on: workflow_dispatch: @@ -27,7 +26,7 @@ jobs: testplan: '${{ steps.build.outputs.testplan }}' steps: - name: 'Build testplan' - id: build + id: build_testplan run: | # Build testplan # shellcheck disable=SC2088 # Tilde expansion happens in the workflow and not by bash @@ -48,7 +47,7 @@ jobs: dispatch_stable: if: ${{ inputs.use_dev_version == 'no' }} needs: build_testplan - uses: oxid-eSales/github-actions/.github/workflows/call-universal_test_workflow.yaml@v4 + uses: oxid-eSales/github-actions/.github/workflows/call-universal_workflow_light.yaml@v4 with: testplan: ${{ needs.build_testplan.outputs.testplan }} runs_on: '"ubuntu-latest"' @@ -67,7 +66,7 @@ jobs: dispatch_v0: if: ${{ inputs.use_dev_version == 'v0' }} needs: build_testplan - uses: oxid-eSales/github-actions/.github/workflows/call-universal_test_workflow.yaml@v0 + uses: oxid-eSales/github-actions/.github/workflows/call-universal_workflow_light.yaml@v0 with: testplan: ${{ needs.build_testplan.outputs.testplan }} runs_on: '"ubuntu-latest"' diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml index 8b3e515..bc6ccf8 100644 --- a/.github/workflows/schedule.yaml +++ b/.github/workflows/schedule.yaml @@ -6,7 +6,7 @@ on: jobs: module_gdproptin_71x_nightly: - uses: oxid-eSales/github-actions/.github/workflows/call-universal_test_workflow.yaml@v4 + uses: oxid-eSales/github-actions/.github/workflows/universal_workflow_light.yaml@v4 with: testplan: '~/defaults/7.1.x.yaml,~/defaults/scheduled.yaml,~/module-gdproptin.yaml' runs_on: '"ubuntu-latest"' diff --git a/.github/workflows/trigger.yaml b/.github/workflows/trigger.yaml index d14dd7b..3dea5e2 100644 --- a/.github/workflows/trigger.yaml +++ b/.github/workflows/trigger.yaml @@ -9,7 +9,7 @@ on: jobs: module-gdproptin_php82_mysql80: - uses: oxid-eSales/github-actions/.github/workflows/call-universal_test_workflow.yaml@v4 + uses: oxid-eSales/github-actions/.github/workflows/universal_workflow_light.yaml@v4 with: testplan: '~/defaults/7.1.x.yaml,~/module-gdproptin.yaml' runs_on: '"ubuntu-latest"' diff --git a/composer.json b/composer.json index a22df56..81c3b4d 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,14 @@ "squizlabs/php_codesniffer": "3.*", "phpmd/phpmd": "^2.11", "oxid-esales/oxideshop-ce": "dev-b-7.1.x", - "phpunit/phpunit": "^10.5" + "phpunit/phpunit": "^10.5", + "codeception/codeception": "*", + "codeception/module-asserts": "*", + "codeception/module-db": "*", + "codeception/module-filesystem": "*", + "codeception/module-webdriver": "*", + "oxid-esales/codeception-modules": "dev-b-7.1.x", + "oxid-esales/codeception-page-objects": "dev-b-7.1.x" }, "conflict": { "oxid-esales/oxideshop-ce": "<7.0" @@ -51,10 +58,11 @@ "@phpmd" ], - "phpunit": "vendor/bin/phpunit --bootstrap=/var/www/source/bootstrap.php --config=tests/", + "tests-unit": "XDEBUG_MODE=coverage vendor/bin/phpunit --config=tests/ --testsuite=Unit --coverage-clover=tests/Reports/coverage_unit_module-template.xml", + "tests-integration": "XDEBUG_MODE=coverage vendor/bin/phpunit --bootstrap=/var/www/source/bootstrap.php --config=tests/ --testsuite=Integration --coverage-clover=tests/Reports/coverage_integration_module-template.xml", "phpunit-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --bootstrap=/var/www/source/bootstrap.php --config=tests/ --coverage-html=tests/reports/coverage", - "codeception": [ + "tests-codeception": [ "Composer\\Config::disableProcessTimeout", "THEME_ID=apex MODULE_IDS=oegdproptin /var/www/vendor/bin/codecept run Acceptance -c /var/www/vendor/oxid-esales/gdpr-optin-module/tests/codeception.yml --no-redirect" ]