Skip to content

Commit 66c47ec

Browse files
committed
OXDEV-7248 Update module to work with shop 8.0
1 parent 741145a commit 66c47ec

19 files changed

Lines changed: 314 additions & 106 deletions

.github/oxid-esales/graphql-base.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
install:
77
cache:
88
prepared_shop: false
9+
method: 'script'
10+
script: 'source/.github/oxid-esales/install.sh'
911
git:
1012
repository: '{{ $repo }}'
1113
ref: &ref '{{ .Github.RefName }}'
@@ -25,11 +27,8 @@ install:
2527
custom_script_container: |
2628
perl -pi -e 'print "SetEnvIf Authorization \"(.*)\" HTTP_AUTHORIZATION=\$1\n\n" if $. == 1' source/.htaccess
2729
28-
vendor/bin/oe-console oe:database:reset --db-host=mysql --db-port=3306 --db-name=example --db-user=root --db-password=root --force
2930
vendor/bin/oe-console oe:module:install ./
30-
31-
vendor/bin/oe-eshop-doctrine_migration migrations:migrate
32-
vendor/bin/oe-eshop-db_views_generate
31+
vendor/bin/oe-console oe:database:reset --force
3332
3433
vendor/bin/oe-console oe:module:activate "{{ $ids }}"
3534
vendor/bin/oe-console oe:theme:activate apex
@@ -73,5 +72,5 @@ sonarcloud:
7372
-Dsonar.sources=src \
7473
-Dsonar.tests=tests
7574
76-
finish:
77-
slack_title: '{{ print $name }} ({{ .Data.global.git.shop_ref }}) by {{ .Github.Actor }}'
75+
#finish:
76+
# slack_title: '{{ print $name }} ({{ .Data.global.git.shop_ref }}) by {{ .Github.Actor }}'

.github/oxid-esales/install.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
# shellcheck disable=SC2154
3+
# Lower case environment variables are passed from the workflow and used here
4+
# We use a validation loop in init to ensure, they're set
5+
# shellcheck disable=SC2086
6+
# We want install_container_options to count as multiple arguments
7+
set -e
8+
9+
function error() {
10+
echo -e "\033[0;31m${1}\033[0m"
11+
exit 1
12+
}
13+
14+
function init() {
15+
for VAR in install_container_method install_container_options install_container_name \
16+
install_config_idebug install_is_enterprise; do
17+
echo -n "Checking, if $VAR is set ..."
18+
if [ -z ${VAR+x} ]; then
19+
error "Variable '${VAR}' not set"
20+
fi
21+
echo "OK, ${VAR}='${!VAR}'"
22+
done
23+
echo -n "Locating oe-console ... "
24+
cd source || exit 1
25+
if [ -f 'bin/oe-console' ]; then
26+
OE_CONSOLE='bin/oe-console'
27+
else
28+
if [ -f 'vendor/bin/oe-console' ]; then
29+
OE_CONSOLE='vendor/bin/oe-console'
30+
else
31+
error "Can't find oe-console in bin or vendor/bin!"
32+
fi
33+
fi
34+
echo "OK, using '${OE_CONSOLE}'"
35+
if [ -z "${OXID_BUILD_DIRECTORY}" ]; then
36+
echo "OXID_BUILD_DIRECTORY is not set, setting it to /var/www/var/cache/"
37+
export OXID_BUILD_DIRECTORY="/var/www/var/cache/"
38+
else
39+
echo "OXID_BUILD_DIRECTORY is set to '${OXID_BUILD_DIRECTORY}'"
40+
fi
41+
if [ ! -d "${OXID_BUILD_DIRECTORY/\/var\/www/source}" ]; then
42+
echo "Creating '${OXID_BUILD_DIRECTORY}'"
43+
44+
docker compose "${install_container_method}" -T \
45+
${install_container_options} \
46+
"${install_container_name}" \
47+
mkdir -p "${OXID_BUILD_DIRECTORY}"
48+
49+
echo "done with build directory"
50+
fi
51+
}
52+
53+
init
54+
55+
cp vendor/oxid-esales/oxideshop-ce/.env.dist .env
56+
cat .env
57+
58+
59+
# Run Install Shop
60+
docker compose "${install_container_method}" -T \
61+
${install_container_options} \
62+
"${install_container_name}" \
63+
${OE_CONSOLE} oe:database:reset --force
64+
65+
# Activate iDebug
66+
if [ "${install_config_idebug}" == 'true' ]; then
67+
export OXID_DEBUG_MODE="true"
68+
fi
69+
70+
# Activate theme
71+
docker compose "${install_container_method}" -T \
72+
${install_container_options} \
73+
"${install_container_name}" \
74+
${OE_CONSOLE} oe:theme:activate apex
75+
76+
# Output PHP error log
77+
if [ -s data/php/logs/error_log.txt ]; then
78+
echo -e "\033[0;35mPHP error log\033[0m"
79+
cat data/php/logs/error_log.txt
80+
fi
81+
exit 0

