From 07b05144d25fd9992da1e653d45e95232e06084d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Fri, 19 Jul 2024 11:29:56 +0200 Subject: [PATCH 01/25] Add separate workdir parameter to run test script action --- .github/oxid-esales/defaults/defaults_light.yaml | 4 ++++ .github/oxid-esales/defaults/defaults_light.yml | 4 ++++ .github/workflows/universal_workflow_light.yaml | 10 ++++++---- .github/workflows/universal_workflow_light.yml | 10 ++++++---- run_test_script/action.yaml | 9 +++++++-- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.github/oxid-esales/defaults/defaults_light.yaml b/.github/oxid-esales/defaults/defaults_light.yaml index c68300cd..db084ab6 100644 --- a/.github/oxid-esales/defaults/defaults_light.yaml +++ b/.github/oxid-esales/defaults/defaults_light.yaml @@ -314,6 +314,10 @@ runscript: &runscript # The path pointing to the module relative to source/dev-packages needs to be the same as in install_module path: '' + # The working directory to when executing the script in the docker container. If not set, this + # defaults to the value of path + # workdir: '' + # Should we run composer install in the workdir? run_composer_install: true diff --git a/.github/oxid-esales/defaults/defaults_light.yml b/.github/oxid-esales/defaults/defaults_light.yml index c68300cd..db084ab6 100644 --- a/.github/oxid-esales/defaults/defaults_light.yml +++ b/.github/oxid-esales/defaults/defaults_light.yml @@ -314,6 +314,10 @@ runscript: &runscript # The path pointing to the module relative to source/dev-packages needs to be the same as in install_module path: '' + # The working directory to when executing the script in the docker container. If not set, this + # defaults to the value of path + # workdir: '' + # Should we run composer install in the workdir? run_composer_install: true diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index 7beef909..d912dda6 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -778,7 +778,7 @@ jobs: cache_bucket \ composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ custom_script custom_script_container \ - path install_options \ + path workdir install_options \ output_prefix coverage_prefix; do VAR="runscript_${PREFIX}_${KEY}" if [[ "${E}" != *"${VAR}"* ]]; then @@ -864,10 +864,11 @@ jobs: token: ${{ github.token }} - name: 'Run runscript check' - uses: 'OXID-eSales/github-actions/run_test_script@v4' + uses: 'OXID-eSales/github-actions/run_test_script@v0' with: script: ${{ steps.rt.outputs.runscript_script }} path: ${{ steps.rt.outputs.runscript_path }} + workdir: ${{ steps.rt.outputs.runscript_workdir || steps.rt.outputs.runscript_path }} run_composer_install: ${{ steps.rt.outputs.runscript_run_composer_install }} install_options: ${{ steps.rt.outputs.runscript_install_options }} container_name: ${{ steps.rt.outputs.runscript_container_name }} @@ -971,7 +972,7 @@ jobs: cache_bucket \ composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ custom_script custom_script_container \ - path install_options \ + path workdir install_options \ output_prefix coverage_prefix; do VAR="runslim_${PREFIX}_${KEY}" if [[ "${E}" != *"${VAR}"* ]]; then @@ -1048,10 +1049,11 @@ jobs: debug: ${{ needs.init.outputs.debug }} - name: 'Run runslim check' - uses: 'OXID-eSales/github-actions/run_test_script@v4' + uses: 'OXID-eSales/github-actions/run_test_script@v0' with: script: ${{ steps.rt.outputs.runslim_script }} path: ${{ steps.rt.outputs.runslim_path }} + workdir: ${{ steps.rt.outputs.runscript_workdir || steps.rt.outputs.runscript_path }} run_composer_install: ${{ steps.rt.outputs.runslim_run_composer_install }} install_options: ${{ steps.rt.outputs.runslim_install_options }} container_name: ${{ steps.rt.outputs.runslim_container_name }} diff --git a/.github/workflows/universal_workflow_light.yml b/.github/workflows/universal_workflow_light.yml index 7beef909..d912dda6 100644 --- a/.github/workflows/universal_workflow_light.yml +++ b/.github/workflows/universal_workflow_light.yml @@ -778,7 +778,7 @@ jobs: cache_bucket \ composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ custom_script custom_script_container \ - path install_options \ + path workdir install_options \ output_prefix coverage_prefix; do VAR="runscript_${PREFIX}_${KEY}" if [[ "${E}" != *"${VAR}"* ]]; then @@ -864,10 +864,11 @@ jobs: token: ${{ github.token }} - name: 'Run runscript check' - uses: 'OXID-eSales/github-actions/run_test_script@v4' + uses: 'OXID-eSales/github-actions/run_test_script@v0' with: script: ${{ steps.rt.outputs.runscript_script }} path: ${{ steps.rt.outputs.runscript_path }} + workdir: ${{ steps.rt.outputs.runscript_workdir || steps.rt.outputs.runscript_path }} run_composer_install: ${{ steps.rt.outputs.runscript_run_composer_install }} install_options: ${{ steps.rt.outputs.runscript_install_options }} container_name: ${{ steps.rt.outputs.runscript_container_name }} @@ -971,7 +972,7 @@ jobs: cache_bucket \ composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ custom_script custom_script_container \ - path install_options \ + path workdir install_options \ output_prefix coverage_prefix; do VAR="runslim_${PREFIX}_${KEY}" if [[ "${E}" != *"${VAR}"* ]]; then @@ -1048,10 +1049,11 @@ jobs: debug: ${{ needs.init.outputs.debug }} - name: 'Run runslim check' - uses: 'OXID-eSales/github-actions/run_test_script@v4' + uses: 'OXID-eSales/github-actions/run_test_script@v0' with: script: ${{ steps.rt.outputs.runslim_script }} path: ${{ steps.rt.outputs.runslim_path }} + workdir: ${{ steps.rt.outputs.runscript_workdir || steps.rt.outputs.runscript_path }} run_composer_install: ${{ steps.rt.outputs.runslim_run_composer_install }} install_options: ${{ steps.rt.outputs.runslim_install_options }} container_name: ${{ steps.rt.outputs.runslim_container_name }} diff --git a/run_test_script/action.yaml b/run_test_script/action.yaml index 2d19dd14..76e32e31 100644 --- a/run_test_script/action.yaml +++ b/run_test_script/action.yaml @@ -9,6 +9,11 @@ inputs: type: string required: true description: 'Workdir for the script' + workdir: + type: string + required: false + description: 'Workdir for the script' + default: '' run_composer_install: type: boolean required: false @@ -73,7 +78,7 @@ runs: docker compose ${{ inputs.container_method }} -T \ -e GITHUB_TOKEN=${{ inputs.github_token }} \ ${{ inputs.container_options }} \ - --workdir '/var/www/${{ inputs.path }}' \ + --workdir '/var/www/${{ inputs.workdir }}' \ ${{ inputs.container_name }} \ composer ${{ inputs.script }} @@ -104,7 +109,7 @@ runs: docker compose ${{ inputs.container_method }} -T \ -e GITHUB_TOKEN=${{ inputs.github_token }} \ ${{ inputs.container_options }} \ - --workdir '/var/www/${{ inputs.path }}' \ + --workdir '/var/www/${{ inputs.workdir }}' \ ${{ inputs.container_name }} \ /var/www/${{ inputs.path }}/${SCRIPT} From ff2727ffb30843d8565f1bd3f092f3f8193e6cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Fri, 19 Jul 2024 12:42:00 +0200 Subject: [PATCH 02/25] Allow empty workdir --- .github/workflows/universal_workflow_light.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index d912dda6..a0e32d1a 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -868,7 +868,7 @@ jobs: with: script: ${{ steps.rt.outputs.runscript_script }} path: ${{ steps.rt.outputs.runscript_path }} - workdir: ${{ steps.rt.outputs.runscript_workdir || steps.rt.outputs.runscript_path }} + workdir: ${{ steps.rt.outputs.runscript_workdir }} run_composer_install: ${{ steps.rt.outputs.runscript_run_composer_install }} install_options: ${{ steps.rt.outputs.runscript_install_options }} container_name: ${{ steps.rt.outputs.runscript_container_name }} @@ -1053,7 +1053,7 @@ jobs: with: script: ${{ steps.rt.outputs.runslim_script }} path: ${{ steps.rt.outputs.runslim_path }} - workdir: ${{ steps.rt.outputs.runscript_workdir || steps.rt.outputs.runscript_path }} + workdir: ${{ steps.rt.outputs.runscript_workdir }} run_composer_install: ${{ steps.rt.outputs.runslim_run_composer_install }} install_options: ${{ steps.rt.outputs.runslim_install_options }} container_name: ${{ steps.rt.outputs.runslim_container_name }} From 91a684aeec546efcfe7084bc81e472678bf12147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Fri, 19 Jul 2024 12:42:54 +0200 Subject: [PATCH 03/25] Allow empty workdir --- .github/workflows/universal_workflow_light.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/universal_workflow_light.yml b/.github/workflows/universal_workflow_light.yml index d912dda6..a0e32d1a 100644 --- a/.github/workflows/universal_workflow_light.yml +++ b/.github/workflows/universal_workflow_light.yml @@ -868,7 +868,7 @@ jobs: with: script: ${{ steps.rt.outputs.runscript_script }} path: ${{ steps.rt.outputs.runscript_path }} - workdir: ${{ steps.rt.outputs.runscript_workdir || steps.rt.outputs.runscript_path }} + workdir: ${{ steps.rt.outputs.runscript_workdir }} run_composer_install: ${{ steps.rt.outputs.runscript_run_composer_install }} install_options: ${{ steps.rt.outputs.runscript_install_options }} container_name: ${{ steps.rt.outputs.runscript_container_name }} @@ -1053,7 +1053,7 @@ jobs: with: script: ${{ steps.rt.outputs.runslim_script }} path: ${{ steps.rt.outputs.runslim_path }} - workdir: ${{ steps.rt.outputs.runscript_workdir || steps.rt.outputs.runscript_path }} + workdir: ${{ steps.rt.outputs.runscript_workdir }} run_composer_install: ${{ steps.rt.outputs.runslim_run_composer_install }} install_options: ${{ steps.rt.outputs.runslim_install_options }} container_name: ${{ steps.rt.outputs.runslim_container_name }} From b9a4036d5dc1239a38b1d8b609de24ce3b8b8ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Fri, 19 Jul 2024 13:24:15 +0200 Subject: [PATCH 04/25] Set absolute path var --- run_test_script/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run_test_script/action.yaml b/run_test_script/action.yaml index 76e32e31..d4b4a94b 100644 --- a/run_test_script/action.yaml +++ b/run_test_script/action.yaml @@ -78,6 +78,7 @@ runs: docker compose ${{ inputs.container_method }} -T \ -e GITHUB_TOKEN=${{ inputs.github_token }} \ ${{ inputs.container_options }} \ + -e ABSOLUTE_PATH=${{ inputs.path }} \ --workdir '/var/www/${{ inputs.workdir }}' \ ${{ inputs.container_name }} \ composer ${{ inputs.script }} @@ -109,6 +110,7 @@ runs: docker compose ${{ inputs.container_method }} -T \ -e GITHUB_TOKEN=${{ inputs.github_token }} \ ${{ inputs.container_options }} \ + -e ABSOLUTE_PATH=${{ inputs.path }} \ --workdir '/var/www/${{ inputs.workdir }}' \ ${{ inputs.container_name }} \ /var/www/${{ inputs.path }}/${SCRIPT} From 0346eb2a640a38c54f177eccdf1cec506109e717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Mon, 22 Jul 2024 11:15:45 +0200 Subject: [PATCH 05/25] Add generic scripts --- .github/oxid-esales/scripts/check_log.sh | 40 +++++++++ .github/oxid-esales/scripts/codeception.sh | 90 +++++++++++++++++++ .../scripts/codeception_failure_pattern.txt | 17 ++++ .github/oxid-esales/scripts/integration.sh | 83 +++++++++++++++++ .../scripts/integration_failure_pattern.txt | 17 ++++ .github/oxid-esales/scripts/unit.sh | 75 ++++++++++++++++ .../scripts/unit_failure_pattern.txt | 17 ++++ 7 files changed, 339 insertions(+) create mode 100755 .github/oxid-esales/scripts/check_log.sh create mode 100644 .github/oxid-esales/scripts/codeception.sh create mode 100644 .github/oxid-esales/scripts/codeception_failure_pattern.txt create mode 100644 .github/oxid-esales/scripts/integration.sh create mode 100644 .github/oxid-esales/scripts/integration_failure_pattern.txt create mode 100644 .github/oxid-esales/scripts/unit.sh create mode 100644 .github/oxid-esales/scripts/unit_failure_pattern.txt diff --git a/.github/oxid-esales/scripts/check_log.sh b/.github/oxid-esales/scripts/check_log.sh new file mode 100755 index 00000000..2c5e14eb --- /dev/null +++ b/.github/oxid-esales/scripts/check_log.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Usage: +# check_log.sh path/to/log path/to/failure/patterns +# check_log checks if a given log file is not empty or contains patterns that are +# listed in the pattern file. +# It requires two inputs: +# The first input is the name of the log file to check, and the second input is the +# pattern file, where every line contains a grep -E compatible pattern to search for +# The script returns 0, if the log file exists, is not empty and does not contain any +# of the patterns in the pattern file. It returns 1 otherwise + +LOG_FILE="${1}" +PATTERN_FILE="${2}" +RESULT=0 + +if [ ! -s "${LOG_FILE}" ]; then + echo -e "\033[0;31mLog file '${LOG_FILE}' is empty! Seems like no tests have been run!\033[0m" + RESULT=1 +fi +if [ ! -f "${PATTERN_FILE}" ]; then + echo -e "\033[0;31mPattern file '${PATTERN_FILE}' does not exist!\033[0m" + RESULT=1 +fi +[[ ${RESULT} -gt 0 ]] && exit 1 + +# shellcheck disable=SC2016 +sed -e 's|(.*)\r|$1|' -i "${PATTERN_FILE}" +while read -r LINE ; do + if [ -n "${LINE}" ]; then + if grep -q -E "${LINE}" "${LOG_FILE}"; then + echo -e "\033[0;31m Log contains matching pattern ${LINE}\033[0m" + grep -E "${LINE}" "${LOG_FILE}" + RESULT=1 + else + echo -e "\033[0;32m Log dioes not contain matching pattern ${LINE}" + fi + fi +done <"${PATTERN_FILE}" +exit ${RESULT} diff --git a/.github/oxid-esales/scripts/codeception.sh b/.github/oxid-esales/scripts/codeception.sh new file mode 100644 index 00000000..4e00587a --- /dev/null +++ b/.github/oxid-esales/scripts/codeception.sh @@ -0,0 +1,90 @@ +#!/bin/bash +set -e +set -x + +function init() { + # shellcheck disable=SC2128 + if [[ ${BASH_SOURCE} = */* ]]; then + SCRIPT_DIR=${BASH_SOURCE%/*}/ + else + SCRIPT_DIR=./ + fi + if [ -z "${ABSOLUTE_PATH}" ]; then + ABSOLUTE_PATH="$(pwd)" + else + ABSOLUTE_PATH="/var/www/${ABSOLUTE_PATH}" + fi + + [[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Output" + [[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Reports" + + OUTPUT_DIR="${ABSOLUTE_PATH}/tests/Output" + REPORT_DIR="${ABSOLUTE_PATH}/tests/Reports" + + if [ -z "${SELENIUM_SERVER_HOST}" ]; then + SELENIUM_SERVER_HOST='selenium' + fi + + if [ -z "${SUITE}" ]; then + SUITE="Acceptance" + if [ ! -d "${ABSOLUTE_PATH}/tests/Codeception/${SUITE}" ]; then + SUITE="acceptance" + if [ ! -d "${ABSOLUTE_PATH}/tests/Codeception/${SUITE}" ]; then + echo -e "\033[0;31mCould not find suite Acceptance or acceptance in tests/Codeception\033[0m" + exit 1 + fi + fi + fi + LOG_FILE="${OUTPUT_DIR}/codeception_${SUITE}.txt" + PATTERN_FILE="${SCRIPT_DIR}/codeception_failure_pattern.txt" + + CODECEPT="vendor/bin/codecept" + if [ ! -f "${CODECEPT}" ]; then + CODECEPT="/var/www/${CODECEPT}" + if [ ! -f "${CODECEPT}" ]; then + echo -e "\033[0;31mCould not find codecept in vendor/bin or /var/www/vendor/bin\033[0m" + exit 1 + fi + fi + + cat <&1 \ +| tee "${LOG_FILE}" +RESULT=$? +echo "Codecept run exited with error code ${RESULT}" +"$SCRIPT_DIR/check_log.sh" "${LOG_FILE}" "${PATTERN_FILE}" diff --git a/.github/oxid-esales/scripts/codeception_failure_pattern.txt b/.github/oxid-esales/scripts/codeception_failure_pattern.txt new file mode 100644 index 00000000..a11a852c --- /dev/null +++ b/.github/oxid-esales/scripts/codeception_failure_pattern.txt @@ -0,0 +1,17 @@ +fail +\\.\\=\\= +Warning +Notice +Deprecated +Fatal +Error +DID NOT FINISH +Test file ".+" not found +Cannot open file +No tests executed +Could not read +Warnings: [1-9][0-9]* +Errors: [1-9][0-9]* +Failed: [1-9][0-9]* +Deprecations: [1-9][0-9]* +Risky: [1-9][0-9]* diff --git a/.github/oxid-esales/scripts/integration.sh b/.github/oxid-esales/scripts/integration.sh new file mode 100644 index 00000000..2e81d0ab --- /dev/null +++ b/.github/oxid-esales/scripts/integration.sh @@ -0,0 +1,83 @@ +#!/bin/bash +set -e +set -x +export XDEBUG_MODE=coverage + +if [ -z "${ABSOLUTE_PATH}" ]; then + ABSOLUTE_PATH="$(pwd)" +else + ABSOLUTE_PATH="/var/www/${ABSOLUTE_PATH}" +fi + +[[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Output" +[[ ! -d "${ABSOLUTE_PATH}/tests/Reports" ]] && mkdir "${ABSOLUTE_PATH}/tests/Reports" + +if [ -z "${SUITE}" ]; then + SUITE="${ABSOLUTE_PATH}/tests/Integration" +fi + +PHPUNIT="vendor/bin/phpunit" +if [ ! -f "${PHPUNIT}" ]; then + PHPUNIT="/var/www/${PHPUNIT}" + if [ ! -f "${PHPUNIT}" ]; then + echo -e "\033[0;31mCould not find phpunit in vendor/bin or /var/www/vendor/bin\033[0m" + exit 1 + fi +fi +BOOTSTRAP="/var/www/source/bootstrap.php" +if [ ! -f "${BOOTSTRAP}" ]; then + BOOTSTRAP="/var/www/vendor/oxid-esales/oxideshop-ce/tests/bootstrap.php" + if [ ! -f "${BOOTSTRAP}" ]; then + echo -e "\033[0;31mCould not find bootstrap.php in /var/www/tests or /var/www/oxid-esales/oxideshop-ce/tests\033[0m" + find /var/www -iname "bootstrap.php" + exit 1 + fi +fi +"${PHPUNIT}" \ + -c "${ABSOLUTE_PATH}/tests/phpunit.xml" \ + --bootstrap "${BOOTSTRAP}" \ + --coverage-clover="${ABSOLUTE_PATH}/tests/Reports/coverage_phpunit_integration.xml" \ + "${SUITE}" 2>&1 \ +| tee "${ABSOLUTE_PATH}/tests/Output/integration_tests.txt" +RESULT=$? +echo "phpunit exited with error code ${RESULT}" +if [ ! -s "${ABSOLUTE_PATH}/tests/Output/integration_tests.txt" ]; then + echo -e "\033[0;31mLog file is empty! Seems like no tests have been run!\033[0m" + RESULT=1 +fi +cat >"${ABSOLUTE_PATH}/integration_failure_pattern.tmp" <&1 \ +| tee "${LOG_FILE}" +RESULT=$? +echo "phpunit exited with error code ${RESULT}" +"${SCRIPT_DIR}/check_log.sh" "${LOG_FILE}" "${PATTERN_FILE}" diff --git a/.github/oxid-esales/scripts/unit_failure_pattern.txt b/.github/oxid-esales/scripts/unit_failure_pattern.txt new file mode 100644 index 00000000..a87c0fba --- /dev/null +++ b/.github/oxid-esales/scripts/unit_failure_pattern.txt @@ -0,0 +1,17 @@ +fail +\\.\\=\\= +Warning +Notice +Deprecated +Fatal +Error +DID NOT FINISH +Test file ".+" not found +Cannot open file +No tests executed +Could not read +Warnings: [1-9][0-9]* +Errors: [1-9][0-9]* +Failed: [1-9][0-9]* +Deprecations: [1-9][0-9]* +Risky: [1-9][0-9]* \ No newline at end of file From 671b6f904ec2eb0a733adeec85d6d1f3653ddeb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Mon, 22 Jul 2024 11:17:56 +0200 Subject: [PATCH 06/25] Add generic phpunit files --- .github/oxid-esales/scripts/phpunit10.xml | 27 ++++++++++++++++++++ .github/oxid-esales/scripts/phpunit9.xml | 31 +++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/oxid-esales/scripts/phpunit10.xml create mode 100644 .github/oxid-esales/scripts/phpunit9.xml diff --git a/.github/oxid-esales/scripts/phpunit10.xml b/.github/oxid-esales/scripts/phpunit10.xml new file mode 100644 index 00000000..f182e090 --- /dev/null +++ b/.github/oxid-esales/scripts/phpunit10.xml @@ -0,0 +1,27 @@ + + + + + + ./Unit + + + tests/Integration + + + + + ../src + + + diff --git a/.github/oxid-esales/scripts/phpunit9.xml b/.github/oxid-esales/scripts/phpunit9.xml new file mode 100644 index 00000000..6a46f4b6 --- /dev/null +++ b/.github/oxid-esales/scripts/phpunit9.xml @@ -0,0 +1,31 @@ + + + + + ../src + + + + + ./Unit + + + ./Integration + + + From 51a61668f8b8d750b491606641fd2cb905548601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Mon, 22 Jul 2024 11:24:39 +0200 Subject: [PATCH 07/25] Move scripts into defaults folder --- .github/oxid-esales/{ => defaults}/scripts/check_log.sh | 0 .github/oxid-esales/{ => defaults}/scripts/codeception.sh | 0 .../{ => defaults}/scripts/codeception_failure_pattern.txt | 0 .github/oxid-esales/{ => defaults}/scripts/integration.sh | 0 .../{ => defaults}/scripts/integration_failure_pattern.txt | 0 .github/oxid-esales/{ => defaults}/scripts/phpunit10.xml | 0 .github/oxid-esales/{ => defaults}/scripts/phpunit9.xml | 0 .github/oxid-esales/{ => defaults}/scripts/unit.sh | 0 .../oxid-esales/{ => defaults}/scripts/unit_failure_pattern.txt | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename .github/oxid-esales/{ => defaults}/scripts/check_log.sh (100%) rename .github/oxid-esales/{ => defaults}/scripts/codeception.sh (100%) rename .github/oxid-esales/{ => defaults}/scripts/codeception_failure_pattern.txt (100%) rename .github/oxid-esales/{ => defaults}/scripts/integration.sh (100%) rename .github/oxid-esales/{ => defaults}/scripts/integration_failure_pattern.txt (100%) rename .github/oxid-esales/{ => defaults}/scripts/phpunit10.xml (100%) rename .github/oxid-esales/{ => defaults}/scripts/phpunit9.xml (100%) rename .github/oxid-esales/{ => defaults}/scripts/unit.sh (100%) rename .github/oxid-esales/{ => defaults}/scripts/unit_failure_pattern.txt (100%) diff --git a/.github/oxid-esales/scripts/check_log.sh b/.github/oxid-esales/defaults/scripts/check_log.sh similarity index 100% rename from .github/oxid-esales/scripts/check_log.sh rename to .github/oxid-esales/defaults/scripts/check_log.sh diff --git a/.github/oxid-esales/scripts/codeception.sh b/.github/oxid-esales/defaults/scripts/codeception.sh similarity index 100% rename from .github/oxid-esales/scripts/codeception.sh rename to .github/oxid-esales/defaults/scripts/codeception.sh diff --git a/.github/oxid-esales/scripts/codeception_failure_pattern.txt b/.github/oxid-esales/defaults/scripts/codeception_failure_pattern.txt similarity index 100% rename from .github/oxid-esales/scripts/codeception_failure_pattern.txt rename to .github/oxid-esales/defaults/scripts/codeception_failure_pattern.txt diff --git a/.github/oxid-esales/scripts/integration.sh b/.github/oxid-esales/defaults/scripts/integration.sh similarity index 100% rename from .github/oxid-esales/scripts/integration.sh rename to .github/oxid-esales/defaults/scripts/integration.sh diff --git a/.github/oxid-esales/scripts/integration_failure_pattern.txt b/.github/oxid-esales/defaults/scripts/integration_failure_pattern.txt similarity index 100% rename from .github/oxid-esales/scripts/integration_failure_pattern.txt rename to .github/oxid-esales/defaults/scripts/integration_failure_pattern.txt diff --git a/.github/oxid-esales/scripts/phpunit10.xml b/.github/oxid-esales/defaults/scripts/phpunit10.xml similarity index 100% rename from .github/oxid-esales/scripts/phpunit10.xml rename to .github/oxid-esales/defaults/scripts/phpunit10.xml diff --git a/.github/oxid-esales/scripts/phpunit9.xml b/.github/oxid-esales/defaults/scripts/phpunit9.xml similarity index 100% rename from .github/oxid-esales/scripts/phpunit9.xml rename to .github/oxid-esales/defaults/scripts/phpunit9.xml diff --git a/.github/oxid-esales/scripts/unit.sh b/.github/oxid-esales/defaults/scripts/unit.sh similarity index 100% rename from .github/oxid-esales/scripts/unit.sh rename to .github/oxid-esales/defaults/scripts/unit.sh diff --git a/.github/oxid-esales/scripts/unit_failure_pattern.txt b/.github/oxid-esales/defaults/scripts/unit_failure_pattern.txt similarity index 100% rename from .github/oxid-esales/scripts/unit_failure_pattern.txt rename to .github/oxid-esales/defaults/scripts/unit_failure_pattern.txt From 2bbe7750b30dbccfaf87a48ef084a0f2b4276372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Mon, 22 Jul 2024 11:25:46 +0200 Subject: [PATCH 08/25] Fix integration --- .../defaults/scripts/integration.sh | 130 ++++++++---------- 1 file changed, 61 insertions(+), 69 deletions(-) diff --git a/.github/oxid-esales/defaults/scripts/integration.sh b/.github/oxid-esales/defaults/scripts/integration.sh index 2e81d0ab..64a46b20 100644 --- a/.github/oxid-esales/defaults/scripts/integration.sh +++ b/.github/oxid-esales/defaults/scripts/integration.sh @@ -2,82 +2,74 @@ set -e set -x export XDEBUG_MODE=coverage +function init() { + # shellcheck disable=SC2128 + if [[ ${BASH_SOURCE} = */* ]]; then + SCRIPT_DIR=${BASH_SOURCE%/*}/ + else + SCRIPT_DIR=./ + fi + if [ -z "${ABSOLUTE_PATH}" ]; then + ABSOLUTE_PATH="$(pwd)" + else + ABSOLUTE_PATH="/var/www/${ABSOLUTE_PATH}" + fi -if [ -z "${ABSOLUTE_PATH}" ]; then - ABSOLUTE_PATH="$(pwd)" -else - ABSOLUTE_PATH="/var/www/${ABSOLUTE_PATH}" -fi + [[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Output" + [[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Reports" -[[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Output" -[[ ! -d "${ABSOLUTE_PATH}/tests/Reports" ]] && mkdir "${ABSOLUTE_PATH}/tests/Reports" + OUTPUT_DIR="${ABSOLUTE_PATH}/tests/Output" + REPORT_DIR="${ABSOLUTE_PATH}/tests/Reports" + + if [ -z "${SUITE}" ]; then + SUITE="${ABSOLUTE_PATH}/tests/Integration" + fi -if [ -z "${SUITE}" ]; then - SUITE="${ABSOLUTE_PATH}/tests/Integration" -fi + LOG_FILE="${OUTPUT_DIR}/integration_${SUITE}.txt" + PATTERN_FILE="${SCRIPT_DIR}/integration_failure_pattern.txt" -PHPUNIT="vendor/bin/phpunit" -if [ ! -f "${PHPUNIT}" ]; then - PHPUNIT="/var/www/${PHPUNIT}" + PHPUNIT="vendor/bin/phpunit" if [ ! -f "${PHPUNIT}" ]; then - echo -e "\033[0;31mCould not find phpunit in vendor/bin or /var/www/vendor/bin\033[0m" - exit 1 + PHPUNIT="/var/www/${PHPUNIT}" + if [ ! -f "${PHPUNIT}" ]; then + echo -e "\033[0;31mCould not find phpunit in vendor/bin or /var/www/vendor/bin\033[0m" + exit 1 + fi fi -fi -BOOTSTRAP="/var/www/source/bootstrap.php" -if [ ! -f "${BOOTSTRAP}" ]; then - BOOTSTRAP="/var/www/vendor/oxid-esales/oxideshop-ce/tests/bootstrap.php" + + BOOTSTRAP="/var/www/source/bootstrap.php" if [ ! -f "${BOOTSTRAP}" ]; then - echo -e "\033[0;31mCould not find bootstrap.php in /var/www/tests or /var/www/oxid-esales/oxideshop-ce/tests\033[0m" - find /var/www -iname "bootstrap.php" - exit 1 + BOOTSTRAP="/var/www/vendor/oxid-esales/oxideshop-ce/tests/bootstrap.php" + if [ ! -f "${BOOTSTRAP}" ]; then + echo -e "\033[0;31mCould not find bootstrap.php in /var/www/tests or /var/www/oxid-esales/oxideshop-ce/tests\033[0m" + find /var/www -iname "bootstrap.php" + exit 1 + fi fi -fi -"${PHPUNIT}" \ - -c "${ABSOLUTE_PATH}/tests/phpunit.xml" \ - --bootstrap "${BOOTSTRAP}" \ - --coverage-clover="${ABSOLUTE_PATH}/tests/Reports/coverage_phpunit_integration.xml" \ - "${SUITE}" 2>&1 \ -| tee "${ABSOLUTE_PATH}/tests/Output/integration_tests.txt" + + XML_FILE="${ABSOLUTE_PATH}/tests/phpunit.xml" + COVERAGE_FILE="${REPORT_DIR}/coverage_phpunit_integration.xml" + + cat <&1 \ +| tee "${LOG_FILE}" RESULT=$? echo "phpunit exited with error code ${RESULT}" -if [ ! -s "${ABSOLUTE_PATH}/tests/Output/integration_tests.txt" ]; then - echo -e "\033[0;31mLog file is empty! Seems like no tests have been run!\033[0m" - RESULT=1 -fi -cat >"${ABSOLUTE_PATH}/integration_failure_pattern.tmp" < Date: Mon, 22 Jul 2024 12:10:23 +0200 Subject: [PATCH 09/25] Fix unitr/integration log file names --- .github/oxid-esales/defaults/scripts/integration.sh | 2 +- .github/oxid-esales/defaults/scripts/unit.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/oxid-esales/defaults/scripts/integration.sh b/.github/oxid-esales/defaults/scripts/integration.sh index 64a46b20..6b2cd3a8 100644 --- a/.github/oxid-esales/defaults/scripts/integration.sh +++ b/.github/oxid-esales/defaults/scripts/integration.sh @@ -25,7 +25,7 @@ function init() { SUITE="${ABSOLUTE_PATH}/tests/Integration" fi - LOG_FILE="${OUTPUT_DIR}/integration_${SUITE}.txt" + LOG_FILE="${OUTPUT_DIR}/phpunit_integration.txt" PATTERN_FILE="${SCRIPT_DIR}/integration_failure_pattern.txt" PHPUNIT="vendor/bin/phpunit" diff --git a/.github/oxid-esales/defaults/scripts/unit.sh b/.github/oxid-esales/defaults/scripts/unit.sh index e12ed8ab..f40690cc 100644 --- a/.github/oxid-esales/defaults/scripts/unit.sh +++ b/.github/oxid-esales/defaults/scripts/unit.sh @@ -25,7 +25,7 @@ function init() { SUITE="${ABSOLUTE_PATH}/tests/Unit" fi - LOG_FILE="${OUTPUT_DIR}/unit_${SUITE}.txt" + LOG_FILE="${OUTPUT_DIR}/phpunit_unit.txt" PATTERN_FILE="${SCRIPT_DIR}/unit_failure_pattern.txt" PHPUNIT="vendor/bin/phpunit" From 50b989ce3c8bb31c58ab2509928a8f9c9d469a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Mon, 22 Jul 2024 12:22:23 +0200 Subject: [PATCH 10/25] Add Suite parameter to codeception script --- .github/oxid-esales/defaults/scripts/codeception.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/oxid-esales/defaults/scripts/codeception.sh b/.github/oxid-esales/defaults/scripts/codeception.sh index 4e00587a..be0391bb 100644 --- a/.github/oxid-esales/defaults/scripts/codeception.sh +++ b/.github/oxid-esales/defaults/scripts/codeception.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e set -x +SUITE="${0}" function init() { # shellcheck disable=SC2128 From 3d94201a429778282e73d9a8fab474ea71b54cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Mon, 22 Jul 2024 12:45:36 +0200 Subject: [PATCH 11/25] Add Suite parameter to codeception script --- .github/oxid-esales/defaults/scripts/codeception.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/oxid-esales/defaults/scripts/codeception.sh b/.github/oxid-esales/defaults/scripts/codeception.sh index be0391bb..9edda211 100644 --- a/.github/oxid-esales/defaults/scripts/codeception.sh +++ b/.github/oxid-esales/defaults/scripts/codeception.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e set -x -SUITE="${0}" +SUITE="${1}" function init() { # shellcheck disable=SC2128 From 689012fcf316fdff6399630719da8111baff5068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Mon, 22 Jul 2024 12:49:23 +0200 Subject: [PATCH 12/25] Handle test script parameters better --- run_test_script/action.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/run_test_script/action.yaml b/run_test_script/action.yaml index d4b4a94b..b01c2ad1 100644 --- a/run_test_script/action.yaml +++ b/run_test_script/action.yaml @@ -102,10 +102,11 @@ runs: if [ ! -f "source/${{ inputs.path }}/${SCRIPT}" ]; then SCRIPT=$(echo '${{ inputs.script }}'|sed -e "s|^~/|${TESTDIR}/scripts/|") fi - if [ ! -f "source/${{ inputs.path }}/${SCRIPT}" ]; then - echo -e "\033[0;31m### Could not find source/${{ inputs.path }}/${SCRIPT} ###\033[0m" + S=$(echo "${SCRIPT}"|sed -e 's|\s.*||') + if [ ! -f "source/${{ inputs.path }}/${S}" ]; then + echo -e "\033[0;31m### Could not find source/${{ inputs.path }}/${S} ###\033[0m" fi - chmod a+x "source/${{ inputs.path }}/${SCRIPT}" + chmod a+x "source/${{ inputs.path }}/${S}" echo -e "\033[0;35m### Run ${SCRIPT} in ${{ inputs.path }} ###\033[0m" docker compose ${{ inputs.container_method }} -T \ -e GITHUB_TOKEN=${{ inputs.github_token }} \ From 3bc14efb327a07564c50e0c2562cd5a1a1982c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Tue, 23 Jul 2024 10:02:21 +0200 Subject: [PATCH 13/25] Backwards compatibility for workdir --- .../oxid-esales/defaults/defaults_light.yaml | 2 +- .../oxid-esales/defaults/defaults_light.yml | 2 +- .../workflows/universal_workflow_light.yaml | 30 +++++++++++++++---- .../workflows/universal_workflow_light.yml | 30 +++++++++++++++---- 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/.github/oxid-esales/defaults/defaults_light.yaml b/.github/oxid-esales/defaults/defaults_light.yaml index db084ab6..f18be184 100644 --- a/.github/oxid-esales/defaults/defaults_light.yaml +++ b/.github/oxid-esales/defaults/defaults_light.yaml @@ -316,7 +316,7 @@ runscript: &runscript # The working directory to when executing the script in the docker container. If not set, this # defaults to the value of path - # workdir: '' + workdir: '~' # Should we run composer install in the workdir? run_composer_install: true diff --git a/.github/oxid-esales/defaults/defaults_light.yml b/.github/oxid-esales/defaults/defaults_light.yml index db084ab6..f18be184 100644 --- a/.github/oxid-esales/defaults/defaults_light.yml +++ b/.github/oxid-esales/defaults/defaults_light.yml @@ -316,7 +316,7 @@ runscript: &runscript # The working directory to when executing the script in the docker container. If not set, this # defaults to the value of path - # workdir: '' + workdir: '~' # Should we run composer install in the workdir? run_composer_install: true diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index a0e32d1a..a3970532 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -778,7 +778,7 @@ jobs: cache_bucket \ composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ custom_script custom_script_container \ - path workdir install_options \ + path install_options \ output_prefix coverage_prefix; do VAR="runscript_${PREFIX}_${KEY}" if [[ "${E}" != *"${VAR}"* ]]; then @@ -790,10 +790,20 @@ jobs: ${!VAR} runscript_${KEY}_delimeter EOF - export "runslim_${KEY}"="${!VAR}" + export "runscript_${KEY}"="${!VAR}" done - if [ "${runslim_composer_early}" == 'false' ]; then - echo 'runslim_run_composer_install=true'| tee -a "${GITHUB_OUTPUT}" + if [ "${runscript_composer_early}" == 'false' ]; then + echo 'runscript_run_composer_install=true'| tee -a "${GITHUB_OUTPUT}" + fi + # If runscript_workdir is ~, it will be set to the value of runscript_path + VAR="runscript_${PREFIX}_workdir" + if [[ "${E}" != *"${VAR}"* ]]; then + VAR='runscript_workdir' + fi + if [ "$!{VAR}" == '~' ]; then + echo "runscript_workdir=${runscript_path}"| tee -a "${GITHUB_OUTPUT}" + else + echo "runscript_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" fi SUFFIX="${PREFIX}_${SCRIPT}-${{ steps.rstn.outputs.matrix_suffix }}" echo "runscript_suffix=${SUFFIX}"| \ @@ -972,7 +982,7 @@ jobs: cache_bucket \ composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ custom_script custom_script_container \ - path workdir install_options \ + path install_options \ output_prefix coverage_prefix; do VAR="runslim_${PREFIX}_${KEY}" if [[ "${E}" != *"${VAR}"* ]]; then @@ -989,6 +999,16 @@ jobs: if [ "${runslim_composer_early}" == 'false' ]; then echo 'runslim_run_composer_install=true'| tee -a "${GITHUB_OUTPUT}" fi + # If runslim_workdir is ~, it will be set to the value of runslim_path + VAR="runslim_${PREFIX}_workdir" + if [[ "${E}" != *"${VAR}"* ]]; then + VAR='runslim_workdir' + fi + if [ "$!{VAR}" == '~' ]; then + echo "runslim_workdir=${runslim_path}"| tee -a "${GITHUB_OUTPUT}" + else + echo "runslim_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" + fi SUFFIX="${PREFIX}_${SCRIPT}-${{ steps.rstn.outputs.matrix_suffix }}" echo "runslim_suffix=${SUFFIX}"|sed -E 's#"|,|:|<|>|\||\*|\?|\/|\\#_#g' | tee -a "${GITHUB_OUTPUT}" echo "runslim_title=${PREFIX}_${SCRIPT}"|sed -E 's#"|,|:|<|>|\||\*|\?|\/|\\#_#g' | tee -a "${GITHUB_OUTPUT}" diff --git a/.github/workflows/universal_workflow_light.yml b/.github/workflows/universal_workflow_light.yml index a0e32d1a..5e4e41aa 100644 --- a/.github/workflows/universal_workflow_light.yml +++ b/.github/workflows/universal_workflow_light.yml @@ -778,7 +778,7 @@ jobs: cache_bucket \ composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ custom_script custom_script_container \ - path workdir install_options \ + path install_options \ output_prefix coverage_prefix; do VAR="runscript_${PREFIX}_${KEY}" if [[ "${E}" != *"${VAR}"* ]]; then @@ -790,10 +790,20 @@ jobs: ${!VAR} runscript_${KEY}_delimeter EOF - export "runslim_${KEY}"="${!VAR}" + export "runscript_${KEY}"="${!VAR}" done - if [ "${runslim_composer_early}" == 'false' ]; then - echo 'runslim_run_composer_install=true'| tee -a "${GITHUB_OUTPUT}" + if [ "${runscript_composer_early}" == 'false' ]; then + echo 'runscript_run_composer_install=true'| tee -a "${GITHUB_OUTPUT}" + fi + # If runscript_workdir is ~, it will be set to the value of runscript_path + VAR="runscript_${PREFIX}_workdir" + if [[ "${E}" != *"${VAR}"* ]]; then + VAR='runscript_workdir' + fi + if [ "$!{VAR}" == '~' ]; then + echo "runscript_workdir=${runscript_path}"| tee -a "${GITHUB_OUTPUT}" + else + echo "runscript_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" fi SUFFIX="${PREFIX}_${SCRIPT}-${{ steps.rstn.outputs.matrix_suffix }}" echo "runscript_suffix=${SUFFIX}"| \ @@ -972,7 +982,7 @@ jobs: cache_bucket \ composer_file composer_backup composer_transform composer_update composer_update_options composer_early \ custom_script custom_script_container \ - path workdir install_options \ + path install_options \ output_prefix coverage_prefix; do VAR="runslim_${PREFIX}_${KEY}" if [[ "${E}" != *"${VAR}"* ]]; then @@ -989,6 +999,16 @@ jobs: if [ "${runslim_composer_early}" == 'false' ]; then echo 'runslim_run_composer_install=true'| tee -a "${GITHUB_OUTPUT}" fi + # If runscript_workdir is ~, it will be set to the value of runscript_path + VAR="runscript_${PREFIX}_workdir" + if [[ "${E}" != *"${VAR}"* ]]; then + VAR='runscript_workdir' + fi + if [ "$!{VAR}" == '~' ]; then + echo "runscript_workdir=${runscript_path}"| tee -a "${GITHUB_OUTPUT}" + else + echo "runscript_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" + fi SUFFIX="${PREFIX}_${SCRIPT}-${{ steps.rstn.outputs.matrix_suffix }}" echo "runslim_suffix=${SUFFIX}"|sed -E 's#"|,|:|<|>|\||\*|\?|\/|\\#_#g' | tee -a "${GITHUB_OUTPUT}" echo "runslim_title=${PREFIX}_${SCRIPT}"|sed -E 's#"|,|:|<|>|\||\*|\?|\/|\\#_#g' | tee -a "${GITHUB_OUTPUT}" From b88212903228d21412c58bee19a8dbadf782176c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Tue, 23 Jul 2024 10:23:34 +0200 Subject: [PATCH 14/25] Fix typo --- .github/workflows/universal_workflow_light.yaml | 4 ++-- .github/workflows/universal_workflow_light.yml | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index a3970532..b6da63e5 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -800,7 +800,7 @@ jobs: if [[ "${E}" != *"${VAR}"* ]]; then VAR='runscript_workdir' fi - if [ "$!{VAR}" == '~' ]; then + if [ "${!VAR}" == '~' ]; then echo "runscript_workdir=${runscript_path}"| tee -a "${GITHUB_OUTPUT}" else echo "runscript_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" @@ -1004,7 +1004,7 @@ jobs: if [[ "${E}" != *"${VAR}"* ]]; then VAR='runslim_workdir' fi - if [ "$!{VAR}" == '~' ]; then + if [ "${!VAR}" == '~' ]; then echo "runslim_workdir=${runslim_path}"| tee -a "${GITHUB_OUTPUT}" else echo "runslim_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" diff --git a/.github/workflows/universal_workflow_light.yml b/.github/workflows/universal_workflow_light.yml index 5e4e41aa..b6da63e5 100644 --- a/.github/workflows/universal_workflow_light.yml +++ b/.github/workflows/universal_workflow_light.yml @@ -800,7 +800,7 @@ jobs: if [[ "${E}" != *"${VAR}"* ]]; then VAR='runscript_workdir' fi - if [ "$!{VAR}" == '~' ]; then + if [ "${!VAR}" == '~' ]; then echo "runscript_workdir=${runscript_path}"| tee -a "${GITHUB_OUTPUT}" else echo "runscript_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" @@ -999,15 +999,15 @@ jobs: if [ "${runslim_composer_early}" == 'false' ]; then echo 'runslim_run_composer_install=true'| tee -a "${GITHUB_OUTPUT}" fi - # If runscript_workdir is ~, it will be set to the value of runscript_path - VAR="runscript_${PREFIX}_workdir" + # If runslim_workdir is ~, it will be set to the value of runslim_path + VAR="runslim_${PREFIX}_workdir" if [[ "${E}" != *"${VAR}"* ]]; then - VAR='runscript_workdir' + VAR='runslim_workdir' fi - if [ "$!{VAR}" == '~' ]; then - echo "runscript_workdir=${runscript_path}"| tee -a "${GITHUB_OUTPUT}" + if [ "${!VAR}" == '~' ]; then + echo "runslim_workdir=${runslim_path}"| tee -a "${GITHUB_OUTPUT}" else - echo "runscript_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" + echo "runslim_workdir=${!VAR}"| tee -a "${GITHUB_OUTPUT}" fi SUFFIX="${PREFIX}_${SCRIPT}-${{ steps.rstn.outputs.matrix_suffix }}" echo "runslim_suffix=${SUFFIX}"|sed -E 's#"|,|:|<|>|\||\*|\?|\/|\\#_#g' | tee -a "${GITHUB_OUTPUT}" From 7de9cf94b8634b4f5eb246abf961f3117dea0024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Tue, 23 Jul 2024 14:10:10 +0200 Subject: [PATCH 15/25] Add phpcs, phpmd and phpstan scripts --- .../defaults/scripts/codeception.sh | 1 - .../defaults/scripts/integration.sh | 1 - .../defaults/scripts/php-cs-report.sh | 46 +++++++++++++++ .../defaults/scripts/phpmd-report.sh | 53 ++++++++++++++++++ .../defaults/scripts/phpstan-report.sh | 56 +++++++++++++++++++ .github/oxid-esales/defaults/scripts/unit.sh | 1 - 6 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 .github/oxid-esales/defaults/scripts/php-cs-report.sh create mode 100644 .github/oxid-esales/defaults/scripts/phpmd-report.sh create mode 100644 .github/oxid-esales/defaults/scripts/phpstan-report.sh diff --git a/.github/oxid-esales/defaults/scripts/codeception.sh b/.github/oxid-esales/defaults/scripts/codeception.sh index 9edda211..1e006f15 100644 --- a/.github/oxid-esales/defaults/scripts/codeception.sh +++ b/.github/oxid-esales/defaults/scripts/codeception.sh @@ -53,7 +53,6 @@ function init() { Script directory: ${SCRIPT_DIR} Output directory: ${OUTPUT_DIR} Report directory: ${REPORT_DIR} - Script directory: ${SCRIPT_DIR} Selenium host: ${SELENIUM_SERVER_HOST} Suite: ${SUITE} Codeception: ${CODECEPT} diff --git a/.github/oxid-esales/defaults/scripts/integration.sh b/.github/oxid-esales/defaults/scripts/integration.sh index 6b2cd3a8..4308cd1d 100644 --- a/.github/oxid-esales/defaults/scripts/integration.sh +++ b/.github/oxid-esales/defaults/scripts/integration.sh @@ -55,7 +55,6 @@ function init() { Script directory: ${SCRIPT_DIR} Output directory: ${OUTPUT_DIR} Report directory: ${REPORT_DIR} - Script directory: ${SCRIPT_DIR} Suite: ${SUITE} Bootstrap: ${BOOTSTRAP} Config: ${XML_FILE} diff --git a/.github/oxid-esales/defaults/scripts/php-cs-report.sh b/.github/oxid-esales/defaults/scripts/php-cs-report.sh new file mode 100644 index 00000000..6edc0023 --- /dev/null +++ b/.github/oxid-esales/defaults/scripts/php-cs-report.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e +set -x +function init() { + if [[ ${BASH_SOURCE} = */* ]]; then + SCRIPT_DIR=${BASH_SOURCE%/*}/ + else + SCRIPT_DIR=./ + fi + if [ -z "${ABSOLUTE_PATH}" ]; then + ABSOLUTE_PATH="$(pwd)" + else + ABSOLUTE_PATH="/var/www/${ABSOLUTE_PATH}" + fi + + [[ ! -d "${ABSOLUTE_PATH}/tests/Reports" ]] && mkdir "${ABSOLUTE_PATH}/tests/Reports" + + REPORT_DIR="${ABSOLUTE_PATH}/tests/Reports" + + if [ -x vendor/bin/phpcs ]; then + PHPCS=vendor/bin/phpcs + else + if [ -x /var/www/vendor/bin/phpcs ]; then + PHPCS=/var/www/vendor/bin/phpcs + else + echo "Can't find phpcs in vendor/bin or /var/www/vendor/bin" + exit 1 + fi + fi + + XML_FILE="${ABSOLUTE_PATH}/tests/phpcs.xml" + REPORT_FILE="${REPORT_DIR}phpcs.report.json" + cat <"${REPORT_FILE}" diff --git a/.github/oxid-esales/defaults/scripts/unit.sh b/.github/oxid-esales/defaults/scripts/unit.sh index f40690cc..09336802 100644 --- a/.github/oxid-esales/defaults/scripts/unit.sh +++ b/.github/oxid-esales/defaults/scripts/unit.sh @@ -55,7 +55,6 @@ function init() { Script directory: ${SCRIPT_DIR} Output directory: ${OUTPUT_DIR} Report directory: ${REPORT_DIR} - Script directory: ${SCRIPT_DIR} Suite: ${SUITE} Bootstrap: ${BOOTSTRAP} Config: ${XML_FILE} From 46f8a4b496e27477eb9e85a14afa9ad170e184f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Tue, 23 Jul 2024 14:29:57 +0200 Subject: [PATCH 16/25] Fix runslim --- .github/workflows/universal_workflow_light.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index b6da63e5..c6595e7f 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -1073,7 +1073,7 @@ jobs: with: script: ${{ steps.rt.outputs.runslim_script }} path: ${{ steps.rt.outputs.runslim_path }} - workdir: ${{ steps.rt.outputs.runscript_workdir }} + workdir: ${{ steps.rt.outputs.runslim_workdir }} run_composer_install: ${{ steps.rt.outputs.runslim_run_composer_install }} install_options: ${{ steps.rt.outputs.runslim_install_options }} container_name: ${{ steps.rt.outputs.runslim_container_name }} From cc44b7c516cbe24ea60ffd76e2660e5cb2493159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Thu, 25 Jul 2024 12:02:51 +0200 Subject: [PATCH 17/25] Automatically copy default scripts --- .../oxid-esales/defaults/defaults_light.yaml | 3 ++ .../oxid-esales/defaults/defaults_light.yml | 3 ++ .../oxid-esales/defaults/scripts/check_log.sh | 12 ++++++++ .../workflows/universal_workflow_light.yaml | 3 +- .../workflows/universal_workflow_light.yml | 3 +- prepare_shop/action.yaml | 29 +++++++++++++++++++ 6 files changed, 51 insertions(+), 2 deletions(-) diff --git a/.github/oxid-esales/defaults/defaults_light.yaml b/.github/oxid-esales/defaults/defaults_light.yaml index f18be184..5e39f20b 100644 --- a/.github/oxid-esales/defaults/defaults_light.yaml +++ b/.github/oxid-esales/defaults/defaults_light.yaml @@ -201,6 +201,9 @@ install: # The path for the script to install the shop script: 'source/vendor/oxid-esales/oxideshop-ce/.github/oxid-esales/install.sh' + # Copy the default test scripts to these target folders (multiline possible, one folder per line) + copy_script_targets: tests/scripts + # This step installs the sdk, shop and module(s) install_shop_with_modules: matrix: *matrix diff --git a/.github/oxid-esales/defaults/defaults_light.yml b/.github/oxid-esales/defaults/defaults_light.yml index f18be184..5e39f20b 100644 --- a/.github/oxid-esales/defaults/defaults_light.yml +++ b/.github/oxid-esales/defaults/defaults_light.yml @@ -201,6 +201,9 @@ install: # The path for the script to install the shop script: 'source/vendor/oxid-esales/oxideshop-ce/.github/oxid-esales/install.sh' + # Copy the default test scripts to these target folders (multiline possible, one folder per line) + copy_script_targets: tests/scripts + # This step installs the sdk, shop and module(s) install_shop_with_modules: matrix: *matrix diff --git a/.github/oxid-esales/defaults/scripts/check_log.sh b/.github/oxid-esales/defaults/scripts/check_log.sh index 2c5e14eb..53341a74 100755 --- a/.github/oxid-esales/defaults/scripts/check_log.sh +++ b/.github/oxid-esales/defaults/scripts/check_log.sh @@ -14,6 +14,11 @@ LOG_FILE="${1}" PATTERN_FILE="${2}" RESULT=0 +if [ ! -e "${LOG_FILE}" ]; then + echo -e "\033[0;31mLog file '${LOG_FILE}' does not exist! Seems like no tests have been run!\033[0m" + RESULT=1 +fi + if [ ! -s "${LOG_FILE}" ]; then echo -e "\033[0;31mLog file '${LOG_FILE}' is empty! Seems like no tests have been run!\033[0m" RESULT=1 @@ -37,4 +42,11 @@ while read -r LINE ; do fi fi done <"${PATTERN_FILE}" + +if [ -s "/var/sync/logs/error_log.txt" ]; then + echo -e "\033[0;31mPHP error log is not empty!\033[0m" + cat /var/sync/logs/error_log.txt + RESULT=1 +fi + exit ${RESULT} diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index c6595e7f..1e21eafd 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -305,7 +305,7 @@ jobs: - name: 'Prepare Shop' id: prepare_shop - uses: 'OXID-eSales/github-actions/prepare_shop@v4' + uses: 'OXID-eSales/github-actions/prepare_shop@v0' with: container_name: ${{ steps.iltp.outputs.install_container_name }} container_options: ${{ steps.iltp.outputs.install_container_options }} @@ -337,6 +337,7 @@ jobs: composer_update_options: ${{ steps.iltp.outputs.install_composer_update_options}} composer_dev_ref: ${{ steps.iltp.outputs.install_composer_dev_ref}} enterprise_github_token: ${{ secrets.enterprise_github_token || github.token }} + copy_script_targets: ${{ steps.iltp.outputs.install_copy_script_targets }} debug: ${{ needs.init.outputs.debug }} - name: Run composer for each module diff --git a/.github/workflows/universal_workflow_light.yml b/.github/workflows/universal_workflow_light.yml index b6da63e5..4bcbc9a0 100644 --- a/.github/workflows/universal_workflow_light.yml +++ b/.github/workflows/universal_workflow_light.yml @@ -337,6 +337,7 @@ jobs: composer_update_options: ${{ steps.iltp.outputs.install_composer_update_options}} composer_dev_ref: ${{ steps.iltp.outputs.install_composer_dev_ref}} enterprise_github_token: ${{ secrets.enterprise_github_token || github.token }} + copy_script_targets: ${{ steps.iltp.outputs.install_copy_script_targets }} debug: ${{ needs.init.outputs.debug }} - name: Run composer for each module @@ -1073,7 +1074,7 @@ jobs: with: script: ${{ steps.rt.outputs.runslim_script }} path: ${{ steps.rt.outputs.runslim_path }} - workdir: ${{ steps.rt.outputs.runscript_workdir }} + workdir: ${{ steps.rt.outputs.runslim_workdir }} run_composer_install: ${{ steps.rt.outputs.runslim_run_composer_install }} install_options: ${{ steps.rt.outputs.runslim_install_options }} container_name: ${{ steps.rt.outputs.runslim_container_name }} diff --git a/prepare_shop/action.yaml b/prepare_shop/action.yaml index 8a6b4bae..455b0bf9 100644 --- a/prepare_shop/action.yaml +++ b/prepare_shop/action.yaml @@ -175,6 +175,11 @@ inputs: required: false description: 'secrets.DOCKER_HUB_TOKEN for docker login' default: '' + copy_script_targets: + type: string + description: 'Copy the test scripts to these target folders' + default: 'tests/scripts' + required: false debug: type: string description: 'Appended to debugging scripts' @@ -496,3 +501,27 @@ runs: if [ -f source/vendor/oxid-esales/oxideshop-ce/source/config.inc.php.dist ]; then cp source/vendor/oxid-esales/oxideshop-ce/source/config.inc.php.dist source/vendor/oxid-esales/oxideshop-ce/source/config.inc.php fi + + - name: 'Copy test scripts' + if: ${{ inputs.copy_script_targets != '' }} + shell: bash + run: | + # prepare_shop: Copy tests scripts + ${{ inputs.debug }} + cat >targets.tmp < Date: Thu, 25 Jul 2024 12:18:19 +0200 Subject: [PATCH 18/25] Automatically copy default scripts --- .github/workflows/universal_workflow_light.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/universal_workflow_light.yml b/.github/workflows/universal_workflow_light.yml index 4bcbc9a0..1e21eafd 100644 --- a/.github/workflows/universal_workflow_light.yml +++ b/.github/workflows/universal_workflow_light.yml @@ -305,7 +305,7 @@ jobs: - name: 'Prepare Shop' id: prepare_shop - uses: 'OXID-eSales/github-actions/prepare_shop@v4' + uses: 'OXID-eSales/github-actions/prepare_shop@v0' with: container_name: ${{ steps.iltp.outputs.install_container_name }} container_options: ${{ steps.iltp.outputs.install_container_options }} From 5fbaa6b6f2145773d2b8f7985d26d074c1c9a29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Thu, 25 Jul 2024 12:31:40 +0200 Subject: [PATCH 19/25] Handle tests and Tests folders in generic scripts --- .../defaults/scripts/codeception.sh | 24 ++++++++++++------- .../defaults/scripts/integration.sh | 21 ++++++++++------ .../defaults/scripts/php-cs-report.sh | 15 ++++++++---- .../defaults/scripts/phpmd-report.sh | 15 ++++++++---- .../defaults/scripts/phpstan-report.sh | 17 +++++++++---- .github/oxid-esales/defaults/scripts/unit.sh | 23 +++++++++++------- 6 files changed, 79 insertions(+), 36 deletions(-) diff --git a/.github/oxid-esales/defaults/scripts/codeception.sh b/.github/oxid-esales/defaults/scripts/codeception.sh index 1e006f15..69572fb9 100644 --- a/.github/oxid-esales/defaults/scripts/codeception.sh +++ b/.github/oxid-esales/defaults/scripts/codeception.sh @@ -15,12 +15,20 @@ function init() { else ABSOLUTE_PATH="/var/www/${ABSOLUTE_PATH}" fi + TESTDIR='tests' + if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}" ]; then + TESTDIR='Tests' + if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}" ]; then + echo -e "\033[0;31m### Could not find folder tests or Tests in ${ABSOLUTE_PATH} ###\033[0m" + exit 1 + fi + fi - [[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Output" - [[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Reports" + [[ ! -d "${ABSOLUTE_PATH}/${TESTDIR}/Output" ]] && mkdir "${ABSOLUTE_PATH}/${TESTDIR}/Output" + [[ ! -d "${ABSOLUTE_PATH}/${TESTDIR}/Output" ]] && mkdir "${ABSOLUTE_PATH}/${TESTDIR}/Reports" - OUTPUT_DIR="${ABSOLUTE_PATH}/tests/Output" - REPORT_DIR="${ABSOLUTE_PATH}/tests/Reports" + OUTPUT_DIR="${ABSOLUTE_PATH}/${TESTDIR}/Output" + REPORT_DIR="${ABSOLUTE_PATH}/${TESTDIR}/Reports" if [ -z "${SELENIUM_SERVER_HOST}" ]; then SELENIUM_SERVER_HOST='selenium' @@ -28,10 +36,10 @@ function init() { if [ -z "${SUITE}" ]; then SUITE="Acceptance" - if [ ! -d "${ABSOLUTE_PATH}/tests/Codeception/${SUITE}" ]; then + if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}/Codeception/${SUITE}" ]; then SUITE="acceptance" - if [ ! -d "${ABSOLUTE_PATH}/tests/Codeception/${SUITE}" ]; then - echo -e "\033[0;31mCould not find suite Acceptance or acceptance in tests/Codeception\033[0m" + if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}/Codeception/${SUITE}" ]; then + echo -e "\033[0;31mCould not find suite Acceptance or acceptance in ${TESTDIR}/Codeception\033[0m" exit 1 fi fi @@ -81,7 +89,7 @@ wait_for_selenium RESULT=$? echo "Codecept build exited with error code ${RESULT}" "${CODECEPT}" run "${SUITE}" \ - -c "${ABSOLUTE_PATH}/tests/codeception.yml" \ + -c "${ABSOLUTE_PATH}/${TESTDIR}/codeception.yml" \ --ext DotReporter \ -o "paths: output: ${OUTPUT_DIR}" 2>&1 \ | tee "${LOG_FILE}" diff --git a/.github/oxid-esales/defaults/scripts/integration.sh b/.github/oxid-esales/defaults/scripts/integration.sh index 4308cd1d..b559e7ab 100644 --- a/.github/oxid-esales/defaults/scripts/integration.sh +++ b/.github/oxid-esales/defaults/scripts/integration.sh @@ -14,15 +14,22 @@ function init() { else ABSOLUTE_PATH="/var/www/${ABSOLUTE_PATH}" fi + TESTDIR='tests' + if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}" ]; then + TESTDIR='Tests' + if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}" ]; then + echo -e "\033[0;31m### Could not find folder tests or Tests in ${ABSOLUTE_PATH} ###\033[0m" + exit 1 + fi + fi + [[ ! -d "${ABSOLUTE_PATH}/${TESTDIR}/Output" ]] && mkdir "${ABSOLUTE_PATH}/${TESTDIR}/Output" + [[ ! -d "${ABSOLUTE_PATH}/${TESTDIR}/Output" ]] && mkdir "${ABSOLUTE_PATH}/${TESTDIR}/Reports" - [[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Output" - [[ ! -d "${ABSOLUTE_PATH}/tests/Output" ]] && mkdir "${ABSOLUTE_PATH}/tests/Reports" - - OUTPUT_DIR="${ABSOLUTE_PATH}/tests/Output" - REPORT_DIR="${ABSOLUTE_PATH}/tests/Reports" + OUTPUT_DIR="${ABSOLUTE_PATH}/${TESTDIR}/Output" + REPORT_DIR="${ABSOLUTE_PATH}/${TESTDIR}/Reports" if [ -z "${SUITE}" ]; then - SUITE="${ABSOLUTE_PATH}/tests/Integration" + SUITE="${ABSOLUTE_PATH}/${TESTDIR}/Integration" fi LOG_FILE="${OUTPUT_DIR}/phpunit_integration.txt" @@ -39,7 +46,7 @@ function init() { BOOTSTRAP="/var/www/source/bootstrap.php" if [ ! -f "${BOOTSTRAP}" ]; then - BOOTSTRAP="/var/www/vendor/oxid-esales/oxideshop-ce/tests/bootstrap.php" + BOOTSTRAP="/var/www/vendor/oxid-esales/oxideshop-ce/${TESTDIR}/bootstrap.php" if [ ! -f "${BOOTSTRAP}" ]; then echo -e "\033[0;31mCould not find bootstrap.php in /var/www/tests or /var/www/oxid-esales/oxideshop-ce/tests\033[0m" find /var/www -iname "bootstrap.php" diff --git a/.github/oxid-esales/defaults/scripts/php-cs-report.sh b/.github/oxid-esales/defaults/scripts/php-cs-report.sh index 6edc0023..db58c11e 100644 --- a/.github/oxid-esales/defaults/scripts/php-cs-report.sh +++ b/.github/oxid-esales/defaults/scripts/php-cs-report.sh @@ -12,10 +12,17 @@ function init() { else ABSOLUTE_PATH="/var/www/${ABSOLUTE_PATH}" fi + TESTDIR='tests' + if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}" ]; then + TESTDIR='Tests' + if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}" ]; then + echo -e "\033[0;31m### Could not find folder tests or Tests in ${ABSOLUTE_PATH} ###\033[0m" + exit 1 + fi + fi + [[ ! -d "${ABSOLUTE_PATH}/${TESTDIR}/Reports" ]] && mkdir "${ABSOLUTE_PATH}/${TESTDIR}/Reports" - [[ ! -d "${ABSOLUTE_PATH}/tests/Reports" ]] && mkdir "${ABSOLUTE_PATH}/tests/Reports" - - REPORT_DIR="${ABSOLUTE_PATH}/tests/Reports" + REPORT_DIR="${ABSOLUTE_PATH}/${TESTDIR}/Reports" if [ -x vendor/bin/phpcs ]; then PHPCS=vendor/bin/phpcs @@ -28,7 +35,7 @@ function init() { fi fi - XML_FILE="${ABSOLUTE_PATH}/tests/phpcs.xml" + XML_FILE="${ABSOLUTE_PATH}/${TESTDIR}/phpcs.xml" REPORT_FILE="${REPORT_DIR}phpcs.report.json" cat < Date: Thu, 25 Jul 2024 13:45:31 +0200 Subject: [PATCH 20/25] Remove redundant composer run --- .github/workflows/universal_workflow_light.yaml | 12 ++++-------- .github/workflows/universal_workflow_light.yml | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index 1e21eafd..e3049959 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -400,16 +400,12 @@ jobs: rm .composer_merge.tmp.json fi echo -e "\033[0;35mRuning composer install for '${PREFIX}' in '${COMPOSER_PATH}' using 'runslim_${PREFIX}_path, ${E}\033[0m" - docker compose ${{ steps.iltp.outputs.install_shop_with_modules_container_method }} -T \ - ${{ steps.iltp.outputs.install_shop_with_modules_container_options }} \ - ${{ steps.iltp.outputs.install_shop_with_modules_container_name }} \ - composer update ${{ steps.iltp.outputs.install_shop_with_modules_composer_update_options}} -d "/var/www/${COMPOSER_PATH}" + docker compose ${{ steps.iltp.outputs.install_container_method }} -T \ + ${{ steps.iltp.outputs.install_container_options }} \ + ${{ steps.iltp.outputs.install_container_name }} \ + composer update ${{ steps.iltp.outputs.install_composer_update_options}} -d "/var/www/${COMPOSER_PATH}" fi done - docker compose ${{ steps.iltp.outputs.install_shop_with_modules_container_method }} -T \ - ${{ steps.iltp.outputs.install_shop_with_modules_container_options }} \ - ${{ steps.iltp.outputs.install_shop_with_modules_container_name }} \ - composer update ${{ steps.iltp.outputs.install_shop_with_modules_composer_update_options}} rm -rf ./load_testplan - name: Generate debugging script for running composer for each module diff --git a/.github/workflows/universal_workflow_light.yml b/.github/workflows/universal_workflow_light.yml index 1e21eafd..e3049959 100644 --- a/.github/workflows/universal_workflow_light.yml +++ b/.github/workflows/universal_workflow_light.yml @@ -400,16 +400,12 @@ jobs: rm .composer_merge.tmp.json fi echo -e "\033[0;35mRuning composer install for '${PREFIX}' in '${COMPOSER_PATH}' using 'runslim_${PREFIX}_path, ${E}\033[0m" - docker compose ${{ steps.iltp.outputs.install_shop_with_modules_container_method }} -T \ - ${{ steps.iltp.outputs.install_shop_with_modules_container_options }} \ - ${{ steps.iltp.outputs.install_shop_with_modules_container_name }} \ - composer update ${{ steps.iltp.outputs.install_shop_with_modules_composer_update_options}} -d "/var/www/${COMPOSER_PATH}" + docker compose ${{ steps.iltp.outputs.install_container_method }} -T \ + ${{ steps.iltp.outputs.install_container_options }} \ + ${{ steps.iltp.outputs.install_container_name }} \ + composer update ${{ steps.iltp.outputs.install_composer_update_options}} -d "/var/www/${COMPOSER_PATH}" fi done - docker compose ${{ steps.iltp.outputs.install_shop_with_modules_container_method }} -T \ - ${{ steps.iltp.outputs.install_shop_with_modules_container_options }} \ - ${{ steps.iltp.outputs.install_shop_with_modules_container_name }} \ - composer update ${{ steps.iltp.outputs.install_shop_with_modules_composer_update_options}} rm -rf ./load_testplan - name: Generate debugging script for running composer for each module From a974bf0afdcda8c6cffc0d393ac900da4d8e24d8 Mon Sep 17 00:00:00 2001 From: joernott Date: Thu, 25 Jul 2024 12:29:22 +0000 Subject: [PATCH 21/25] Update versions --- .github/workflows/universal_workflow_light.yaml | 6 +++--- .github/workflows/universal_workflow_light.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index e3049959..2777eb6e 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -305,7 +305,7 @@ jobs: - name: 'Prepare Shop' id: prepare_shop - uses: 'OXID-eSales/github-actions/prepare_shop@v0' + uses: 'OXID-eSales/github-actions/prepare_shop@v4' with: container_name: ${{ steps.iltp.outputs.install_container_name }} container_options: ${{ steps.iltp.outputs.install_container_options }} @@ -871,7 +871,7 @@ jobs: token: ${{ github.token }} - name: 'Run runscript check' - uses: 'OXID-eSales/github-actions/run_test_script@v0' + uses: 'OXID-eSales/github-actions/run_test_script@v4' with: script: ${{ steps.rt.outputs.runscript_script }} path: ${{ steps.rt.outputs.runscript_path }} @@ -1066,7 +1066,7 @@ jobs: debug: ${{ needs.init.outputs.debug }} - name: 'Run runslim check' - uses: 'OXID-eSales/github-actions/run_test_script@v0' + uses: 'OXID-eSales/github-actions/run_test_script@v4' with: script: ${{ steps.rt.outputs.runslim_script }} path: ${{ steps.rt.outputs.runslim_path }} diff --git a/.github/workflows/universal_workflow_light.yml b/.github/workflows/universal_workflow_light.yml index e3049959..2777eb6e 100644 --- a/.github/workflows/universal_workflow_light.yml +++ b/.github/workflows/universal_workflow_light.yml @@ -305,7 +305,7 @@ jobs: - name: 'Prepare Shop' id: prepare_shop - uses: 'OXID-eSales/github-actions/prepare_shop@v0' + uses: 'OXID-eSales/github-actions/prepare_shop@v4' with: container_name: ${{ steps.iltp.outputs.install_container_name }} container_options: ${{ steps.iltp.outputs.install_container_options }} @@ -871,7 +871,7 @@ jobs: token: ${{ github.token }} - name: 'Run runscript check' - uses: 'OXID-eSales/github-actions/run_test_script@v0' + uses: 'OXID-eSales/github-actions/run_test_script@v4' with: script: ${{ steps.rt.outputs.runscript_script }} path: ${{ steps.rt.outputs.runscript_path }} @@ -1066,7 +1066,7 @@ jobs: debug: ${{ needs.init.outputs.debug }} - name: 'Run runslim check' - uses: 'OXID-eSales/github-actions/run_test_script@v0' + uses: 'OXID-eSales/github-actions/run_test_script@v4' with: script: ${{ steps.rt.outputs.runslim_script }} path: ${{ steps.rt.outputs.runslim_path }} From abddd8fc90386db56ac5787bdfed5a1d4eb27d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Fri, 26 Jul 2024 11:06:57 +0200 Subject: [PATCH 22/25] Remove script debugging as it blows up the logs --- .github/oxid-esales/defaults/scripts/codeception.sh | 1 - .github/oxid-esales/defaults/scripts/integration.sh | 1 - .github/oxid-esales/defaults/scripts/phpmd-report.sh | 2 +- .github/oxid-esales/defaults/scripts/phpstan-report.sh | 1 - .github/oxid-esales/defaults/scripts/unit.sh | 1 - 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/oxid-esales/defaults/scripts/codeception.sh b/.github/oxid-esales/defaults/scripts/codeception.sh index 69572fb9..7ca25c3e 100644 --- a/.github/oxid-esales/defaults/scripts/codeception.sh +++ b/.github/oxid-esales/defaults/scripts/codeception.sh @@ -1,6 +1,5 @@ #!/bin/bash set -e -set -x SUITE="${1}" function init() { diff --git a/.github/oxid-esales/defaults/scripts/integration.sh b/.github/oxid-esales/defaults/scripts/integration.sh index b559e7ab..ef80c948 100644 --- a/.github/oxid-esales/defaults/scripts/integration.sh +++ b/.github/oxid-esales/defaults/scripts/integration.sh @@ -1,6 +1,5 @@ #!/bin/bash set -e -set -x export XDEBUG_MODE=coverage function init() { # shellcheck disable=SC2128 diff --git a/.github/oxid-esales/defaults/scripts/phpmd-report.sh b/.github/oxid-esales/defaults/scripts/phpmd-report.sh index d5bfb5ca..c0e19d1f 100644 --- a/.github/oxid-esales/defaults/scripts/phpmd-report.sh +++ b/.github/oxid-esales/defaults/scripts/phpmd-report.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -x +set -e function init() { # shellcheck disable=SC2128 if [[ ${BASH_SOURCE} = */* ]]; then diff --git a/.github/oxid-esales/defaults/scripts/phpstan-report.sh b/.github/oxid-esales/defaults/scripts/phpstan-report.sh index 68778911..c660ccc2 100644 --- a/.github/oxid-esales/defaults/scripts/phpstan-report.sh +++ b/.github/oxid-esales/defaults/scripts/phpstan-report.sh @@ -1,5 +1,4 @@ #!/bin/bash -set -x set -e SOURCE_DIR="${1}" diff --git a/.github/oxid-esales/defaults/scripts/unit.sh b/.github/oxid-esales/defaults/scripts/unit.sh index c1efd310..9ec673b6 100644 --- a/.github/oxid-esales/defaults/scripts/unit.sh +++ b/.github/oxid-esales/defaults/scripts/unit.sh @@ -1,6 +1,5 @@ #!/bin/bash set -e -set -x export XDEBUG_MODE=coverage function init() { # shellcheck disable=SC2128 From 0236d1a73d7938a71d5e19cf990ad644f0a10835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Fri, 26 Jul 2024 11:24:06 +0200 Subject: [PATCH 23/25] Fix PE/EE template referencing the wrong branch for nightlies --- .github/oxid-esales/defaults/ee.yaml | 26 +++++++++++++------------- .github/oxid-esales/defaults/ee.yml | 26 +++++++++++++------------- .github/oxid-esales/defaults/pe.yaml | 20 ++++++++++---------- .github/oxid-esales/defaults/pe.yml | 20 ++++++++++---------- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/oxid-esales/defaults/ee.yaml b/.github/oxid-esales/defaults/ee.yaml index 45223ae2..8b34942a 100644 --- a/.github/oxid-esales/defaults/ee.yaml +++ b/.github/oxid-esales/defaults/ee.yaml @@ -30,17 +30,17 @@ install_shop_with_modules: &install "ddoe/*": "source" }, "require": { - "oxid-esales/oxideshop-pe": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/oxideshop-ee": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component-pe": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component-ee": "{{ .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/oxideshop-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/oxideshop-ee": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component-ee": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-admin-theme": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/apex-theme": "{{ .Data.global.composer.ref_name }}" }, "require-dev": { - "oxid-esales/codeception-modules": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/codeception-page-objects": "{{ .Data.global.composer.dev_ref }}" + "oxid-esales/codeception-modules": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/codeception-page-objects": "{{ .Data.global.composer.ref_name }}" }, "repositories": { "oxid-esales/twig-component-ee": { @@ -118,10 +118,10 @@ runtest: transform: | { "require-dev": { - "oxid-esales/testing-library": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-ce": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-pe": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-ee": "{{ .Data.global.composer.dev_ref }}", + "oxid-esales/testing-library": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-ce": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-ee": "{{ .Data.global.composer.ref_name }}", "codeception/module-webdriver": "^3.1", "phpunit/phpunit": "^9.1.1" }, diff --git a/.github/oxid-esales/defaults/ee.yml b/.github/oxid-esales/defaults/ee.yml index 45223ae2..8b34942a 100644 --- a/.github/oxid-esales/defaults/ee.yml +++ b/.github/oxid-esales/defaults/ee.yml @@ -30,17 +30,17 @@ install_shop_with_modules: &install "ddoe/*": "source" }, "require": { - "oxid-esales/oxideshop-pe": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/oxideshop-ee": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component-pe": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component-ee": "{{ .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/oxideshop-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/oxideshop-ee": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component-ee": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-admin-theme": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/apex-theme": "{{ .Data.global.composer.ref_name }}" }, "require-dev": { - "oxid-esales/codeception-modules": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/codeception-page-objects": "{{ .Data.global.composer.dev_ref }}" + "oxid-esales/codeception-modules": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/codeception-page-objects": "{{ .Data.global.composer.ref_name }}" }, "repositories": { "oxid-esales/twig-component-ee": { @@ -118,10 +118,10 @@ runtest: transform: | { "require-dev": { - "oxid-esales/testing-library": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-ce": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-pe": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-ee": "{{ .Data.global.composer.dev_ref }}", + "oxid-esales/testing-library": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-ce": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-ee": "{{ .Data.global.composer.ref_name }}", "codeception/module-webdriver": "^3.1", "phpunit/phpunit": "^9.1.1" }, diff --git a/.github/oxid-esales/defaults/pe.yaml b/.github/oxid-esales/defaults/pe.yaml index f84ec845..8f90ca94 100644 --- a/.github/oxid-esales/defaults/pe.yaml +++ b/.github/oxid-esales/defaults/pe.yaml @@ -30,15 +30,15 @@ install_shop_with_modules: &install "ddoe/*": "source" }, "require": { - "oxid-esales/oxideshop-pe": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component-pe": "{{ .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/oxideshop-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-admin-theme": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/apex-theme": "{{ .Data.global.composer.ref_name }}" }, "require-dev": { - "oxid-esales/codeception-modules": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/codeception-page-objects": "{{ .Data.global.composer.dev_ref }}" + "oxid-esales/codeception-modules": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/codeception-page-objects": "{{ .Data.global.composer.ref_name }}" }, "repositories": { "oxid-esales/twig-component-pe": { @@ -108,9 +108,9 @@ runtest: transform: | { "require-dev": { - "oxid-esales/testing-library": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-ce": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-pe": "{{ .Data.global.composer.dev_ref }}", + "oxid-esales/testing-library": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-ce": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-pe": "{{ .Data.global.composer.ref_name }}", "codeception/module-webdriver": "^3.1", "phpunit/phpunit": "^9.1.1" }, diff --git a/.github/oxid-esales/defaults/pe.yml b/.github/oxid-esales/defaults/pe.yml index f84ec845..8f90ca94 100644 --- a/.github/oxid-esales/defaults/pe.yml +++ b/.github/oxid-esales/defaults/pe.yml @@ -30,15 +30,15 @@ install_shop_with_modules: &install "ddoe/*": "source" }, "require": { - "oxid-esales/oxideshop-pe": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/twig-component-pe": "{{ .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/oxideshop-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-component-pe": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/twig-admin-theme": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/apex-theme": "{{ .Data.global.composer.ref_name }}" }, "require-dev": { - "oxid-esales/codeception-modules": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/codeception-page-objects": "{{ .Data.global.composer.dev_ref }}" + "oxid-esales/codeception-modules": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/codeception-page-objects": "{{ .Data.global.composer.ref_name }}" }, "repositories": { "oxid-esales/twig-component-pe": { @@ -108,9 +108,9 @@ runtest: transform: | { "require-dev": { - "oxid-esales/testing-library": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-ce": "{{ .Data.global.composer.dev_ref }}", - "oxid-esales/tests-deprecated-pe": "{{ .Data.global.composer.dev_ref }}", + "oxid-esales/testing-library": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-ce": "{{ .Data.global.composer.ref_name }}", + "oxid-esales/tests-deprecated-pe": "{{ .Data.global.composer.ref_name }}", "codeception/module-webdriver": "^3.1", "phpunit/phpunit": "^9.1.1" }, From 22371c12268dd90841802a3b4b5227875652f1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Fri, 26 Jul 2024 11:55:48 +0200 Subject: [PATCH 24/25] Use v0 prepare_shop for testing --- .github/workflows/universal_workflow_light.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index 2777eb6e..e75c824f 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -305,7 +305,7 @@ jobs: - name: 'Prepare Shop' id: prepare_shop - uses: 'OXID-eSales/github-actions/prepare_shop@v4' + uses: 'OXID-eSales/github-actions/prepare_shop@v0' with: container_name: ${{ steps.iltp.outputs.install_container_name }} container_options: ${{ steps.iltp.outputs.install_container_options }} From 13abbdd2209e6a67f99994dbfabefa1d57688b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Ott?= Date: Fri, 26 Jul 2024 12:26:07 +0200 Subject: [PATCH 25/25] Revert after test --- .github/workflows/universal_workflow_light.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/universal_workflow_light.yaml b/.github/workflows/universal_workflow_light.yaml index e75c824f..2777eb6e 100644 --- a/.github/workflows/universal_workflow_light.yaml +++ b/.github/workflows/universal_workflow_light.yaml @@ -305,7 +305,7 @@ jobs: - name: 'Prepare Shop' id: prepare_shop - uses: 'OXID-eSales/github-actions/prepare_shop@v0' + uses: 'OXID-eSales/github-actions/prepare_shop@v4' with: container_name: ${{ steps.iltp.outputs.install_container_name }} container_options: ${{ steps.iltp.outputs.install_container_options }}