Skip to content

Commit

Permalink
Merge branch 'main' into disabled-module
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Nov 11, 2024
2 parents f014022 + eaf63c1 commit a7a1c4c
Show file tree
Hide file tree
Showing 373 changed files with 2,816 additions and 4,398 deletions.
2 changes: 1 addition & 1 deletion .ddev/commands/web/phpcs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
## Usage: phpcs
## Example: ddev phpcs <path-to-files>

php vendor/bin/phpcs -s -p --report=full,summary "$@"
php vendor/bin/phpcs -s -p --standard=.phpcs.dist.xml --cache=.phpcs.result.cache --report=full,summary "$@"
2 changes: 1 addition & 1 deletion .ddev/commands/web/phpmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
## Usage: phpmd
## Example: ddev phpmd <path-to-files>

php vendor/bin/phpmd "$@" text .phpmd.dist.xml
php vendor/bin/phpmd "$@" text .phpmd.dist.xml --color --cache --baseline-file .phpmd.dist.baseline.xml
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpmd-no-baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPMD
## Usage: phpmd-no-baseline
## Example: ddev phpmd-no-baseline <path-to-files>

php vendor/bin/phpmd "$@" text .phpmd.dist.xml
2 changes: 1 addition & 1 deletion .ddev/commands/web/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
## Usage: phpunit
## Example: ddev phpunit

php vendor/bin/phpunit --no-coverage "$@" --testdox
php vendor/bin/phpunit --configuration .phpunit.dist.xml --no-coverage "$@" --testdox
2 changes: 1 addition & 1 deletion .ddev/commands/web/phpunit-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
## Example: ddev phpunit-coverage

enable_xdebug
XDEBUG_MODE=coverage php vendor/bin/phpunit "$@" --testdox
XDEBUG_MODE=coverage php vendor/bin/phpunit --configuration .phpunit.dist.xml --testdox "$@"
disable_xdebug
2 changes: 1 addition & 1 deletion .ddev/commands/web/phpunit-coverage-local
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
## Example: ddev phpunit-coverage-local

enable_xdebug
XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-html build/coverage "$@" --testdox
XDEBUG_MODE=coverage php vendor/bin/phpunit --configuration .phpunit.dist.xml --coverage-html build/coverage --testdox "$@"
disable_xdebug
2 changes: 1 addition & 1 deletion .ddev/commands/web/rector
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
## Usage: rector
## Example: ddev rector <path-to-files>

php vendor/bin/rector process "$@"
php vendor/bin/rector process --config .rector.php "$@"
5 changes: 3 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
/.phpcs.ecg.xml.dist export-ignore
/.phpcs.php.xml.dist export-ignore
/.phpcs.xml.dist export-ignore
/.phpmd.dist.baseline.xml export-ignore
/.phpmd.dist.xml export-ignore
/.phpstan.dist.baseline.neon export-ignore
/.phpstan.dist.neon export-ignore
/rector.php export-ignore
/.rector.php export-ignore

/README.md export-ignore

Expand All @@ -35,4 +36,4 @@
*.sql text eol=lf
*.svg text eol=lf
*.txt text eol=lf
*.phtml text eol=lf
*.phtml text eol=lf
12 changes: 9 additions & 3 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -884,18 +884,24 @@
.github/workflows/php-cs-fixer.yml
]

'phpmd':
- changed-files:
- any-glob-to-any-file: [
.phpmd*,
.github/workflows/phpmd.yml
]

'phpstan':
- changed-files:
- any-glob-to-any-file: [
.phpstan*,
phpstan*,
.github/workflows/phpstan.yml
]

