Skip to content

Commit ff04dc0

Browse files
authored
feat: add Magento compatibility tests workflow (#35)
* feat: add Magento compatibility tests workflow * refactor: update job name and simplify PHP version matrix in Magento compatibility workflow * refactor: update workflow names and simplify Magento compatibility test steps * refactor: restrict Magento version matrix to 2.4.7 * refactor: expand Magento version matrix to include 2.4.6 with PHP 8.2 * refactor: update workflow names to English for consistency * refactor: remove unnecessary directory creation for OpenForgeProject * refactor: move MageForge module installation to a separate step * refactor: install MageForge module from local repository * refactor: update action versions in Magento compatibility workflow * refactor: update MageForge module installation command in workflow * refactor: update MageForge module requirement to use dev version * refactor: update actions to latest stable versions * refactor: update MageForge module requirement to use stable version * refactor: update minimum stability to stable and require MageForge module from stable version * refactor: update Magento requirement to 2.4.7 and enhance custom theme builder documentation * refactor: update Magento versions to 2.4.7 and 2.4.8 with PHP 8.3 and 8.4 * refactor: update Magento version to 2.4.8-beta1 and 2.4.8-beta2 in compatibility workflow * refactor: remove beta Magento versions from compatibility workflow * refactor: add Magento 2.4.8-beta2 with PHP 8.4 to compatibility workflow * refactor: update Magento version to 2.4.7-p4 in compatibility workflow * refactor: update PHP version for Magento 2.4.7-p4 and fix setup-php action version * refactor: update setup-php action version to latest * refactor: update action versions for checkout, setup-php, and cache * refactor: add codacy-disable-line comment before Setup PHP step * refactor: add Codacy configuration and remove disable-line comment before Setup PHP step
1 parent a62a512 commit ff04dc0

File tree

4 files changed

+224
-7
lines changed

4 files changed

+224
-7
lines changed

.codacy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Codacy-Konfiguration
2+
engines:
3+
github-workflows:
4+
exclude_paths:
5+
- .github/workflows/magento-compatibility.yml
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Magento Module Compatibility Test
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 }} with PHP ${{ matrix.php-version }} Test
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- magento-version: '2.4.7'
19+
php-version: '8.3'
20+
- magento-version: '2.4.7-p4'
21+
php-version: '8.3'
22+
23+
services:
24+
mysql:
25+
image: mysql:8.0
26+
env:
27+
MYSQL_ROOT_PASSWORD: magento
28+
MYSQL_DATABASE: magento
29+
ports:
30+
- 3306:3306
31+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
32+
33+
elasticsearch:
34+
image: elasticsearch:7.17.0
35+
ports:
36+
- 9200:9200
37+
env:
38+
discovery.type: single-node
39+
ES_JAVA_OPTS: -Xms512m -Xmx512m
40+
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
45+
with:
46+
path: mageforge
47+
48+
- name: Setup PHP
49+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401
50+
with:
51+
php-version: ${{ matrix.php-version }}
52+
extensions: mbstring, intl, gd, xml, soap, zip, bcmath, pdo_mysql, curl, sockets
53+
tools: composer:v2
54+
55+
- name: Cache Composer packages
56+
id: composer-cache
57+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
58+
with:
59+
path: ~/.composer/cache/files
60+
key: ${{ runner.os }}-composer-${{ matrix.magento-version }}-${{ hashFiles('**/composer.json') }}
61+
restore-keys: ${{ runner.os }}-composer-${{ matrix.magento-version }}
62+
63+
- name: Clone Magento
64+
run: |
65+
git clone --depth=1 --branch=${{ matrix.magento-version }} https://github.com/magento/magento2.git magento2
66+
67+
- name: Check Elasticsearch status
68+
run: |
69+
curl -s http://localhost:9200/_cluster/health
70+
71+
- name: Install Magento
72+
working-directory: magento2
73+
env:
74+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
75+
run: |
76+
composer config minimum-stability stable
77+
composer config prefer-stable true
78+
composer install --no-interaction --no-progress
79+
bin/magento setup:install \
80+
--base-url=http://localhost \
81+
--db-host=127.0.0.1 \
82+
--db-name=magento \
83+
--db-user=root \
84+
--db-password=magento \
85+
--admin-firstname=Admin \
86+
--admin-lastname=User \
87+
88+
--admin-user=admin \
89+
--admin-password=admin12345 \
90+
--language=en_US \
91+
--currency=USD \
92+
--timezone=Europe/Berlin \
93+
--use-rewrites=1 \
94+
--backend-frontname=admin \
95+
--search-engine=elasticsearch7 \
96+
--elasticsearch-host=localhost \
97+
--elasticsearch-port=9200 \
98+
--elasticsearch-index-prefix=magento \
99+
--cleanup-database
100+
101+
- name: Install MageForge Module from current commit
102+
working-directory: magento2
103+
run: |
104+
# Füge ein lokales Repository hinzu, das auf den aktuellen Code verweist
105+
composer config repositories.mageforge-local path ../mageforge
106+
107+
# Installiere das Modul aus dem lokalen Repository
108+
composer require --no-update openforgeproject/mageforge:@dev
109+
110+
# Aktualisiere die Abhängigkeiten
111+
composer update openforgeproject/mageforge --with-dependencies
112+
113+
# Aktiviere das Modul und führe das Setup-Upgrade aus
114+
bin/magento module:enable OpenForgeProject_MageForge
115+
bin/magento setup:upgrade
116+
117+
- name: Check Module Commands
118+
working-directory: magento2
119+
run: |
120+
echo "Check if module is enabled:"
121+
bin/magento module:status | grep OpenForgeProject_MageForge
122+
123+
echo "Check if MageForge commands are available:"
124+
bin/magento list | grep mageforge
125+
126+
echo "Test MageForge Version command:"
127+
bin/magento mageforge:version
128+
129+
echo "Test MageForge System Check command:"
130+
bin/magento mageforge:system:check
131+
132+
echo "Test MageForge Theme List command:"
133+
bin/magento mageforge:theme:list
134+
135+
- name: Test Summary
136+
run: |
137+
echo "MageForge module compatibility test with Magento ${{ matrix.magento-version }} completed"

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,38 @@ MageForge is a Magento 2 module designed to assist frontend developers in stream
1212