.github/workflows/dispatch_module.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
;;
4545
esac
4646
# shellcheck disable=SC2088
47-
TESTPLAN="~/defaults/7.3.x.yaml,${LIMIT}~/graphql-base.yaml"
47+
TESTPLAN="~/defaults/8.0.x.yaml,${LIMIT}~/graphql-base.yaml"
4848
echo "testplan=${TESTPLAN}" | tee -a "${GITHUB_OUTPUT}"
4949
5050
dispatch_stable:

.github/workflows/schedule_module.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
call_matrix:
99
uses: OXID-eSales/github-actions/.github/workflows/universal_workflow_light.yaml@v4
1010
with:
11-
testplan: '~/defaults/7.3.x.yaml,~/graphql-base.yaml'
11+
testplan: '~/defaults/8.0.x.yaml,~/graphql-base.yaml'
1212
runs_on: '"ubuntu-latest"'
1313
defaults: 'v4'
1414
plan_folder: '.github/oxid-esales'

.github/workflows/trigger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
call_matrix:
99
uses: OXID-eSales/github-actions/.github/workflows/universal_workflow_light.yaml@v4
1010
with:
11-
testplan: '~/defaults/7.3.x.yaml,~/defaults/php8.2_mysql8.0_only.yaml,~/graphql-base.yaml'
11+
testplan: '~/defaults/8.0.x.yaml,~/defaults/php8.3_mysql8.0_only.yaml,~/graphql-base.yaml'
1212
runs_on: '"ubuntu-latest"'
1313
defaults: 'v4'
1414
plan_folder: '.github/oxid-esales'

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require-dev": {
1919
"phpunit/phpunit": "^10.4",
2020
"ext-xdebug": "*",
21-
"oxid-esales/oxideshop-ce": "dev-b-7.3.x",
21+
"oxid-esales/oxideshop-ce": "dev-b-8.0.x",
2222
"phpstan/phpstan": "^1.10",
2323
"squizlabs/php_codesniffer": "3.*",
2424
"phpmd/phpmd": "^2.11",
@@ -27,15 +27,16 @@
2727
"codeception/module-phpbrowser": "*",
2828
"codeception/module-db": "*",
2929
"codeception/codeception": "^5.0",
30-
"oxid-esales/codeception-modules": "dev-b-7.3.x",
30+
"oxid-esales/codeception-modules": "dev-b-8.0.x",
3131
"codeception/module-asserts": "^3.0"
3232
},
3333
"conflict": {
34-
"oxid-esales/oxideshop-ce": "<7.3"
34+
"oxid-esales/oxideshop-ce": "<8.0"
3535
},
3636
"autoload": {
3737
"psr-4": {
38-
"OxidEsales\\GraphQL\\Base\\": "src"
38+
"OxidEsales\\GraphQL\\Base\\": "src",
39+
"OxidEsales\\GraphQL\\Base\\Tests\\": "tests"
3940
}
4041
},
4142
"minimum-stability": "dev",

recipes/setup-development.sh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,35 @@ docker compose up --build -d php
3737

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

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

4646
git clone -b 11.0-en https://github.com/OXID-eSales/oxapi-documentation source/documentation/oxapi-documentation
4747
make docpath=./source/documentation/oxapi-documentation addsphinxservice
4848

4949
make up
5050

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

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

57-
$SCRIPT_PATH/parts/shared/setup_database.sh --no-demodata
58-
5959
docker compose exec -T php vendor/bin/oe-console oe:module:install ./
60-
docker compose exec -T php vendor/bin/oe-eshop-doctrine_migration migrations:migrate
61-
docker compose exec -T php vendor/bin/oe-eshop-db_views_generate
60+
docker compose exec -T php vendor/bin/oe-console oe:database:reset --force
6261

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

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

6870
# Register all related project packages git repositories
6971
mkdir -p .idea; mkdir -p source/.idea; cp "${SCRIPT_PATH}/parts/bases/vcs.xml.base" .idea/vcs.xml

tests/Codeception/Acceptance.suite.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# suite config
22
actor: AcceptanceTester
33
path: Acceptance
4+
bootstrap: _bootstrap.php
5+
46
modules:
57
enabled:
68
- Asserts

tests/Codeception/Acceptance/_bootstrap.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
declare(strict_types=1);
99

1010
// This is acceptance bootstrap
11+
use OxidEsales\EshopCommunity\Internal\Framework\FileSystem\ProjectRootLocator;
1112
use Symfony\Component\Filesystem\Path;
1213

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

0 commit comments

Comments
 (0)