'phpunit':
- changed-files:
- any-glob-to-any-file: [
phpunit*,
.phpunit*,
tests/*,
.github/workflows/phpunit.yml
]
Expand All @@ -910,6 +916,6 @@
'rector':
- changed-files:
- any-glob-to-any-file: [
rector.php,
.rector.php,
.github/workflows/rector.yml
]
17 changes: 15 additions & 2 deletions .github/workflows/check-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ on:
php-cs-fixer:
description: "Count changed PHP-CS-Fixer files"
value: ${{ jobs.check.outputs.php-cs-fixer }}
phpmd:
description: "Count changed PHPMD files"
value: ${{ jobs.check.outputs.phpmd }}
phpstan:
description: "Count changed PHPStan files"
value: ${{ jobs.check.outputs.phpstan }}
Expand All @@ -52,6 +55,7 @@ jobs:
workflow: ${{ steps.changes-workflow.outputs.workflow }}
phpcs: ${{ steps.changes-phpcs.outputs.phpcs }}
php-cs-fixer: ${{ steps.changes-php-cs-fixer.outputs.php-cs-fixer }}
phpmd: ${{ steps.changes-phpstan.outputs.phpmd }}
phpstan: ${{ steps.changes-phpstan.outputs.phpstan }}
phpunit-test: ${{ steps.changes-phpunit-test.outputs.phpunit-test }}
phpunit: ${{ steps.changes-phpunit.outputs.phpunit }}
Expand Down Expand Up @@ -87,8 +91,9 @@ jobs:
.github/workflows/**
**phpcs**
**php-cs-fixer**
**phpmd**
**phpstan**
rector.php
.rector.php
tests/
phpunit*
Expand Down Expand Up @@ -158,6 +163,14 @@ jobs:
echo "$count PHP-CS-Fixer file(s) changed"
echo "php-cs-fixer=$count" >> $GITHUB_OUTPUT
- name: Check if PHPMD files changed
id: changes-phpmd
if: steps.changed-files-specific.outputs.any_modified == 'true'
run: |
count="$(grep -oE "**phpmd**" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)"
echo "$count PHPMD file(s) changed"
echo "phpmd=$count" >> $GITHUB_OUTPUT
- name: Check if PHPStan files changed
id: changes-phpstan
if: steps.changed-files-specific.outputs.any_modified == 'true'
Expand All @@ -178,6 +191,6 @@ jobs:
id: changes-phpunit
if: steps.changed-files-specific.outputs.any_modified == 'true'
run: |
count="$(grep -oE "phpunit*" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)"
count="$(grep -oE "**phpunit**" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)"
echo "$count PHPUnit file(s) changed"
echo "phpunit=$count" >> $GITHUB_OUTPUT
8 changes: 4 additions & 4 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
matrix:
rules:
- label: Default
path: .phpcs.xml.dist
path: .phpcs.dist.xml
- label: Ecg
path: .phpcs.ecg.xml.dist
path: .phpcs.dist.ecg.xml
- label: PhpCompatibility
path: .phpcs.php.xml.dist
path: .phpcs.dist.php.xml

steps:
- name: Setup PHP
Expand All @@ -44,4 +44,4 @@ jobs:
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-*

- name: PHPCodeSniffer
run: php vendor/bin/phpcs -s --report=full --standard=${{ matrix.rules.path }}
run: php vendor/bin/phpcs -s -p --report=full --standard=${{ matrix.rules.path }}
32 changes: 32 additions & 0 deletions .github/workflows/phpmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PHPMD

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

jobs:
phpcs:
name: Mess Detector
runs-on: [ubuntu-latest]

steps:
- name: Checkout code
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 --ignore-platform-req=ext-*

- name: PHPMD
run: php vendor/bin/phpmd app/code/core/Mage/ github .phpmd.dist.xml --baseline-file .phpmd.dist.baseline.xml
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-*

- name: Restore result cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: .phpstan.cache
key: "phpstan-result-cache-${{ github.run_id }}"
Expand All @@ -48,7 +48,7 @@ jobs:
run: XDEBUG_MODE=off php vendor/bin/phpstan.phar analyze

- name: Save result cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: always()
with:
path: .phpstan.cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
--skip_url_validation 'yes'
- name: Run phpUnit
run: php -f vendor/bin/phpunit
run: php vendor/bin/phpunit --configuration .phpunit.dist.xml

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-*

- name: Rector
run: php vendor/bin/rector process --dry-run
run: php vendor/bin/rector process --config .rector.php --dry-run
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
php-versions: ['7.4']
steps:
- name: Checkout repository
uses: actions/checkout@master
uses: actions/checkout@4

- name: Get composer cache directory
id: composer-cache
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ on:
- '**.js'
- '**.xml'
- '.php-cs-fixer.dist.php'
- '.phpcs.xml.dist'
- '.phpcs.ecg.xml.dist'
- '.phpcs.php.xml.dist'
- 'phpstan.dist.neon'
- 'phpstan.dist.baseline.neon'
- '.phpcs.dist.xml'
- '.phpcs.dist.ecg.xml'
- '.phpcs.dist.php.xml'
- '.phpstan.dist.neon'
- '.phpstan.dist.baseline.neon'

pull_request:
paths:
Expand All @@ -27,11 +27,11 @@ on:
- '**.js'
- '**.xml'
- '.php-cs-fixer.dist.php'
- '.phpcs.xml.dist'
- '.phpcs.ecg.xml.dist'
- '.phpcs.php.xml.dist'
- 'phpstan.dist.neon'
- 'phpstan.dist.baseline.neon'
- '.phpcs.dist.xml'
- '.phpcs.dist.ecg.xml'
- '.phpcs.dist.php.xml'
- '.phpstan.dist.neon'
- '.phpstan.dist.baseline.neon'

jobs:
debug:
Expand Down Expand Up @@ -84,6 +84,16 @@ jobs:
needs.check.outputs.workflow > 0
uses: ./.github/workflows/php-cs-fixer.yml

phpmd:
name: PHPMD
needs: [check, composer]
if: |
needs.check.outputs.php > 0 ||
needs.check.outputs.phpmd > 0 ||
needs.check.outputs.composer > 0 ||
needs.check.outputs.workflow > 0
uses: ./.github/workflows/phpmd.yml

phpstan:
name: PHPStan
needs: [check, composer]
Expand Down
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@
.php-cs-fixer*
!.php-cs-fixer.dist.*

# PHPCS cache
.phpcs.result.cache
.phpcs*.xml
!.phpcs*.xml.dist
!.phpcs.dist*.xml
!.phpcs.xml
phpcs.xml

# PHPMD cache
.phpmd.result-cache.php

# PhpStan
.phpstan.cache
Expand All @@ -75,7 +82,7 @@ tests/coverage
tests/logging
.phpunit.result.cache
phpunit.xml
!phpunit.xml.dist
!.phpunit.dist.xml

# build
/build
Expand Down
Loading

0 comments on commit a7a1c4c

Please sign in to comment.