1313
## Magento Requirements
1414

15-
MageForge requires Magento 2.4.6 or higher.
15+
MageForge requires Magento 2.4.7 or higher.
1616
Please ensure that your Magento installation meets this requirement before installation.
1717

1818
## Features
1919

20+
### Supported Theme-Types 🎨
21+
22+
| Theme Type | Support Status |
23+
|------------|----------------|
24+
| 🎯 Magento Standard | ✅ Fully Supported |
25+
| 🚀 Hyvä | ✅ Fully Supported |
26+
| 🔄 Hyvä Fallback | ✅ Fully Supported |
27+
| 🎨 Custom TailwindCSS (no Hyvä) | ✅ Fully Supported |
28+
| 💼 Avanta B2B | ✅ Fully Supported |
29+
| 🥰 Your Custom Theme | [Create your own Builder](./docs/custom_theme_builders.md) |
30+
31+
---
32+
2033
### Available Commands
2134

2235
| Command | Description |
2336
|---------------------------|-------------------------------------------------------------|
2437
| `mageforge:version` | Shows current and latest version of the module |
25-
| `mageforge:system-check` | Checks system requirements (PHP, MySQL, Node.js, etc.) |
38+
| `mageforge:system-check` | Get system information (OS, PHP, Database, Node.js, etc.) |
2639
| `mageforge:theme:list` | Lists all available themes |
2740
| `mageforge:theme:build` | Builds selected themes (CSS/TailwindCSS) |
2841
| `mageforge:theme:watch` | Starts watch mode for theme development |
2942

3043
---
3144

32-
## Installation
45+
## Getting Started
46+
### Installation
3347

3448
1. Add the repository to your `composer.json`:
3549
```json

docs/custom_theme_builders.md

Lines changed: 65 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,62 @@ The ThemeBuilder architecture consists of the following components:
1414
2. **BuilderPool**: Manages the available builders and selects the appropriate builder for a theme
1515
3. **Concrete Builder Implementations**: Specialized builders for different theme types
1616

17+
## Directory Structure for Your Custom Module
18+
19+
To create your own ThemeBuilder, you'll need to set up a custom Magento 2 module with the following structure:
20+
21+
```
22+
app/code/YourCompany/YourModule/
23+
├── Console/
24+
│ └── Command/
25+
│ └── [Optional custom commands]
26+
├── Service/
27+
│ └── ThemeBuilder/
28+
│ └── YourBuilder/
29+
│ └── Builder.php
30+
├── etc/
31+
│ ├── di.xml
32+
│ └── module.xml
33+
└── registration.php
34+
```
35+
36+
This is a minimal structure for your module. You can add more files and directories as needed for your specific implementation.
37+
1738
## Creating Your Own ThemeBuilder
1839

19-
### Step 1: Create a New Builder Class
40+
### Step 1: Create the Module Structure
2041

21-
Create a new class in one of your modules or in a custom MageForge plugin. The structure should look like this:
42+
First, create the basic module structure as shown above:
43+
44+
1. Create the module directory: `app/code/YourCompany/YourModule/`
45+
2. Create a registration.php file:
46+
```php
47+
<?php
48+
use Magento\Framework\Component\ComponentRegistrar;
49+
50+
ComponentRegistrar::register(
51+
ComponentRegistrar::MODULE,
52+
'YourCompany_YourModule',
53+
__DIR__
54+
);
55+
```
56+
57+
3. Create a module.xml file in the etc directory:
58+
```xml
59+
<?xml version="1.0"?>
60+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
61+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
62+
<module name="YourCompany_YourModule" setup_version="1.0.0">
63+
<sequence>
64+
<module name="OpenForgeProject_MageForge"/>
65+
</sequence>
66+
</module>
67+
</config>
68+
```
69+
70+
### Step 2: Create a New Builder Class
71+
72+
Create a new Builder class in `app/code/YourCompany/YourModule/Service/ThemeBuilder/YourBuilder/Builder.php`:
2273

2374
```php
2475
<?php
@@ -121,9 +172,9 @@ class Builder implements BuilderInterface
121172
}
122173
```
123174

124-
### Step 2: Register Your Builder in the DI System
175+
### Step 3: Register Your Builder in the DI System
125176

126-
To make your builder available to MageForge, you need to register it in Magento's Dependency Injection system. Create a `di.xml` file in your module:
177+
Create a `di.xml` file in `app/code/YourCompany/YourModule/etc/`:
127178

128179
```xml
129180
<?xml version="1.0"?>
@@ -139,6 +190,16 @@ To make your builder available to MageForge, you need to register it in Magento'
139190
</config>
140191
```
141192

193+
### Step 4: Install and Enable Your Module
194+
195+
After creating all the required files, you need to enable your module:
196+
197+
1. Run `bin/magento module:enable YourCompany_YourModule`
198+
2. Run `bin/magento setup:upgrade`
199+
3. Run `bin/magento cache:clean`
200+
201+
After these steps, your custom ThemeBuilder will be available and integrated with MageForge.
202+
142203
## Implementation Details
143204

144205
### The detect() Method

0 commit comments

Comments
 (0)