Skip to content

Commit

Permalink
Merge branch 'develop' into list-commands
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.lock
  • Loading branch information
sreichel committed Nov 12, 2024
2 parents c7fcb88 + aca0c55 commit 135f0ec
Show file tree
Hide file tree
Showing 12 changed files with 303 additions and 186 deletions.
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpstan
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPStan
## Usage: phpstan
## Example: ddev phpstan <path-to-files>

XDEBUG_MODE=off php vendor/bin/phpstan analyze "$@"
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
overwrite: true

- name: Run update tasks on files.magerun.net
uses: appleboy/ssh-action@v1.0.3
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.SSH_DEPLOY_HOST }}
username: ${{ secrets.SSH_DEPLOY_USERNAME }}
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: PHPStan

on:
push:
pull_request:
workflow_call:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
phpstan:
name: Analyze
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
openmage_version: ["20.10.2"]
operating-system: [ubuntu-latest]
php-versions: ['7.4']
mysql_version: ['8.0']

services:
mysql:
image: mysql:${{ matrix.mysql_version }}
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: magento_test_db
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Validate mysql service
run: |
echo "Checking mysql service"
sudo apt-get install -y mysql-client
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot -proot -e "SHOW DATABASES"
- name: Install OpenMage
run: |
php bin/n98-magerun --no-interaction install \
--magentoVersionByName="openmage-${{ matrix.openmage_version }}" \
--installationFolder="./magento" \
--dbHost="127.0.0.1" \
--dbPort="${{ job.services.mysql.ports['3306'] }}" \
--dbUser="root" \
--dbPass="root" \
--dbName="magento_test_db" \
--installSampleData=no \
--useDefaultConfigParams=yes \
--baseUrl="http://magento.local/"
env:
COMPOSER_VENDOR_PATH : ${{ github.workspace }}/magento/vendor

- name: PHPStan Static Analysis
run: XDEBUG_MODE=off php vendor/bin/phpstan.phar analyze
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ act.secrets
/docs/

# php-cs-fixer cache
/.php-cs-fixer.cache
/.php-cs-fixer.cache

# phpunit cache
/.phpunit.result.cache
16 changes: 16 additions & 0 deletions .phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
parameters:
ignoreErrors:
-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: src/N98/Magento/Application/ConfigFile.php

-
message: "#^Call to an undefined static method N98\\\\Util\\\\OperatingSystem\\:\\:getCurrentPhpBinary\\(\\)\\.$#"
count: 1
path: src/N98/Magento/Command/Installer/SubCommand/InstallComposer.php

-
message: "#^Call to an undefined static method N98\\\\Util\\\\OperatingSystem\\:\\:locateProgram\\(\\)\\.$#"
count: 1
path: src/N98/Magento/Command/Installer/SubCommand/InstallComposer.php
10 changes: 10 additions & 0 deletions .phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
includes:
- .phpstan.dist.baseline.neon
- phar://phpstan.phar/conf/bleedingEdge.neon
parameters:
paths:
- src
scanDirectories:
- magento
level: 1
treatPhpDocTypesAsCertain: false
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"magerun"
],
"require": {
"php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0",
"php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.3.0 || ~8.2.0 || ~8.4.0",
"ext-json": "*",
"ext-libxml": "*",
"ext-pdo": "*",
Expand Down
Loading

0 comments on commit 135f0ec

Please sign in to comment.