Skip to content

Commit eff3510

Browse files
committed
OXDEV-8623 Add root recipe
1 parent 7fe2946 commit eff3510

5 files changed

Lines changed: 142 additions & 2 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "recipes/parts"]
2+
path = recipes/parts
3+
url = https://github.com/OXID-eSales/docker-eshop-sdk-recipe-parts

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,56 @@ $ ./vendor/bin/phpunit -c vendor/oxid-esales/graphql-base/tests/phpunit.xml
188188
$ SELENIUM_SERVER_HOST=selenium MODULE_IDS=oe_graphql_base vendor/bin/codecept run acceptance -c vendor/oxid-esales/graphql-base/tests/codeception.yml
189189
```
190190

191+
# Development installation
192+
193+
To be able running the tests and other preconfigured quality tools, please install the module as a [root package](https://getcomposer.org/doc/04-schema.md#root-package).
194+
195+
The next section shows how to install the module as a root package by using the OXID eShop SDK.
196+
197+
In case of different environment usage, please adjust by your own needs.
198+
199+
# Development installation on OXID eShop SDK
200+
201+
The installation instructions below are shown for the current [SDK](https://github.com/OXID-eSales/docker-eshop-sdk)
202+
for shop 7.3. Make sure your system meets the requirements of the SDK.
203+
204+
0. Ensure all docker containers are down to avoid port conflicts
205+
206+
1. Clone the SDK for the new project
207+
```shell
208+
echo MyProject && git clone https://github.com/OXID-eSales/docker-eshop-sdk.git $_ && cd $_
209+
```
210+
211+
2. Clone the repository to the source directory
212+
```shell
213+
git clone --recurse-submodules https://github.com/OXID-eSales/graphql-base-module.git --branch=b-7.3.x ./source
214+
```
215+
216+
3. Run the recipe to setup the development environment, you can decide which shop edition to install. Omitting the flag installs EE.
217+
```shell
218+
./source/recipes/setup-development.sh -s CE
219+
```
220+
221+
You should be able to access the shop with http://localhost.local and the admin panel with http://localhost.local/admin
222+
(credentials: noreply@oxid-esales.com / admin)
223+
224+
### Running tests locally
225+
226+
Check the "scripts" section in the `composer.json` file for the available commands. Those commands can be executed
227+
by connecting to the php container and running the command from there, example:
228+
229+
```shell
230+
make php
231+
composer tests-coverage
232+
```
233+
234+
Commands can be also triggered directly on the container with docker compose, example:
235+
236+
```shell
237+
docker compose exec -T php composer tests-coverage
238+
```
239+
240+
191241
## Issues
192242

193243
To report issues with GraphQL module please use the [OXID eShop bugtracking system](https://bugs.oxid-esales.com/).

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"codeception/module-asserts": "^3.0"
3232
},
3333
"conflict": {
34-
"oxid-esales/oxideshop-ce": "<7.2"
34+
"oxid-esales/oxideshop-ce": "<7.3"
3535
},
3636
"autoload": {
3737
"psr-4": {
@@ -72,7 +72,12 @@
7272
"allow-plugins": {
7373
"infection/extension-installer": true,
7474
"oxid-esales/oxideshop-unified-namespace-generator": true,
75-
"oxid-esales/oxideshop-composer-plugin": false
75+
"oxid-esales/oxideshop-composer-plugin": true
7676
}
77+
},
78+
"autoload-dev": {
79+
"psr-4": {
80+
"OxidEsales\\EshopCommunity\\Tests\\": "./vendor/oxid-esales/oxideshop-ce/tests"
7781
}
82+
}
7883
}

recipes/parts

Submodule parts added at 56727b8

recipes/setup-development.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
# Flags possible:
3+
# -e for shop edition. Possible values: CE/EE
4+
5+
edition='EE'
6+
while getopts e: flag; do
7+
case "${flag}" in
8+
e) edition=${OPTARG} ;;
9+
*) ;;
10+
esac
11+
done
12+
13+
SCRIPT_PATH=$(dirname ${BASH_SOURCE[0]})
14+
cd $SCRIPT_PATH/../../ || exit
15+
16+
# Prepare services configuration
17+
make setup
18+
make addbasicservices
19+
make file=services/adminer.yml addservice
20+
make file=services/selenium-chrome.yml addservice
21+
make file=services/node.yml addservice
22+
23+
# Configure containers
24+
perl -pi\
25+
-e 's#error_reporting = .*#error_reporting = E_ALL ^ E_WARNING ^ E_DEPRECATED#g;'\
26+
containers/php/custom.ini
27+
28+
perl -pi\
29+
-e 's#/var/www/#/var/www/source/#g;'\
30+
containers/httpd/project.conf
31+
32+
perl -pi\
33+
-e 's#PHP_VERSION=.*#PHP_VERSION=8.2#g;'\
34+
.env
35+
36+
docker compose up --build -d php
37+
38+
docker compose exec -T php git config --global --add safe.directory /var/www
39+
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+
docker compose exec -T php composer require oxid-esales/apex-theme dev-b-7.3.x
45+
46+
git clone https://github.com/OXID-eSales/oxapi-documentation source/documentation/oxapi-documentation
47+
make docpath=./source/documentation/oxapi-documentation addsphinxservice
48+
49+
docker-compose exec -T -w /var/www php \
50+
composer config allow-plugins.oxid-esales/oxideshop-composer-plugin true
51+
52+
perl -pi -e '
53+
BEGIN {
54+
$inserted = 0;
55+
$autoload_dev = qq( "autoload-dev": {\n "psr-4": {\n "OxidEsales\\\\EshopCommunity\\\\Tests\\\\": "./vendor/oxid-esales/oxideshop-ce/tests"\n }\n },\n);
56+
}
57+
if (!$inserted && $_ =~ /"repositories":/) {
58+
$_ = $autoload_dev . $_;
59+
$inserted = 1;
60+
}
61+
' source/composer.json
62+
63+
64+
make up
65+
66+
docker compose exec php composer update --no-interaction
67+
68+
perl -pi\
69+
-e 'print "SetEnvIf Authorization \"(.*)\" HTTP_AUTHORIZATION=\$1\n\n" if $. == 1'\
70+
source/source/.htaccess
71+
72+
$SCRIPT_PATH/parts/shared/setup_database.sh --no-demodata
73+
74+
docker compose exec -T php vendor/bin/oe-console oe:module:install ./
75+
76+
$SCRIPT_PATH/parts/shared/reset_database.sh --no-demodata
77+
78+
docker compose exec -T php vendor/bin/oe-console oe:module:activate oe_graphql_base
79+
docker compose exec -T php vendor/bin/oe-console oe:theme:activate apex
80+
81+
$SCRIPT_PATH/parts/shared/create_admin.sh

0 commit comments

Comments
 (0)