Skip to content

Commit

Permalink
OXDEV-7248 Update module to work with shop 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hkreuter committed Feb 12, 2025
1 parent b4efd50 commit f5e7cda
Show file tree
Hide file tree
Showing 19 changed files with 314 additions and 106 deletions.
11 changes: 5 additions & 6 deletions .github/oxid-esales/graphql-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
install:
cache:
prepared_shop: false
method: 'script'
script: 'source/.github/oxid-esales/install.sh'
git:
repository: '{{ $repo }}'
ref: &ref '{{ .Github.RefName }}'
Expand All @@ -25,11 +27,8 @@ install:
custom_script_container: |
perl -pi -e 'print "SetEnvIf Authorization \"(.*)\" HTTP_AUTHORIZATION=\$1\n\n" if $. == 1' source/.htaccess
vendor/bin/oe-console oe:database:reset --db-host=mysql --db-port=3306 --db-name=example --db-user=root --db-password=root --force
vendor/bin/oe-console oe:module:install ./
vendor/bin/oe-eshop-doctrine_migration migrations:migrate
vendor/bin/oe-eshop-db_views_generate
vendor/bin/oe-console oe:database:reset --force
vendor/bin/oe-console oe:module:activate "{{ $ids }}"
vendor/bin/oe-console oe:theme:activate apex
Expand Down Expand Up @@ -73,5 +72,5 @@ sonarcloud:
-Dsonar.sources=src \
-Dsonar.tests=tests
finish:
slack_title: '{{ print $name }} ({{ .Data.global.git.shop_ref }}) by {{ .Github.Actor }}'
#finish:
# slack_title: '{{ print $name }} ({{ .Data.global.git.shop_ref }}) by {{ .Github.Actor }}'
81 changes: 81 additions & 0 deletions .github/oxid-esales/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash
# shellcheck disable=SC2154
# Lower case environment variables are passed from the workflow and used here
# We use a validation loop in init to ensure, they're set
# shellcheck disable=SC2086
# We want install_container_options to count as multiple arguments
set -e

function error() {
echo -e "\033[0;31m${1}\033[0m"
exit 1
}

function init() {
for VAR in install_container_method install_container_options install_container_name \
install_config_idebug install_is_enterprise; do
echo -n "Checking, if $VAR is set ..."
if [ -z ${VAR+x} ]; then
error "Variable '${VAR}' not set"
fi
echo "OK, ${VAR}='${!VAR}'"
done
echo -n "Locating oe-console ... "
cd source || exit 1
if [ -f 'bin/oe-console' ]; then
OE_CONSOLE='bin/oe-console'
else
if [ -f 'vendor/bin/oe-console' ]; then
OE_CONSOLE='vendor/bin/oe-console'
else
error "Can't find oe-console in bin or vendor/bin!"
fi
fi
echo "OK, using '${OE_CONSOLE}'"
if [ -z "${OXID_BUILD_DIRECTORY}" ]; then
echo "OXID_BUILD_DIRECTORY is not set, setting it to /var/www/var/cache/"
export OXID_BUILD_DIRECTORY="/var/www/var/cache/"
else
echo "OXID_BUILD_DIRECTORY is set to '${OXID_BUILD_DIRECTORY}'"
fi
if [ ! -d "${OXID_BUILD_DIRECTORY/\/var\/www/source}" ]; then
echo "Creating '${OXID_BUILD_DIRECTORY}'"

docker compose "${install_container_method}" -T \
${install_container_options} \
"${install_container_name}" \
mkdir -p "${OXID_BUILD_DIRECTORY}"

echo "done with build directory"
fi
}

init

cp vendor/oxid-esales/oxideshop-ce/.env.dist .env
cat .env


# Run Install Shop
docker compose "${install_container_method}" -T \
${install_container_options} \
"${install_container_name}" \
${OE_CONSOLE} oe:database:reset --force

# Activate iDebug
if [ "${install_config_idebug}" == 'true' ]; then
export OXID_DEBUG_MODE="true"
fi

# Activate theme
docker compose "${install_container_method}" -T \
${install_container_options} \
"${install_container_name}" \
${OE_CONSOLE} oe:theme:activate apex

