Skip to content

Commit d05073a

Browse files
committed
feat: add Magento compatibility tests workflow
1 parent a62a512 commit d05073a

File tree

1 file changed

+137
-0
lines changed

1 file changed

+137
-0
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Magento Compatibility Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
name: Magento ${{ matrix.magento-version }} Test
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
magento-version: ['2.4.5', '2.4.6', '2.4.7']
18+
php-version: ['8.1', '8.2', '8.3']
19+
include:
20+
- magento-version: '2.4.5'
21+
php-version: '8.1'
22+
- magento-version: '2.4.6'
23+
php-version: '8.2'
24+
- magento-version: '2.4.7'
25+
php-version: '8.3'
26+
27+
services:
28+
mysql:
29+
image: mysql:8.0
30+
env:
31+
MYSQL_ROOT_PASSWORD: magento
32+
MYSQL_DATABASE: magento
33+
ports:
34+
- 3306:3306
35+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
36+
37+
elasticsearch:
38+
image: elasticsearch:7.17.0
39+
ports:
40+
- 9200:9200
41+
env:
42+
discovery.type: single-node
43+
ES_JAVA_OPTS: -Xms512m -Xmx512m
44+
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
45+
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v3
49+
with:
50+
path: mageforge
51+
52+
- name: Setup PHP
53+
uses: shivammathur/setup-php@v2
54+
with:
55+
php-version: ${{ matrix.php-version }}
56+
extensions: mbstring, intl, gd, xml, soap, zip, bcmath, pdo_mysql, curl, sockets
57+
tools: composer:v2
58+
59+
- name: Setup Node.js
60+
uses: actions/setup-node@v3
61+
with:
62+
node-version: '22'
63+
64+
- name: Install OS dependencies
65+
run: |
66+
sudo apt-get update
67+
sudo apt-get install -y libonig-dev libzip-dev libjpeg-dev libpng-dev libfreetype6-dev
68+
69+
- name: Cache Composer packages
70+
id: composer-cache
71+
uses: actions/cache@v3
72+
with:
73+
path: ~/.composer/cache/files
74+
key: ${{ runner.os }}-composer-${{ matrix.magento-version }}-${{ hashFiles('**/composer.json') }}
75+
restore-keys: ${{ runner.os }}-composer-${{ matrix.magento-version }}
76+
77+
- name: Clone Magento
78+
run: |
79+
git clone --depth=1 --branch=${{ matrix.magento-version }}-p2 https://github.com/magento/magento2.git magento2
80+
81+
- name: Install Magento
82+
working-directory: magento2
83+
env:
84+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
85+
run: |
86+
composer config minimum-stability dev
87+
composer config prefer-stable true
88+
composer install --no-interaction --no-progress
89+
mkdir -p app/code/OpenForgeProject
90+
cp -R ../mageforge app/code/OpenForgeProject/MageForge
91+
bin/magento setup:install \
92+
--base-url=http://localhost \
93+
--db-host=127.0.0.1 \
94+
--db-name=magento \
95+
--db-user=root \
96+
--db-password=magento \
97+
--admin-firstname=Admin \
98+
--admin-lastname=User \
99+
--admin-email=admin@example.com \
100+
--admin-user=admin \
101+
--admin-password=admin12345 \
102+
--language=en_US \
103+
--currency=USD \
104+
--timezone=Europe/Berlin \
105+
--use-rewrites=1 \
106+
--search-engine=elasticsearch7 \
107+
--elasticsearch-host=localhost \
108+
--elasticsearch-port=9200 \
109+
--cleanup-database
110+
111+
- name: Install frontend dependencies
112+
working-directory: magento2
113+
run: |
114+
npm install -g grunt-cli
115+
npm install
116+
bin/magento setup:static-content:deploy -f
117+
118+
- name: Enable MageForge Module
119+
working-directory: magento2
120+
run: |
121+
bin/magento module:enable OpenForgeProject_MageForge
122+
bin/magento setup:upgrade
123+
bin/magento setup:di:compile
124+
125+
- name: Test MageForge Commands
126+
working-directory: magento2
127+
run: |
128+
bin/magento mageforge:version
129+
bin/magento mageforge:system:check
130+
bin/magento mageforge:theme:list
131+
132+
# Optionally try building a theme if this is a realistic test scenario
133+
# bin/magento mageforge:theme:build Magento/luma
134+
135+
- name: Test Summary
136+
run: |
137+
echo "MageForge compatibility test with Magento ${{ matrix.magento-version }} completed"

0 commit comments

Comments
 (0)