From 1e65a9a78b3e01269f4acb59a2aa0c1df3223583 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Thu, 1 Dec 2022 20:11:48 +0000 Subject: [PATCH] Build/Test Tools: Improve caching for PHPCS. This improves the speed of the PHPCS scans between workflow runs in GitHub Action by creating a scan cache file for each unique set of arguments passed to `phpcs`. Props jrf. Fixes #57148. See #53841. git-svn-id: https://develop.svn.wordpress.org/trunk@54921 602fd350-edb4-49c9-b593-d223f7449a82 --- .github/workflows/coding-standards.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 067442009d..9256a6e90d 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -82,7 +82,9 @@ jobs: - name: Cache PHPCS scan cache uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11 with: - path: .cache/phpcs.json + path: | + .cache/phpcs-src.json + .cache/phpcs-tests.json key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} # Since Composer dependencies are installed using `composer update` and no lock file is in version control, @@ -97,7 +99,7 @@ jobs: - name: Run PHPCS on all Core files id: phpcs-core - run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml + run: phpcs -n --report-full --cache=./.cache/phpcs-src.json --report-checkstyle=./.cache/phpcs-report.xml - name: Show PHPCS results in PR if: ${{ always() && steps.phpcs-core.outcome == 'failure' }} @@ -105,7 +107,7 @@ jobs: - name: Check test suite files for warnings id: phpcs-tests - run: phpcs tests --report-full --report-checkstyle=./.cache/phpcs-tests-report.xml + run: phpcs tests --report-full --cache=./.cache/phpcs-tests.json --report-checkstyle=./.cache/phpcs-tests-report.xml - name: Show test suite scan results in PR if: ${{ always() && steps.phpcs-tests.outcome == 'failure' }}