# Output PHP error log
if [ -s data/php/logs/error_log.txt ]; then
echo -e "\033[0;35mPHP error log\033[0m"
cat data/php/logs/error_log.txt
fi
exit 0
2 changes: 1 addition & 1 deletion .github/workflows/dispatch_module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
;;
esac
# shellcheck disable=SC2088
TESTPLAN="~/defaults/7.3.x.yaml,${LIMIT}~/graphql-base.yaml"
TESTPLAN="~/defaults/8.0.x.yaml,${LIMIT}~/graphql-base.yaml"
echo "testplan=${TESTPLAN}" | tee -a "${GITHUB_OUTPUT}"
dispatch_stable:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/schedule_module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
call_matrix:
uses: OXID-eSales/github-actions/.github/workflows/universal_workflow_light.yaml@v4
with:
testplan: '~/defaults/7.3.x.yaml,~/graphql-base.yaml'
testplan: '~/defaults/8.0.x.yaml,~/graphql-base.yaml'
runs_on: '"ubuntu-latest"'
defaults: 'v4'
plan_folder: '.github/oxid-esales'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
call_matrix:
uses: OXID-eSales/github-actions/.github/workflows/universal_workflow_light.yaml@v4
with:
testplan: '~/defaults/7.3.x.yaml,~/defaults/php8.2_mysql8.0_only.yaml,~/graphql-base.yaml'
testplan: '~/defaults/8.0.x.yaml,~/defaults/php8.3_mysql8.0_only.yaml,~/graphql-base.yaml'
runs_on: '"ubuntu-latest"'
defaults: 'v4'
plan_folder: '.github/oxid-esales'
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require-dev": {
"phpunit/phpunit": "^10.4",
"ext-xdebug": "*",
"oxid-esales/oxideshop-ce": "dev-b-7.3.x",
"oxid-esales/oxideshop-ce": "dev-b-8.0.x",
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "3.*",
"phpmd/phpmd": "^2.11",
Expand All @@ -27,15 +27,16 @@
"codeception/module-phpbrowser": "*",
"codeception/module-db": "*",
"codeception/codeception": "^5.0",
"oxid-esales/codeception-modules": "dev-b-7.3.x",
"oxid-esales/codeception-modules": "dev-b-8.0.x",
"codeception/module-asserts": "^3.0"
},
"conflict": {
"oxid-esales/oxideshop-ce": "<7.3"
"oxid-esales/oxideshop-ce": "<8.0"
},
"autoload": {
"psr-4": {
"OxidEsales\\GraphQL\\Base\\": "src"
"OxidEsales\\GraphQL\\Base\\": "src",
"OxidEsales\\GraphQL\\Base\\Tests\\": "tests"
}
},
"minimum-stability": "dev",
Expand Down
22 changes: 12 additions & 10 deletions recipes/setup-development.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,35 @@ docker compose up --build -d php

docker compose exec -T php git config --global --add safe.directory /var/www

$SCRIPT_PATH/parts/shared/require_shop_edition_packages.sh -e"${edition}" -v"dev-b-7.3.x"
$SCRIPT_PATH/parts/shared/require_twig_components.sh -e"${edition}" -b"b-7.3.x"
$SCRIPT_PATH/parts/shared/require.sh -n"oxid-esales/developer-tools" -v"dev-b-7.3.x"
$SCRIPT_PATH/parts/shared/require.sh -n"oxid-esales/oxideshop-doctrine-migration-wrapper" -v"dev-b-7.3.x"
$SCRIPT_PATH/parts/shared/require_theme_dev.sh -t"apex" -b"b-7.3.x"
$SCRIPT_PATH/parts/shared/require_shop_edition_packages.sh -e"${edition}" -v"dev-b-8.0.x"
$SCRIPT_PATH/parts/shared/require_twig_components.sh -e"${edition}" -b"b-8.0.x"
$SCRIPT_PATH/parts/shared/require.sh -n"oxid-esales/developer-tools" -v"dev-b-8.0.x"
$SCRIPT_PATH/parts/shared/require.sh -n"oxid-esales/oxideshop-doctrine-migration-wrapper" -v"dev-b-8.0.x"
$SCRIPT_PATH/parts/shared/require_theme_dev.sh -t"apex" -b"b-8.0.x"

git clone https://github.com/OXID-eSales/oxapi-documentation source/documentation/oxapi-documentation
make docpath=./source/documentation/oxapi-documentation addsphinxservice

make up

docker compose exec php composer update --no-interaction --no-scripts --no-plugins
docker compose exec -T php cp /var/www/vendor/oxid-esales/oxideshop-ce/.env.dist /var/www/.env
docker compose exec php composer update --no-interaction

perl -pi\
-e 'print "SetEnvIf Authorization \"(.*)\" HTTP_AUTHORIZATION=\$1\n\n" if $. == 1'\
source/source/.htaccess

$SCRIPT_PATH/parts/shared/setup_database.sh --no-demodata

docker compose exec -T php vendor/bin/oe-console oe:module:install ./
docker compose exec -T php vendor/bin/oe-eshop-doctrine_migration migrations:migrate
docker compose exec -T php vendor/bin/oe-eshop-db_views_generate
docker compose exec -T php vendor/bin/oe-console oe:database:reset --force

docker compose exec -T php vendor/bin/oe-console oe:module:activate oe_graphql_base
docker compose exec -T php vendor/bin/oe-console oe:theme:activate apex

$SCRIPT_PATH/parts/shared/create_admin.sh
email=${ADMIN_EMAIL:-noreply@oxid-esales.com}
password=${ADMIN_PASSWORD:-admin}
CONSOLE_PATH=$( [ -e "source/bin/oe-console" ] && echo "bin/oe-console" || echo "vendor/bin/oe-console" )
docker compose exec -T php ${CONSOLE_PATH} oe:admin:create "$email" "$password"

# Register all related project packages git repositories
mkdir -p .idea; mkdir -p source/.idea; cp "${SCRIPT_PATH}/parts/bases/vcs.xml.base" .idea/vcs.xml
Expand Down
2 changes: 2 additions & 0 deletions tests/Codeception/Acceptance.suite.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# suite config
actor: AcceptanceTester
path: Acceptance
bootstrap: _bootstrap.php

modules:
enabled:
- Asserts
Expand Down
3 changes: 2 additions & 1 deletion tests/Codeception/Acceptance/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
declare(strict_types=1);

// This is acceptance bootstrap
use OxidEsales\EshopCommunity\Internal\Framework\FileSystem\ProjectRootLocator;
use Symfony\Component\Filesystem\Path;

require_once Path::join((new \OxidEsales\Facts\Facts())->getShopRootPath(), 'source', 'bootstrap.php');
require_once Path::join((new ProjectRootLocator())->getProjectRoot(), 'source', 'bootstrap.php');
Loading

0 comments on commit f5e7cda

Please sign in to comment.