From 28061cb8691051a27c313cd073857a3d85d2db95 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 24 Oct 2022 16:47:15 +0000 Subject: [PATCH] Build/Test Tools: Ensure PHPCS related workflows are properly marked as failed. When a ruleset error is encountered during a PHPCodeSniffer scan, an XML report is not generated and `cs2pr` will exit with a `0`. In this situation, a workflow run will be marked as passing (even though a failure has occurred) due to the presence of `continue-on-error`. This adjusts the logic in the Coding Standards and PHP Compatibility workflows to remove the need for the `continue-on-error` option and ensures all failures are accurately reflected within the GitHub Actions UI. Follow up to [54371]. Props jrf, TobiasBg. See #55652. git-svn-id: https://develop.svn.wordpress.org/trunk@54678 602fd350-edb4-49c9-b593-d223f7449a82 --- .github/workflows/coding-standards.yml | 6 ++++-- .github/workflows/php-compatibility.yml | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 80d70c66e4..426778aeaa 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -102,17 +102,19 @@ jobs: run: phpcs -i - name: Run PHPCS on all Core files - continue-on-error: true + id: phpcs-core run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml - name: Show PHPCS results in PR + if: ${{ always() && steps.phpcs-core.outcome == 'failure' }} run: cs2pr ./.cache/phpcs-report.xml - name: Check test suite files for warnings - continue-on-error: true + id: phpcs-tests run: phpcs tests --report-full --report-checkstyle=./.cache/phpcs-tests-report.xml - name: Show test suite scan results in PR + if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }} run: cs2pr ./.cache/phpcs-tests-report.xml - name: Ensure version-controlled files are not modified during the tests diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml index 3b6802aac7..f60dc901af 100644 --- a/.github/workflows/php-compatibility.yml +++ b/.github/workflows/php-compatibility.yml @@ -97,10 +97,11 @@ jobs: run: phpcs -i - name: Run PHP compatibility tests - continue-on-error: true + id: phpcs run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml - name: Show PHPCompatibility results in PR + if: ${{ always() && steps.phpcs.outcome == 'failure' }} run: cs2pr ./.cache/phpcs-compat-report.xml - name: Ensure version-controlled files are not modified or deleted