Skip to content

Commit 7c5a8fd

Browse files
authored
Merge branch 'master' into master
2 parents c1e2f65 + 76cbd8e commit 7c5a8fd

48 files changed

Lines changed: 812 additions & 507 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/compile.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Magento 2 DI compilation
2+
on: ['push', 'pull_request']
3+
4+
jobs:
5+
compile:
6+
name: Magento 2 DI compilation
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
magento_version: ['2.4.5-p14', '2.4.7-p4', '2.4.7-p7', '2.4.8', '2.4.8-p1', '2.4.8-p2', '2.4.8-p3']
11+
container:
12+
image: yireo/magento2installed:${{ matrix.magento_version }}
13+
steps:
14+
- name: Checkout sources
15+
uses: actions/checkout@v4
16+
17+
- name: Testing for MODULE.json file
18+
run: |
19+
test -f MODULE.json || echo "SKIP_JOB=true" >> $GITHUB_ENV
20+
21+
- name: Check Magento version
22+
if: env.SKIP_JOB != 'true'
23+
run: |
24+
jq -e --arg v "${{ matrix.magento_version }}" '.skip_magento_versions[] == $v' MODULE.json && echo "SKIP_JOB=true" >> $GITHUB_ENV || true
25+
26+
- name: Setting up module variables
27+
if: env.SKIP_JOB != 'true'
28+
run: |
29+
echo COMPOSER_NAME=`jq '.name' composer.json -r` >> $GITHUB_ENV
30+
echo MAGENTO_MODULE=`jq '.module_name' MODULE.json -r` >> $GITHUB_ENV
31+
32+
- name: Configure Yireo GitLab
33+
if: env.SKIP_JOB != 'true'
34+
run: |
35+
test -n "${{ secrets.GITLAB_TOKEN }}" || exit 0
36+
cd /tmp/magento
37+
ls ${GITHUB_WORKSPACE}
38+
test -f ${GITHUB_WORKSPACE}/.github/workflows/composer-additional.sh && source ${GITHUB_WORKSPACE}/.github/workflows/composer-additional.sh
39+
test -f ${GITHUB_WORKSPACE}/.github/workflows/composer-${{ matrix.magento_version }}.sh && source ${GITHUB_WORKSPACE}/.github/workflows/composer-${{ matrix.magento_version }}.sh
40+
composer config gitlab-domains gitlab.yireo.com
41+
composer config --global --auth http-basic.gitlab.yireo.com yireo "${{ secrets.GITLAB_TOKEN }}"
42+
composer config repositories.loki-third-party composer https://gitlab.yireo.com/api/v4/group/loki-third-party/-/packages/composer/packages.json
43+
composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json
44+
45+
- name: Add module source
46+
if: env.SKIP_JOB != 'true'
47+
run: |
48+
cp -R ${GITHUB_WORKSPACE} /tmp/magento/package-source
49+
cd /tmp/magento
50+
composer config repositories.local-source path package-source/
51+
composer require --prefer-source ${COMPOSER_NAME}:@dev
52+
53+
- name: Run Magento 2 compilation
54+
if: env.SKIP_JOB != 'true'
55+
run: |
56+
cd /tmp/magento
57+
bin/magento module:enable --all
58+
php -dmemory_limit=-1 bin/magento setup:di:compile
59+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
cp composer.json composer-old.json
3+
curl https://raw.githubusercontent.com/LokiCheckout/magento-2.4.5-patches/refs/heads/main/modules/patches.json -o loki-checkout-patches.json
4+
jq -s add composer-old.json loki-checkout-patches.json > composer.json
5+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
cp composer.json composer-old.json
3+
curl https://raw.githubusercontent.com/LokiCheckout/magento-2.4.9-patches/refs/heads/master/core/patches.json -o loki-checkout-patches.json
4+
jq -s add composer-old.json loki-checkout-patches.json > composer.json
5+
Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
name: Magento 2 Integration Tests
2-
#on: ['push', 'pull_request']
3-
on:
4-
release:
5-
push:
6-
branches:
7-
- 'main'
2+
on: ['push', 'pull_request']
83

