Skip to content

Commit

Permalink
B 7.1.x fix gha oxdev 8573 jo (#17)
Browse files Browse the repository at this point in the history
* Adapt gdpr to what I use in the metapackage
* Fix the test script calls in composer.json
  • Loading branch information
joernott authored Sep 25, 2024
1 parent f927094 commit 50fc9a6
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 70 deletions.
124 changes: 65 additions & 59 deletions .github/oxid-esales/module-gdproptin.yaml
Original file line number Diff line number Diff line change
@@ -1,76 +1,82 @@
# {{ $ids := "oegdproptin" }}ids: {{ print $ids }}
# {{ $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 }}'

install_module:
matrix:
testplan: '["-"]'
title: '{{ print $name }}-{{ print $order }}'
install:
method: 'script'
copy_script_targets: |
vendor/oxid-esales/gdpr-optin-module/tests/scripts
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
prepared_shop: false
container:
options: '-e ESHOP_BOOTSTRAP_PATH=vendor/oxid-esales/oxideshop-ce/source/bootstrap.php'
composer:
transform: |
{
"minimum-stability": "dev",
"preferred-install": {
"oxid-esales/*": "source"
},
"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 }}"
},
"require-dev": {
"phpstan/phpstan": "^1.8.11",
"squizlabs/php_codesniffer": "3.*",
"phpmd/phpmd": "^2.11",
"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"
}
}
activate_modules:
oegdproptin

codeception:
runscript: &runscript
matrix:
testplan: '["-"]'
load_shop: *install_module_prefix
title: '{{ print $name }}-{{ print $order }}'
script: |
[
"gdpr_module:tests-unit -d /var/www/vendor/oxid-esales/gdpr-optin-module",
"gdpr_module:tests-integration -d /var/www/vendor/oxid-esales/gdpr-optin-module",
"gdpr_module:tests-codeception -d /var/www/vendor/oxid-esales/gdpr-optin-module"
]
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'
options: '-e XDEBUG_MODE=coverage -e THEME_ID=apex'
custom_script: |
perl -pi \
-e 's#views/twig#views/apex#g;' \
source/vendor/oxid-esales/gdpr-optin-module/tests/Codeception/acceptance.suite.yml
composer:
early: skip
gdpr_module:
path: 'vendor/oxid-esales/gdpr-optin-module'
workdir: '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-report -d /var/www/vendor/oxid-esales/gdpr-optin-module",
"gdpr_module:phpstan-report -d /var/www/vendor/oxid-esales/gdpr-optin-module",
"gdpr_module:phpmd-report -d /var/www/vendor/oxid-esales/gdpr-optin-module"
]
sonarcloud:
matrix:
testplan: '["-"]'
title: '{{ print $name }}-{{ print $order }}'
project_key: 'OXID-eSales_{{ print $name }}'
project_name: *package_name
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

