Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update github-actions to 4.15.0 #171

Merged
merged 25 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
07b0514
Add separate workdir parameter to run test script action
joernott Jul 19, 2024
ff2727f
Allow empty workdir
joernott Jul 19, 2024
91a684a
Allow empty workdir
joernott Jul 19, 2024
b9a4036
Set absolute path var
joernott Jul 19, 2024
0346eb2
Add generic scripts
joernott Jul 22, 2024
671b6f9
Add generic phpunit files
joernott Jul 22, 2024
51a6166
Move scripts into defaults folder
joernott Jul 22, 2024
2bbe775
Fix integration
joernott Jul 22, 2024
63574d7
Fix unitr/integration log file names
joernott Jul 22, 2024
50b989c
Add Suite parameter to codeception script
joernott Jul 22, 2024
3d94201
Add Suite parameter to codeception script
joernott Jul 22, 2024
689012f
Handle test script parameters better
joernott Jul 22, 2024
3bc14ef
Backwards compatibility for workdir
joernott Jul 23, 2024
b882129
Fix typo
joernott Jul 23, 2024
7de9cf9
Add phpcs, phpmd and phpstan scripts
joernott Jul 23, 2024
46f8a4b
Fix runslim
joernott Jul 23, 2024
cc44b7c
Automatically copy default scripts
joernott Jul 25, 2024
d5a94b8
Automatically copy default scripts
joernott Jul 25, 2024
5fbaa6b
Handle tests and Tests folders in generic scripts
joernott Jul 25, 2024
fcd59df
Remove redundant composer run
joernott Jul 25, 2024
a974bf0
Update versions
Jul 25, 2024
abddd8f
Remove script debugging as it blows up the logs
joernott Jul 26, 2024
0236d1a
Fix PE/EE template referencing the wrong branch for nightlies
joernott Jul 26, 2024
22371c1
Use v0 prepare_shop for testing
joernott Jul 26, 2024
13abbdd
Revert after test
joernott Jul 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/oxid-esales/defaults/defaults_light.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -314,6 +317,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

Expand Down
7 changes: 7 additions & 0 deletions .github/oxid-esales/defaults/defaults_light.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -314,6 +317,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

Expand Down
26 changes: 13 additions & 13 deletions .github/oxid-esales/defaults/ee.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
},
Expand Down
26 changes: 13 additions & 13 deletions .github/oxid-esales/defaults/ee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
},
Expand Down
20 changes: 10 additions & 10 deletions .github/oxid-esales/defaults/pe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
},
Expand Down
20 changes: 10 additions & 10 deletions .github/oxid-esales/defaults/pe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
},
Expand Down
52 changes: 52 additions & 0 deletions .github/oxid-esales/defaults/scripts/check_log.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/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 [ ! -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
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}"

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}
97 changes: 97 additions & 0 deletions .github/oxid-esales/defaults/scripts/codeception.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
set -e
SUITE="${1}"

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
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"

OUTPUT_DIR="${ABSOLUTE_PATH}/${TESTDIR}/Output"
REPORT_DIR="${ABSOLUTE_PATH}/${TESTDIR}/Reports"

if [ -z "${SELENIUM_SERVER_HOST}" ]; then
SELENIUM_SERVER_HOST='selenium'
fi

if [ -z "${SUITE}" ]; then
SUITE="Acceptance"
if [ ! -d "${ABSOLUTE_PATH}/${TESTDIR}/Codeception/${SUITE}" ]; then
SUITE="acceptance"
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
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 <<EOF
Path: ${ABSOLUTE_PATH}
Script directory: ${SCRIPT_DIR}
Output directory: ${OUTPUT_DIR}
Report directory: ${REPORT_DIR}
Selenium host: ${SELENIUM_SERVER_HOST}
Suite: ${SUITE}
Codeception: ${CODECEPT}
Log file: ${LOG_FILE}
Failure patterns: ${PATTERN_FILE}
EOF
}

# wait for selenium host
function wait_for_selenium() {
local I=60
until [ $I -le 0 ]; do
curl -sSjkL "http://${SELENIUM_SERVER_HOST}:4444/wd/hub/status" |grep '"ready": true' && break
echo "."
sleep 1
((I--))
done
set -e
curl -sSjkL "http://${SELENIUM_SERVER_HOST}:4444/wd/hub/status"
}

init
wait_for_selenium

"${CODECEPT}" build -c "${ABSOLUTE_PATH}/tests/codeception.yml"
RESULT=$?
echo "Codecept build exited with error code ${RESULT}"
"${CODECEPT}" run "${SUITE}" \
-c "${ABSOLUTE_PATH}/${TESTDIR}/codeception.yml" \
--ext DotReporter \
-o "paths: output: ${OUTPUT_DIR}" 2>&1 \
| tee "${LOG_FILE}"
RESULT=$?
echo "Codecept run exited with error code ${RESULT}"
"$SCRIPT_DIR/check_log.sh" "${LOG_FILE}" "${PATTERN_FILE}"
Original file line number Diff line number Diff line change
@@ -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]*
Loading