Skip to content

Commit 96c9831

Browse files
committed
feat: update Magento compatibility workflow for PHP 8.4 and Elasticsearch integration
1 parent a9d4126 commit 96c9831

1 file changed

Lines changed: 122 additions & 22 deletions

File tree

.github/workflows/magento-compatibility.yml

Lines changed: 122 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
test:
11+
test-elasticsearch:
1212
name: Magento ${{ matrix.magento-version }} with PHP ${{ matrix.php-version }} Test
1313
runs-on: ubuntu-latest
1414
strategy:
@@ -17,19 +17,10 @@ jobs:
1717
include:
1818
- magento-version: '2.4.7'
1919
php-version: '8.3'
20-
search-engine: 'elasticsearch'
21-
search-image: 'elasticsearch:7.17.0'
2220
search-engine-name: 'elasticsearch7'
2321
- magento-version: '2.4.7-p5'
2422
php-version: '8.3'
25-
search-engine: 'elasticsearch'
26-
search-image: 'elasticsearch:7.17.0'
2723
search-engine-name: 'elasticsearch7'
28-
- magento-version: '2.4.8'
29-
php-version: '8.4'
30-
search-engine: 'opensearch'
31-
search-image: 'opensearchproject/opensearch:2.11.0'
32-
search-engine-name: 'opensearch'
3324

3425
services:
3526
mysql:
@@ -43,17 +34,126 @@ jobs:
4334

4435
elasticsearch:
4536
image: elasticsearch:7.17.0
46-
if: ${{ matrix.search-engine == 'elasticsearch' }}
4737
ports:
4838
- 9200:9200
4939
env:
5040
discovery.type: single-node
5141
ES_JAVA_OPTS: -Xms512m -Xmx512m
5242
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
5343

44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
47+
with:
48+
path: mageforge
49+
50+
- name: Setup PHP
51+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401
52+
with:
53+
php-version: ${{ matrix.php-version }}
54+
extensions: mbstring, intl, gd, xml, soap, zip, bcmath, pdo_mysql, curl, sockets
55+
tools: composer:v2
56+
57+
- name: Cache Composer packages
58+
id: composer-cache
59+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
60+
with:
61+
path: ~/.composer/cache/files
62+
key: ${{ runner.os }}-composer-${{ matrix.magento-version }}-${{ hashFiles('**/composer.json') }}
63+
restore-keys: ${{ runner.os }}-composer-${{ matrix.magento-version }}
64+
65+
- name: Clone Magento
66+
run: |
67+
git clone --depth=1 --branch=${{ matrix.magento-version }} https://github.com/magento/magento2.git magento2
68+
69+
- name: Check Search Engine status
70+
run: |
71+
curl -s http://localhost:9200/_cluster/health
72+
73+
- name: Install Magento
74+
working-directory: magento2
75+
env:
76+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
77+
run: |
78+
composer config minimum-stability stable
79+
composer config prefer-stable true
80+
composer install --no-interaction --no-progress
81+
bin/magento setup:install \
82+
--base-url=http://localhost \
83+
--db-host=127.0.0.1 \
84+
--db-name=magento \
85+
--db-user=root \
86+
--db-password=magento \
87+
--admin-firstname=Admin \
88+
--admin-lastname=User \
89+
--admin-email=admin@example.com \
90+
--admin-user=admin \
91+
--admin-password=admin12345 \
92+
--language=en_US \
93+
--currency=USD \
94+
--timezone=Europe/Berlin \
95+
--use-rewrites=1 \
96+
--backend-frontname=admin \
97+
--search-engine=${{ matrix.search-engine-name }} \
98+
--elasticsearch-host=localhost \
99+
--elasticsearch-port=9200 \
100+
--elasticsearch-index-prefix=magento \
101+
--cleanup-database
102+
103+
- name: Install MageForge Module from current commit
104+
working-directory: magento2
105+
run: |
106+
# Add a local repository pointing to the current code
107+
composer config repositories.mageforge-local path ../mageforge
108+
109+
# Install the module from the local repository
110+
composer require --no-update openforgeproject/mageforge:@dev
111+
112+
# Update dependencies
113+
composer update openforgeproject/mageforge --with-dependencies
114+
115+
# Enable the module and run setup upgrade
116+
bin/magento module:enable OpenForgeProject_MageForge
117+
bin/magento setup:upgrade
118+
119+
- name: Check Module Commands
120+
working-directory: magento2
121+
run: |
122+
echo "Check if module is enabled:"
123+
bin/magento module:status | grep OpenForgeProject_MageForge
124+
125+
echo "Check if MageForge commands are available:"
126+
bin/magento list | grep mageforge
127+
128+
echo "Test MageForge Version command:"
129+
bin/magento mageforge:system:version
130+
131+
echo "Test MageForge System Check command:"
132+
bin/magento mageforge:system:check
133+
134+
echo "Test MageForge Theme List command:"
135+
bin/magento mageforge:theme:list
136+
137+
- name: Test Summary
138+
run: |
139+
echo "MageForge module compatibility test with Magento ${{ matrix.magento-version }} completed"
140+
141+
test-opensearch:
142+
name: Magento 2.4.8 with PHP 8.4 Test
143+
runs-on: ubuntu-latest
144+
145+
services:
146+
mysql:
147+
image: mysql:8.0
148+
env:
149+
MYSQL_ROOT_PASSWORD: magento
150+
MYSQL_DATABASE: magento
151+
ports:
152+
- 3306:3306
153+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
154+
54155
opensearch:
55156
image: opensearchproject/opensearch:2.11.0
56-
if: ${{ matrix.search-engine == 'opensearch' }}
57157
ports:
58158
- 9200:9200
59159
env:
@@ -71,7 +171,7 @@ jobs:
71171
- name: Setup PHP
72172
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401
73173
with:
74-
php-version: ${{ matrix.php-version }}
174+
php-version: '8.4'
75175
extensions: mbstring, intl, gd, xml, soap, zip, bcmath, pdo_mysql, curl, sockets
76176
tools: composer:v2
77177

