Skip to content

feat: add Magento compatibility tests workflow #21

feat: add Magento compatibility tests workflow

feat: add Magento compatibility tests workflow #21

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@v3
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@v3
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 \
[email protected] \
--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"