From a7b2b955cba2b35773b349b809b7fd6c0fa98768 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 28 Feb 2021 06:17:05 +0100 Subject: [PATCH] GH Actions: report CS violations in the PR The cs2pr tool will allow to display the results from an action run in checkstyle format in-line in the PR code view, which should improve usability of the workflow results. As the CS run is run in every test run in the matrix, passing the results on to CS2PR would result in violations being displayed multiple times, so using conditions to only pass the CS violations on to the PR for one of the runs. Ref: https://github.com/staabm/annotate-pull-request-from-checkstyle --- .github/workflows/test.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 299e1e3283..0cf69cc2f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,6 +66,7 @@ jobs: php-version: ${{ matrix.php }} ini-values: ${{ steps.set_ini.outputs.PHP_INI }} coverage: none + tools: cs2pr # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies @@ -97,9 +98,18 @@ jobs: run: vendor/bin/phpunit tests/AllTests.php --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests - name: 'PHPCS: check code style without cache, no parallel' - if: ${{ matrix.custom_ini == false }} + if: ${{ matrix.custom_ini == false && matrix.php != 7.4 }} run: php bin/phpcs --no-cache --parallel=1 + - name: 'PHPCS: check code style to show results in PR' + if: ${{ matrix.custom_ini == false && matrix.php == 7.4 }} + continue-on-error: true + run: php bin/phpcs --no-cache --parallel=1 --report-full --report-checkstyle=./phpcs-report.xml + + - name: Show PHPCS results in PR + if: ${{ matrix.custom_ini == false && matrix.php == 7.4 }} + run: cs2pr ./phpcs-report.xml + - name: 'Composer: validate config' if: ${{ matrix.custom_ini == false }} run: composer validate --no-check-all --strict