finish:
slack_title: 'Module {{ print $name }} ({{ .Github.RefName }}) on {{ .Github.Repository }} by {{ .Github.Actor }}'
slack_title: 'gdpr-optin-module ({{ .Github.RefName }}) on {{ .Github.Repository }} by {{ .Github.Actor }}'
14 changes: 12 additions & 2 deletions .github/workflows/dispatch_module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ on:
- 'no'
- 'PHP8.1/MySQL5.7'
- 'PHP8.1/MySQL8.0'
- 'PHP8.1/MariaDB11'
- 'PHP8.2/MySQL5.7'
- 'PHP8.2/MySQL8.0'
- 'PHP8.2/MariaDB11'
- 'PHP8.3/MySQL5.7'
- 'PHP8.3/MySQL8.0'
- 'PHP8.3/MariaDB11'
default: 'PHP8.2/MySQL8.0'
description: 'Limit to one PHP/MySQL combination'
use_dev_version:
Expand All @@ -35,8 +40,13 @@ jobs:
"no") LIMIT='';;
"PHP8.1/MySQL5.7") LIMIT='~/defaults/php8.1_mysql5.7_only.yaml,' ;;
"PHP8.1/MySQL8.0") LIMIT='~/defaults/php8.1_mysql8.0_only.yaml,' ;;
"PHP8.1/MariaDB11") LIMIT='~/defaults/php8.1_mariadb11_only.yaml,' ;;
"PHP8.2/MySQL5.7") LIMIT='~/defaults/php8.2_mysql5.7_only.yaml,' ;;
"PHP8.2/MySQL8.0") LIMIT='~/defaults/php8.2_mysql8.0_only.yaml,' ;;
"PHP8.2/MariaDB11") LIMIT='~/defaults/php8.2_mariadb11_only.yaml,' ;;
"PHP8.3/MySQL5.7") LIMIT='~/defaults/php8.3_mysql5.7_only.yaml,' ;;
"PHP8.3/MySQL8.0") LIMIT='~/defaults/php8.3_mysql8.0_only.yaml,' ;;
"PHP8.3/MariaDB11") LIMIT='~/defaults/php8.3_mariadb11_only.yaml,' ;;
*) echo "Illegal choice, fix the workflow"
exit 1
;;
Expand All @@ -48,7 +58,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/universal_workflow_light.yaml@v4
with:
testplan: ${{ needs.build_testplan.outputs.testplan }}
runs_on: '"ubuntu-latest"'
Expand All @@ -67,7 +77,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/universal_workflow_light.yaml@v0
with:
testplan: ${{ needs.build_testplan.outputs.testplan }}
runs_on: '"ubuntu-latest"'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schedule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down
22 changes: 15 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,35 @@
},
"scripts": {
"phpcs": "phpcs --standard=tests/phpcs.xml --report=full",
"phpcs-report": "phpcs --standard=tests/phpcs.xml --report=json --report-file=phpcs.report.json",
"phpcs-report": "export PHPCS=/var/www/vendor/bin/phpcs ; if [ ! -x \"${PHPCS}\" ]; then export PHPCS=vendor/bin/phpcs ; fi ; ${PHPCS} --standard=tests/phpcs.xml --report=json --report-file=tests/Reports/phpcs.report.json",
"phpcbf": "phpcbf --standard=tests/phpcs.xml",

"phpstan": "phpstan -ctests/PhpStan/phpstan.neon analyse src/",
"phpstan-report": "phpstan -ctests/PhpStan/phpstan.neon analyse src/ --error-format=json >phpstan.report.json",
"phpstan-report": "export PHPSTAN=/var/www/vendor/bin/phpstan ; if [ ! -x \"${PHPSTAN}\" ]; then export PHPSTAN=vendor/bin/phpstan ; fi ; ${PHPSTAN} -ctests/PhpStan/phpstan.neon analyse src/ --error-format=json >tests/Reports/phpstan.report.json",

"phpmd": "phpmd src ansi tests/PhpMd/standard.xml --ignore-errors-on-exit --ignore-violations-on-exit",
"phpmd-report": "phpmd src json tests/PhpMd/standard.xml --ignore-errors-on-exit --ignore-violations-on-exit --reportfile phpmd.report.json",
"phpmd-report": "export PHPMD=/var/www/vendor/bin/phpmd ; if [ ! -x \"${PHPMD}\" ]; then export PHPMD=vendor/bin/phpmd ; fi ; ${PHPMD} src json tests/PhpMd/standard.xml --ignore-errors-on-exit --ignore-violations-on-exit --reportfile tests/Reports/phpmd.report.json",

"static": [
"@phpcs",
"@phpstan",
"@phpmd"
],

"phpunit": "vendor/bin/phpunit --bootstrap=/var/www/source/bootstrap.php --config=tests/",
"phpunit-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --bootstrap=/var/www/source/bootstrap.php --config=tests/ --coverage-html=tests/reports/coverage",
"tests-unit": [
"export PHPUNIT=/var/www/vendor/bin/phpunit ; if [ ! -x \"${PHPUNIT}\" ]; then export PHPUNIT=vendor/bin/phpunit ; fi ; XDEBUG_MODE=coverage $PHPUNIT --config=tests/ --testsuite=Unit --coverage-clover=tests/Reports/coverage_unit_module-template.xml 2>&1 | tee tests/Output/phpunit_unit.txt",
"if [ -x tests/script/check_log.sh ]; then tests/script/check_log.sh tests/Output/phpunit_unit.txt tests/script/unit_failure_pattern.txt ; fi"
],
"tests-integration": [
"export PHPUNIT=/var/www/vendor/bin/phpunit ; if [ ! -x \"${PHPUNIT}\" ]; then export PHPUNIT=vendor/bin/phpunit ; fi ; XDEBUG_MODE=coverage $PHPUNIT --bootstrap=/var/www/source/bootstrap.php --config=tests/ --testsuite=Integration --coverage-clover=tests/Reports/coverage_integration_module-template.xml 2>&1 | tee tests/Output/phpunit_integration.txt",
"if [ -x tests/script/check_log.sh ]; then tests/script/check_log.sh tests/Output/phpunit_integration.txt tests/script/integration_failure_pattern.txt ; fi"
],
"phpunit-coverage": "export PHPUNIT=/var/www/vendor/bin/phpunit ; if [ ! -x \"${PHPUNIT}\" ]; then export PHPUNIT=vendor/bin/phpunit ; fi ; echo \"PHPUNIT: ${PHPUNIT}\" ; XDEBUG_MODE=coverage $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"
"export CODECEPT=/var/www/vendor/bin/codecept ; if [ ! -x \"${CODECEPT}\" ]; then export CODECEPT=vendor/bin/codecept ; fi ; THEME_ID=apex MODULE_IDS=oegdproptin SHOP_ROOT_PATH=/var/www $CODECEPT run Acceptance -c tests/codeception.yml --no-redirect -o \"paths: output: tests/Output\" 2>&1 | tee tests/Output/codeception_Acceptance.txt",
"if [ -x tests/script/check_log.sh ]; then tests/script/check_log.sh tests/Output/codeception_Acceptance.txt tests/script/codeception_failure_pattern.txt ; fi"
]
},
"config": {
Expand Down

0 comments on commit 50fc9a6

Please sign in to comment.