mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-13 13:14:53 +00:00
feat(coding-standard): add ignore_warnings flag (#147)
By default, `phpcs` exits with a non-zero exit code when it finds warnings. We keep that default, but allow changing it. Co-authored-by: Vitaliy Golomoziy <vitaliy.golomoziy@gmail.com>
This commit is contained in:
@@ -31,7 +31,23 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
compute_matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
matrix: ${{ steps.supported-version.outputs.matrix }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: ./supported-version
|
||||||
|
with:
|
||||||
|
kind: all
|
||||||
|
id: supported-version
|
||||||
|
- run: echo ${{ steps.supported-version.outputs.matrix }}
|
||||||
|
|
||||||
coding-standard:
|
coding-standard:
|
||||||
|
needs: compute_matrix
|
||||||
|
strategy:
|
||||||
|
matrix: ${{ fromJSON(needs.compute_matrix.outputs.matrix) }}
|
||||||
|
fail-fast: false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@@ -39,3 +55,5 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: ${{ github.event.inputs.version || '*' }}
|
version: ${{ github.event.inputs.version || '*' }}
|
||||||
path: ${{ github.event.inputs.path || '_test/demo-package' }}
|
path: ${{ github.event.inputs.path || '_test/demo-package' }}
|
||||||
|
composer_version: ${{ matrix.composer }}
|
||||||
|
php_version: ${{ matrix.php }}
|
||||||
@@ -37,6 +37,11 @@ inputs:
|
|||||||
default: ""
|
default: ""
|
||||||
description: "The minimum severity required to display an error"
|
description: "The minimum severity required to display an error"
|
||||||
|
|
||||||
|
ignore_warnings:
|
||||||
|
description: 'Whether or not the action should fail on warnings, defaults to false (fails on warnings)'
|
||||||
|
default: 'false'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@@ -57,6 +62,23 @@ runs:
|
|||||||
tools: composer:v${{ inputs.composer_version }}
|
tools: composer:v${{ inputs.composer_version }}
|
||||||
coverage: none
|
coverage: none
|
||||||
|
|
||||||
|
- name: Get Composer Version
|
||||||
|
uses: mage-os/github-actions/get-composer-version@main
|
||||||
|
id: get-composer-version
|
||||||
|
|
||||||
|
- name: Check if allow-plugins option is available for this version of composer
|
||||||
|
uses: mage-os/github-actions/semver-compare@main
|
||||||
|
with:
|
||||||
|
version: 2.2
|
||||||
|
compare_against: ${{ steps.get-composer-version.outputs.version }}
|
||||||
|
id: is-allow-plugins-available
|
||||||
|
|
||||||
|
- name: Enable dealerdirect/phpcodesniffer-composer-installer plugin
|
||||||
|
shell: bash
|
||||||
|
working-directory: standard
|
||||||
|
run: composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true --global
|
||||||
|
if: steps.is-allow-plugins-available.outputs.result < 1
|
||||||
|
|
||||||
- name: Install Coding Standard
|
- name: Install Coding Standard
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: standard
|
working-directory: standard
|
||||||
@@ -67,6 +89,12 @@ runs:
|
|||||||
working-directory: standard
|
working-directory: standard
|
||||||
run: vendor/bin/phpcs --config-set installed_paths ${{ github.workspace }}/standard/vendor/magento/magento-coding-standard,${{ github.workspace }}/standard/vendor/phpcompatibility/php-compatibility
|
run: vendor/bin/phpcs --config-set installed_paths ${{ github.workspace }}/standard/vendor/magento/magento-coding-standard,${{ github.workspace }}/standard/vendor/phpcompatibility/php-compatibility
|
||||||
|
|
||||||
|
- name: Set ignore warnings flag
|
||||||
|
shell: bash
|
||||||
|
working-directory: standard
|
||||||
|
run: vendor/bin/phpcs --config-set ignore_warnings_on_exit 1
|
||||||
|
if: inputs.ignore_warnings == 'true'
|
||||||
|
|
||||||
- name: Get Changed Files
|
- name: Get Changed Files
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: project
|
working-directory: project
|
||||||
|
|||||||
Reference in New Issue
Block a user