Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
name: Check phpcs
name: PHPCS

on: [pull_request]

permissions:
contents: read

env:
PHP_VERSION: "8.3"
PHP_VERSION: "8.4"

jobs:
check-phpcs:
runs-on: ubuntu-latest

if: false

steps:
- name: Checkout code
uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@19ba822314c230a9039afce40e65d6c2b352ebfb
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}

- name: Install Magento Coding Standard
run: composer create-project magento/magento-coding-standard --stability=dev /tmp/magento-coding-standard

- name: Run PHPCS
continue-on-error: true
run: /tmp/magento-coding-standard/vendor/bin/phpcs -p -s --standard=Magento2 src/
119 changes: 119 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: PHPStan

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

permissions:
contents: read

jobs:
phpstan:
name: PHPStan Analysis
runs-on: ubuntu-latest

services:
mariadb:
image: mariadb:11.4
env:
MYSQL_ROOT_PASSWORD: magento
MYSQL_DATABASE: magento
ports:
- 3306:3306
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3

opensearch:
image: opensearchproject/opensearch:3
ports:
- 9200:9200
env:
discovery.type: single-node
DISABLE_SECURITY_PLUGIN: true
OPENSEARCH_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@v4
with:
path: mageforge

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
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@v4
with:
path: ~/.composer/cache/files
key: ${{ runner.os }}-composer-2.4.8-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-2.4.8

- name: Clone Magento
run: |
git clone --depth=1 --branch=2.4.8 https://github.com/magento/magento2.git magento2

- 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=opensearch \
--opensearch-host=localhost \
--opensearch-port=9200 \
--opensearch-index-prefix=magento \
--cleanup-database

- name: Install MageForge Module and PHPStan
working-directory: magento2
run: |
# Add local repository
composer config repositories.mageforge-local path ../mageforge

# Install module
composer require --no-update openforgeproject/mageforge:@dev

# Allow PHPStan extension installer
composer config --no-plugins allow-plugins.phpstan/extension-installer true

# Install PHPStan and Magento extension
composer require --dev --no-update bitexpert/phpstan-magento "phpstan/phpstan:^2.0" phpstan/extension-installer

# Update
composer update --with-dependencies

# Enable module
bin/magento module:enable OpenForgeProject_MageForge
bin/magento setup:upgrade

- name: Run PHPStan
working-directory: magento2
continue-on-error: true
run: |
vendor/bin/phpstan analyse -c vendor/openforgeproject/mageforge/phpstan.neon vendor/openforgeproject/mageforge/src
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 6
paths:
- src
Loading