Skip to content

Commit

Permalink
B 7.0.x leverage composer scripts (#966) (#968) (#969)
Browse files Browse the repository at this point in the history
* Switch to light workflows using scripts
* Use install script
* Determine the branch based on the changelog, if the branch name is problematic
  • Loading branch information
joernott authored May 29, 2024
1 parent 6f9d7b3 commit 93af160
Show file tree
Hide file tree
Showing 30 changed files with 566 additions and 299 deletions.
9 changes: 0 additions & 9 deletions .github/oxid-esales/codeception_Acceptance.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/oxid-esales/codeception_AcceptanceSetup.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/oxid-esales/codeception_acceptanceSetup_70x.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .github/oxid-esales/codeception_acceptance_70x.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/oxid-esales/deprecated_tests.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/oxid-esales/deprecated_tests_only_ce.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This config depends on the defaults.yml testplan
# Only diverging settings are defined here

skip: &skip
matrix:
testplan: 'skip'
skip: true

phpunit: *skip
codeception: *skip
sonarcloud: *skip
phpcs_tests: *skip
yamllint: *skip
actionlint: *skip

runtest:
matrix:
testplan: '["-"]'

finish:
slack_title: 'Deprecated Tests Shop CE on {{ .Github.Repository }} by {{ .Github.Actor }}'
30 changes: 0 additions & 30 deletions .github/oxid-esales/deprecated_tests_only_ce.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/oxid-esales/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/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}'"
}

init
# Run Install Shop
docker compose "${install_container_method}" -T \
${install_container_options} \
"${install_container_name}" \
${OE_CONSOLE} oe:setup:shop \
--db-host mysql \
--db-port 3306 \
--db-name example \
--db-user root \
--db-password root \
--shop-url http://localhost.local/ \
--shop-directory /var/www/source \
--compile-directory /var/www/source/tmp

# Activate iDebug
if [ "${install_config_idebug}" == 'true' ]; then
if [ -f source/source/config.inc.php ]; then
perl -pi -e 's#iDebug = 0;#iDebug = -1;#g;' source/source/config.inc.php
fi
if [ -f source/vendor/oxid-esales/oxideshop-ce/source/config.inc.php ]; then
perl -pi -e 's#iDebug = 0;#iDebug = -1;#g;' source/vendor/oxid-esales/oxideshop-ce/source/config.inc.php
fi
fi

# Activate theme
if [ "${install_is_enterprise}" == 'true' ]; then
docker compose "${install_container_method}" -T \
${install_container_options} \
"${install_container_name}" \
${OE_CONSOLE} oe:theme:activate apex
fi

# 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
37 changes: 0 additions & 37 deletions .github/oxid-esales/phpcs_only.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/oxid-esales/phpunit_integration.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/oxid-esales/phpunit_unit.yml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/oxid-esales/shop_ce.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# {{ $org := "oxid-esales" }}organisation: {{ $org }}
# {{ $name := "oxideshop-ce" }}name: {{ $name }}
# {{ $repo := "OXID-eSales/oxideshop_ce" }}repo: {{ $repo }}

install:
method: script
cache:
prepared_shop: true
container:
options: '-e SHOP_PATH=vendor/{{ $org}}/{{ $name }}/source'
composer:
transform: |
{
"preferred-install": {
"oxid-esales/*": "source",
"oxid-professional-services/*": "source",
"ddoe/*": "source"
},
"require": {
"oxid-esales/twig-component": "{{ .Data.global.composer.dev_ref }}",
"oxid-esales/twig-admin-theme": "{{ .Data.global.composer.dev_ref }}",
"oxid-esales/apex-theme": "{{ .Data.global.composer.dev_ref }}",
"{{ $org }}/{{ $name }}": "{{ .Data.global.composer.ref_name }}"
},
"repositories": {
"{{ $org }}/{{ $name }}": {
"type": "git",
"url": "https://github.com/{{ $repo }}.git"
}
}
}
output:
files: |
docker-compose.yml
source/composer.json*
source/composer.lock
source/source/config.inc.php
source/vendor/oxid-esales/oxideshop-ce/source/config.inc.php
data/php/logs/error_log.txt
runscript: &runscript
matrix:
script: |
[
"shop:~/unit.sh",
"shop:~/integration.sh",
"shop:~/codeception.sh",
"setup:~/shop-setup.sh"
]
shop: &shop
path: 'vendor/{{ $org}}/{{ $name }}'
container:
options: '-e XDEBUG_MODE=coverage -e GITHUB_EVENT_NAME={{ .Github.EventName }} -e GITHUB_BASE_REF={{ .Github.BaseRef }} -e GITHUB_REF={{ .Github.Ref }} -e GITHUB_REF_NAME={{ .Github.RefName }}'
setup:
load_shop: '{{ .Data.install_shop_with_modules.cache.prepared_shop_prefix }}'
path: 'vendor/{{ $org}}/{{ $name }}'
custom_script_container: |
cd vendor/oxid-esales/oxideshop-ce
composer config -g github-oauth.github.com "${GITHUB_TOKEN}"
composer update --no-interaction
runslim:
<<: *runscript
matrix:
script: '["shop:~/php-cs-report.sh"]'

sonarcloud:
matrix:
testplan: '["-","~/sonarcloud_oxideshop_ce_internal.yaml"]'
strip_path: '/var/www/vendor/{{ print $org }}/{{ print $name}}/'

finish:
slack_title: 'Shop CE ({{ .Data.global.git.shop_ref }}) by {{ .Github.Actor }}'
slack_compact: true
18 changes: 0 additions & 18 deletions .github/oxid-esales/shop_ce.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/oxid-esales/shop_ce_70x.yml

This file was deleted.

Loading

0 comments on commit 93af160

Please sign in to comment.