mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-08 19:46:41 +00:00
feat(coding-standard)!: remove pr-diff feature and built-in php setup (#224)
BREAKING CHANGE: Much of the "setup" that's built-into the command is removed in favor of a leaner action. This also includes the "on PR, only diff PR contents" behavior. This can be restored, but it shouldn't be the default and should be done as an input. Fix SEVERITY_FLAGS construction which exited 1 under bash -e when severity inputs were empty, causing CI failures.
This commit is contained in:
@@ -51,9 +51,14 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
tools: composer:v${{ matrix.composer }}
|
||||
coverage: none
|
||||
|
||||
- uses: './coding-standard'
|
||||
with:
|
||||
version: ${{ github.event.inputs.version || '*' }}
|
||||
path: ${{ github.event.inputs.path || '_test/demo-package' }}
|
||||
composer_version: ${{ matrix.composer }}
|
||||
php_version: ${{ matrix.php }}
|
||||
path: ${{ github.event.inputs.path || '_test/demo-package' }}
|
||||
@@ -152,56 +152,16 @@ jobs:
|
||||
fail-fast: ${{ inputs.fail-fast }}
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Get Composer Version
|
||||
uses: graycoreio/github-actions-magento2/get-composer-version@main
|
||||
id: get-composer-version
|
||||
|
||||
- name: Check if allow-plugins option is available for this version of composer
|
||||
uses: graycoreio/github-actions-magento2/semver-compare@main
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
version: 2.2
|
||||
compare_against: ${{ steps.get-composer-version.outputs.version }}
|
||||
id: is-allow-plugins-available
|
||||
php-version: ${{ matrix.php }}
|
||||
tools: composer:v${{ matrix.composer }}
|
||||
coverage: none
|
||||
|
||||
- name: Enable dealerdirect/phpcodesniffer-composer-installer plugin
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.path }}
|
||||
run: composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --global
|
||||
if: steps.is-allow-plugins-available.outputs.result < 1
|
||||
|
||||
- name: Install Coding Standard
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.path }}
|
||||
run: composer require "magento/magento-coding-standard" "magento/php-compatibility-fork"
|
||||
env:
|
||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||
|
||||
- name: Register Coding Standard
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.path }}
|
||||
run: |
|
||||
if [ -d vendor/magento/magento-coding-standard ]; then
|
||||
CODING_STANDARD_VENDOR=magento
|
||||
elif [ -d vendor/mage-os/magento-coding-standard ]; then
|
||||
CODING_STANDARD_VENDOR=mage-os
|
||||
else
|
||||
echo "No magento-coding-standard directory found under vendor/magento or vendor/mage-os."
|
||||
echo "Trusting dealerdirect/phpcodesniffer-composer-installer to have registered installed_paths."
|
||||
exit 0
|
||||
fi
|
||||
vendor/bin/phpcs --config-set installed_paths \
|
||||
"vendor/${CODING_STANDARD_VENDOR}/magento-coding-standard,vendor/${CODING_STANDARD_VENDOR}/php-compatibility-fork"
|
||||
|
||||
- name: Coding Standard Check
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -f .phpcs.xml ] || [ -f phpcs.xml ] || [ -f .phpcs.xml.dist ] || [ -f phpcs.xml.dist ]; then
|
||||
./vendor/bin/phpcs .
|
||||
else
|
||||
./vendor/bin/phpcs --standard=Magento2 --ignore=*vendor/* .
|
||||
fi
|
||||
working-directory: ${{ inputs.path }}
|
||||
- uses: graycoreio/github-actions-magento2/coding-standard@main
|
||||
with:
|
||||
path: ${{ inputs.path }}
|
||||
|
||||
integration_test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
Reference in New Issue
Block a user