Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d05073a
feat: add Magento compatibility tests workflow
dermatz Apr 4, 2025
307a017
refactor: update job name and simplify PHP version matrix in Magento …
dermatz Apr 4, 2025
bbcd83a
refactor: update workflow names and simplify Magento compatibility te…
dermatz Apr 4, 2025
c2d9e8d
refactor: restrict Magento version matrix to 2.4.7
dermatz Apr 4, 2025
a6cf544
refactor: expand Magento version matrix to include 2.4.6 with PHP 8.2
dermatz Apr 4, 2025
a570311
refactor: update workflow names to English for consistency
dermatz Apr 4, 2025
40a50e8
refactor: remove unnecessary directory creation for OpenForgeProject
dermatz Apr 4, 2025
300ee70
refactor: move MageForge module installation to a separate step
dermatz Apr 4, 2025
ccabef2
refactor: install MageForge module from local repository
dermatz Apr 4, 2025
59c2bf3
refactor: update action versions in Magento compatibility workflow
dermatz Apr 4, 2025
1f34a70
refactor: update MageForge module installation command in workflow
dermatz Apr 4, 2025
b8e1fc8
refactor: update MageForge module requirement to use dev version
dermatz Apr 4, 2025
50c73ac
refactor: update actions to latest stable versions
dermatz Apr 4, 2025
fcbd3d4
refactor: update MageForge module requirement to use stable version
dermatz Apr 4, 2025
4cf92a8
refactor: update minimum stability to stable and require MageForge mo…
dermatz Apr 4, 2025
9b48c48
refactor: update Magento requirement to 2.4.7 and enhance custom them…
dermatz Apr 4, 2025
a2969fe
refactor: update Magento versions to 2.4.7 and 2.4.8 with PHP 8.3 and…
dermatz Apr 4, 2025
fae5d2a
refactor: update Magento version to 2.4.8-beta1 and 2.4.8-beta2 in co…
dermatz Apr 4, 2025
dd8dd51
refactor: remove beta Magento versions from compatibility workflow
dermatz Apr 4, 2025
f1abb1c
refactor: add Magento 2.4.8-beta2 with PHP 8.4 to compatibility workflow
dermatz Apr 4, 2025
f998741
refactor: update Magento version to 2.4.7-p4 in compatibility workflow
dermatz Apr 4, 2025
f6f7d52
refactor: update PHP version for Magento 2.4.7-p4 and fix setup-php a…
dermatz Apr 4, 2025
28727d7
refactor: update setup-php action version to latest
dermatz Apr 4, 2025
1b36b1d
refactor: update action versions for checkout, setup-php, and cache
dermatz Apr 4, 2025
4f5e7ce
refactor: add codacy-disable-line comment before Setup PHP step
dermatz Apr 4, 2025
10eda72
refactor: add Codacy configuration and remove disable-line comment be…
dermatz Apr 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Codacy-Konfiguration
engines:
github-workflows:
exclude_paths:
- .github/workflows/magento-compatibility.yml
137 changes: 137 additions & 0 deletions .github/workflows/magento-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Magento Module Compatibility Test

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
workflow_dispatch:

jobs:
test:
name: Magento ${{ matrix.magento-version }} with PHP ${{ matrix.php-version }} Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- magento-version: '2.4.7'
php-version: '8.3'
- magento-version: '2.4.7-p4'
php-version: '8.3'

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: magento
MYSQL_DATABASE: magento
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

elasticsearch:
image: elasticsearch:7.17.0
ports:
- 9200:9200
env:
discovery.type: single-node
ES_JAVA_OPTS: -Xms512m -Xmx512m
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10

steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: mageforge

- name: Setup PHP
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, gd, xml, soap, zip, bcmath, pdo_mysql, curl, sockets
tools: composer:v2

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-composer-${{ matrix.magento-version }}-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-${{ matrix.magento-version }}

- name: Clone Magento
run: |
git clone --depth=1 --branch=${{ matrix.magento-version }} https://github.com/magento/magento2.git magento2

- name: Check Elasticsearch status
run: |
curl -s http://localhost:9200/_cluster/health

- name: Install Magento
working-directory: magento2
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
run: |
composer config minimum-stability stable
composer config prefer-stable true
composer install --no-interaction --no-progress
bin/magento setup:install \
--base-url=http://localhost \
--db-host=127.0.0.1 \
--db-name=magento \
--db-user=root \
--db-password=magento \
--admin-firstname=Admin \
--admin-lastname=User \
--admin-email=admin@example.com \
--admin-user=admin \
--admin-password=admin12345 \
--language=en_US \
--currency=USD \
--timezone=Europe/Berlin \
--use-rewrites=1 \
--backend-frontname=admin \
--search-engine=elasticsearch7 \
--elasticsearch-host=localhost \
--elasticsearch-port=9200 \
--elasticsearch-index-prefix=magento \
--cleanup-database