94
jobs:
105
integration-tests:
116
name: Magento 2 Integration Tests
12-
runs-on: self-hosted
13-
#runs-on: ubuntu-latest
7+
runs-on: ubuntu-latest
148
container:
15-
image: yireo/magento2installed:2.4.7-p4
9+
image: yireo/magento2installed:2.4.8-p3
1610
services:
1711
mysql:
18-
image: mysql:8.0
12+
image: yireo/mariadb:10
1913
env:
2014
MYSQL_ROOT_PASSWORD: root
2115
MYSQL_USER: magento2
2216
MYSQL_PASSWORD: magento2
2317
MYSQL_DATABASE: magento2
2418
options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping"
2519
opensearch:
26-
image: yireo/opensearch-dummy
20+
image: yireo/opensearch:latest
2721
env:
2822
'discovery.type': single-node
29-
'xpack.security.enabled': false
30-
ES_JAVA_OPTS: "-Xms128m -Xmx128m"
23+
ES_JAVA_OPTS: "-Xms256m -Xmx256m"
3124
options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3
3225
redis:
3326
image: redis
@@ -36,22 +29,48 @@ jobs:
3629
- name: Checkout sources
3730
uses: actions/checkout@v4
3831

32+
- name: Detecting integration tests
33+
run: |
34+
test -d $GITHUB_WORKSPACE/Test/Integration || echo "SKIP_JOB=true" >> $GITHUB_ENV
35+
36+
- name: Apply patch for reporting memory under Alpine
37+
if: env.SKIP_JOB != 'true'
38+
run: cd /tmp/magento && curl -fsSL https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/39216.diff | git apply
39+
40+
- name: Apply patch for changing MySQL client configuration
41+
if: env.SKIP_JOB != 'true'
42+
run: cd /tmp/magento && curl -fsSL https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/40410.diff | git apply
43+
44+
- name: Setting up module variables
45+
if: env.SKIP_JOB != 'true'
46+
run: |
47+
echo COMPOSER_NAME=`jq -e '.name' composer.json -r` >> $GITHUB_ENV
48+
echo MAGENTO_MODULE=`jq -e '.module_name' MODULE.json -r` >> $GITHUB_ENV
49+
50+
- name: Configure GitLab
51+
if: env.SKIP_JOB != 'true'
52+
run: |
53+
test -n "${{ secrets.GITLAB_TOKEN }}" || exit 0
54+
cd /tmp/magento
55+
test -f $GITHUB_WORKSPACE/.github/workflows/composer-additional.sh && source $GITHUB_WORKSPACE/.github/workflows/composer-additional.sh
56+
test -f $GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh && source $GITHUB_WORKSPACE/.github/workflows/composer-${MAGENTO_VERSION}.sh
57+
composer config --auth gitlab-token.gitlab.yireo.com ${{ secrets.GITLAB_TOKEN }}
58+
composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json
59+
3960
- name: Add module source
61+
if: env.SKIP_JOB != 'true'
4062
run: |
41-
export COMPOSER_NAME=`cat .module.ini | grep COMPOSER_NAME | cut -f2 -d= | tr -d '"'`
4263
cp -R ${GITHUB_WORKSPACE} /tmp/magento/package-source
4364
cd /tmp/magento
4465
composer config repositories.local-source path package-source/
4566
composer require --prefer-source -- ${COMPOSER_NAME}:@dev yireo/magento2-integration-test-helper
4667
4768
- name: Run Magento 2 Integration Tests
69+
if: env.SKIP_JOB != 'true'
4870
run: |
49-
test -d $GITHUB_WORKSPACE/Test/Integration || exit 0
50-
export EXTENSION_VENDOR=`cat .module.ini | grep EXTENSION_VENDOR | cut -f2 -d= | tr -d '"'`
51-
export EXTENSION_NAME=`cat .module.ini | grep EXTENSION_NAME | cut -f2 -d= | tr -d '"'`
52-
export COMPOSER_NAME=`cat .module.ini | grep COMPOSER_NAME | cut -f2 -d= | tr -d '"'`
53-
export MAGENTO_MODULE=${EXTENSION_VENDOR}_${EXTENSION_NAME}
5471
cd /tmp/magento/dev/tests/integration/
5572
cp -R ${GITHUB_WORKSPACE}/.github/workflows/integration-tests/* .
73+
php ../../../vendor/bin/phpunit --atleast-version 9 && cp phpunit9.xml phpunit.xml
74+
php ../../../vendor/bin/phpunit --atleast-version 10 && cp phpunit10.xml phpunit.xml
5675
php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml ../../../vendor/$COMPOSER_NAME/Test/Integration
5776
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php // phpcs:ignoreFile
2+
3+
return [
4+
'client-mariadb' => [
5+
'disable-ssl',
6+
],
7+
];
8+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
10+
colors="true"
11+
columns="max"
12+
beStrictAboutTestsThatDoNotTestAnything="false"
13+
bootstrap="./framework/bootstrap.php"
14+
stderr="true">
15+
<testsuites>
16+
<testsuite name="LokiCheckout">
17+
<directory>../../../app/code/Yireo/LokiCheckout*/Test/Integration</directory>
18+
<directory>../../../vendor/yireo/magento2-loki-checkout*/Test/Integration</directory>
19+
</testsuite>
20+
</testsuites>
21+
<php>
22+
<includePath>.</includePath>
23+
<includePath>testsuite</includePath>
24+
<ini name="date.timezone" value="America/Los_Angeles"/>
25+
<ini name="xdebug.max_nesting_level" value="200"/>
26+
<const name="TESTS_INSTALL_CONFIG_FILE" value="etc/install-config-mysql.php"/>
27+
<const name="TESTS_GLOBAL_CONFIG_FILE" value="etc/config-global.php"/>
28+
<const name="TESTS_GLOBAL_CONFIG_DIR" value="../../../app/etc"/>
29+
<const name="TESTS_POST_INSTALL_SETUP_COMMAND_CONFIG_FILE" value="etc/post-install-setup-command-config.php"/>
30+
<const name="TESTS_CLEANUP" value="enabled"/>
31+
<const name="TESTS_MEM_USAGE_LIMIT" value="8192M"/>
32+
<const name="TESTS_MEM_LEAK_LIMIT" value=""/>
33+
<const name="TESTS_EXTRA_VERBOSE_LOG" value="1"/>
34+
<const name="TESTS_MAGENTO_MODE" value="developer"/>
35+
<const name="TESTS_ERROR_LOG_LISTENER_LEVEL" value="-1"/>
36+
<const name="USE_OVERRIDE_CONFIG" value="enabled"/>
37+
</php>
38+
<extensions>
39+
<bootstrap class="Magento\TestFramework\Event\Subscribers"/>
40+
</extensions>
41+
</phpunit>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.6/phpunit.xsd"
4+
colors="true"
5+
beStrictAboutTestsThatDoNotTestAnything="false"
6+
bootstrap="./framework/bootstrap.php"
7+
stderr="true"
8+
>
9+
<testsuites>
10+
<testsuite name="LokiCheckout">
11+
<directory>../../../app/code/Yireo/LokiCheckout*/Test/Integration</directory>
12+
<directory>../../../vendor/yireo/magento2-loki-checkout*/Test/Integration</directory>
13+
</testsuite>
14+
</testsuites>
15+
<php>
16+
<includePath>.</includePath>
17+
<includePath>testsuite</includePath>
18+
<ini name="date.timezone" value="America/Los_Angeles"/>
19+
<ini name="xdebug.max_nesting_level" value="200"/>
20+
<const name="TESTS_INSTALL_CONFIG_FILE" value="etc/install-config-mysql.php"/>
21+
<const name="TESTS_GLOBAL_CONFIG_FILE" value="etc/config-global.php"/>
22+
<const name="TESTS_GLOBAL_CONFIG_DIR" value="../../../app/etc"/>
23+
<const name="TESTS_POST_INSTALL_SETUP_COMMAND_CONFIG_FILE" value="etc/post-install-setup-command-config.php"/>
24+
<const name="TESTS_CLEANUP" value="enabled"/>
25+
<const name="TESTS_MEM_USAGE_LIMIT" value="8192M"/>
26+
<const name="TESTS_MEM_LEAK_LIMIT" value=""/>
27+
<const name="TESTS_EXTRA_VERBOSE_LOG" value="1"/>
28+
<const name="TESTS_MAGENTO_MODE" value="developer"/>
29+
<const name="TESTS_ERROR_LOG_LISTENER_LEVEL" value="-1"/>
30+
</php>
31+
<listeners>
32+
<listener class="Magento\TestFramework\Event\PhpUnit"/>
33+
<listener class="Magento\TestFramework\ErrorLog\Listener"/>
34+
</listeners>
35+
</phpunit>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
echo "Waiting for MySQL (${MYSQL_HOST}:${MYSQL_PORT})"
3+
for i in {1..30}; do
4+
if mariadb-admin ping -h"${MYSQL_HOST}" -P"${MYSQL_PORT}" --silent; then
5+
echo "OK"; break
6+
fi
7+
echo -n "."
8+
sleep 1
9+
done
10+
11+
cat <<EOF > ~/.my.cnf
12+
[client-mariadb]
13+
disable-ssl
14+
EOF
15+
16+
mariadb -h"${MYSQL_HOST}" -P"${MYSQL_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD}" -e "CREATE DATABASE IF NOT EXISTS ${MYSQL_DATABASE} /*\!40100 DEFAULT CHARACTER SET utf8 */;"
17+
mariadb -h"${MYSQL_HOST}" -P"${MYSQL_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD}" -e "CREATE USER IF NOT EXISTS '${MYSQL_USER}'@'%' IDENTIFIED BY '${MYSQL_PASSWORD}';"
18+
mariadb -h"${MYSQL_HOST}" -P"${MYSQL_PORT}" -uroot -p"${MYSQL_ROOT_PASSWORD}" -e "GRANT ALL ON ${MYSQL_DATABASE}.* TO '${MYSQL_USER}'@'%'; FLUSH PRIVILEGES;"
19+
20+
echo "Waiting for OpenSearch (${OPENSEARCH_HOST}:${OPENSEARCH_PORT})"
21+
ready=0
22+
for i in {1..60}; do
23+
if curl -s "http://${OPENSEARCH_HOST}:${OPENSEARCH_PORT}" | grep -q '"tagline"'; then
24+
echo "OK"
25+
ready=1
26+
break
27+
fi
28+
echo -n "."
29+
sleep 1
30+
done
31+
32+
if [ "${ready:-0}" -ne 1 ]; then
33+
echo "OpenSearch NOT OK, exiting"
34+
exit 1
35+
fi
36+
37+
cd /tmp/magento
38+
php -dmemory_limit=-1 bin/magento setup:install \
39+
--base-url="${MAGENTO_BASE_URL}" \
40+
--db-host="${MYSQL_HOST}" \
41+
--db-name="${MYSQL_DATABASE}" \
42+
--db-user="${MYSQL_USER}" \
43+
--db-password="${MYSQL_PASSWORD}" \
44+
--backend-frontname="${MAGENTO_BACKEND_FRONTNAME}" \
45+
--admin-firstname="${MAGENTO_ADMIN_FIRSTNAME}" \
46+
--admin-lastname="${MAGENTO_ADMIN_LASTNAME}" \
47+
--admin-email="${MAGENTO_ADMIN_EMAIL}" \
48+
--admin-user="${MAGENTO_ADMIN_USER}" \
49+
--admin-password="${MAGENTO_ADMIN_PASSWORD}" \
50+
--language="${MAGENTO_LANGUAGE}" \
51+
--currency="${MAGENTO_CURRENCY}" \
52+
--timezone="${MAGENTO_TIMEZONE}" \
53+
--use-rewrites="${MAGENTO_USE_REWRITES}" \
54+
--search-engine="${MAGENTO_SEARCH_ENGINE}" \
55+
--opensearch-host="${OPENSEARCH_HOST}" \
56+
--opensearch-port="${OPENSEARCH_PORT}" \
57+
--session-save=redis \
58+
--session-save-redis-host=redis \
59+
--session-save-redis-port=6379 \
60+
--cache-backend-redis-server=redis \
61+
--cache-backend-redis-port=6379
62+
63+
cd /tmp/magento/pub/
64+
nohup php -S 0.0.0.0:8888 >/tmp/php-server.log 2>&1 &
65+
66+
echo "Waiting for Magento front to become reachable"
67+
result=0
68+
for i in {1..60}; do
69+
if curl -s "${MAGENTO_BASE_URL}" 2>1 >/dev/null; then
70+
echo " OK, available"; result=1; break;
71+
fi
72+
echo -n "."
73+
sleep 1
74+
done
75+
test $result -eq 0 && echo "Not available" && cat /tmp/php-server.log && exit 1

0 commit comments

Comments
 (0)