@@ -80,16 +180,16 @@ jobs:
80180
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
81181
with:
82182
path: ~/.composer/cache/files
83-
key: ${{ runner.os }}-composer-${{ matrix.magento-version }}-${{ hashFiles('**/composer.json') }}
84-
restore-keys: ${{ runner.os }}-composer-${{ matrix.magento-version }}
183+
key: ${{ runner.os }}-composer-2.4.8-${{ hashFiles('**/composer.json') }}
184+
restore-keys: ${{ runner.os }}-composer-2.4.8
85185

86186
- name: Clone Magento
87187
run: |
88-
git clone --depth=1 --branch=${{ matrix.magento-version }} https://github.com/magento/magento2.git magento2
188+
git clone --depth=1 --branch=2.4.8 https://github.com/magento/magento2.git magento2
89189
90190
- name: Check Search Engine status
91191
run: |
92-
curl -s http://localhost:9200/_cluster/health || echo "Search service health check failed"
192+
curl -s http://localhost:9200/_cluster/health
93193
94194
- name: Install Magento
95195
working-directory: magento2
@@ -115,10 +215,10 @@ jobs:
115215
--timezone=Europe/Berlin \
116216
--use-rewrites=1 \
117217
--backend-frontname=admin \
118-
--search-engine=${{ matrix.search-engine-name }} \
119-
--${{ matrix.search-engine }}-host=localhost \
120-
--${{ matrix.search-engine }}-port=9200 \
121-
--${{ matrix.search-engine }}-index-prefix=magento \
218+
--search-engine=opensearch \
219+
--opensearch-host=localhost \
220+
--opensearch-port=9200 \
221+
--opensearch-index-prefix=magento \
122222
--cleanup-database
123223
124224
- name: Install MageForge Module from current commit
@@ -157,4 +257,4 @@ jobs:
157257
158258
- name: Test Summary
159259
run: |
160-
echo "MageForge module compatibility test with Magento ${{ matrix.magento-version }} completed"
260+
echo "MageForge module compatibility test with Magento 2.4.8 completed"

0 commit comments

Comments
 (0)