- name: Install MageForge Module from current commit
working-directory: magento2
run: |
# Füge ein lokales Repository hinzu, das auf den aktuellen Code verweist
composer config repositories.mageforge-local path ../mageforge

# Installiere das Modul aus dem lokalen Repository
composer require --no-update openforgeproject/mageforge:@dev

# Aktualisiere die Abhängigkeiten
composer update openforgeproject/mageforge --with-dependencies

# Aktiviere das Modul und führe das Setup-Upgrade aus
bin/magento module:enable OpenForgeProject_MageForge
bin/magento setup:upgrade

- name: Check Module Commands
working-directory: magento2
run: |
echo "Check if module is enabled:"
bin/magento module:status | grep OpenForgeProject_MageForge

echo "Check if MageForge commands are available:"
bin/magento list | grep mageforge

echo "Test MageForge Version command:"
bin/magento mageforge:version

echo "Test MageForge System Check command:"
bin/magento mageforge:system:check

echo "Test MageForge Theme List command:"
bin/magento mageforge:theme:list

- name: Test Summary
run: |
echo "MageForge module compatibility test with Magento ${{ matrix.magento-version }} completed"
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,38 @@ MageForge is a Magento 2 module designed to assist frontend developers in stream

## Magento Requirements

MageForge requires Magento 2.4.6 or higher.
MageForge requires Magento 2.4.7 or higher.
Please ensure that your Magento installation meets this requirement before installation.

## Features

### Supported Theme-Types 🎨

| Theme Type | Support Status |
|------------|----------------|
| 🎯 Magento Standard | ✅ Fully Supported |
| 🚀 Hyvä | ✅ Fully Supported |
| 🔄 Hyvä Fallback | ✅ Fully Supported |
| 🎨 Custom TailwindCSS (no Hyvä) | ✅ Fully Supported |
| 💼 Avanta B2B | ✅ Fully Supported |
| 🥰 Your Custom Theme | [Create your own Builder](./docs/custom_theme_builders.md) |

---

### Available Commands

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

---

## Installation
## Getting Started
### Installation

1. Add the repository to your `composer.json`:
```json
Expand Down
69 changes: 65 additions & 4 deletions docs/custom_theme_builders.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,62 @@ The ThemeBuilder architecture consists of the following components:
2. **BuilderPool**: Manages the available builders and selects the appropriate builder for a theme
3. **Concrete Builder Implementations**: Specialized builders for different theme types

## Directory Structure for Your Custom Module

To create your own ThemeBuilder, you'll need to set up a custom Magento 2 module with the following structure:

```
app/code/YourCompany/YourModule/
├── Console/
│ └── Command/
│ └── [Optional custom commands]
├── Service/
│ └── ThemeBuilder/
│ └── YourBuilder/
│ └── Builder.php
├── etc/
│ ├── di.xml
│ └── module.xml
└── registration.php
```

This is a minimal structure for your module. You can add more files and directories as needed for your specific implementation.

## Creating Your Own ThemeBuilder

### Step 1: Create a New Builder Class
### Step 1: Create the Module Structure

Create a new class in one of your modules or in a custom MageForge plugin. The structure should look like this:
First, create the basic module structure as shown above:

1. Create the module directory: `app/code/YourCompany/YourModule/`
2. Create a registration.php file:
```php
<?php
use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'YourCompany_YourModule',
__DIR__
);
```

3. Create a module.xml file in the etc directory:
```xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="YourCompany_YourModule" setup_version="1.0.0">
<sequence>
<module name="OpenForgeProject_MageForge"/>
</sequence>
</module>
</config>
```

### Step 2: Create a New Builder Class

Create a new Builder class in `app/code/YourCompany/YourModule/Service/ThemeBuilder/YourBuilder/Builder.php`:

```php
<?php
Expand Down Expand Up @@ -121,9 +172,9 @@ class Builder implements BuilderInterface
}
```

### Step 2: Register Your Builder in the DI System
### Step 3: Register Your Builder in the DI System

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:
Create a `di.xml` file in `app/code/YourCompany/YourModule/etc/`:

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

### Step 4: Install and Enable Your Module

After creating all the required files, you need to enable your module:

1. Run `bin/magento module:enable YourCompany_YourModule`
2. Run `bin/magento setup:upgrade`
3. Run `bin/magento cache:clean`

After these steps, your custom ThemeBuilder will be available and integrated with MageForge.

## Implementation Details

### The detect() Method
Expand Down