mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build/Test Tools: Cache the results of
PHP_CodeSniffer
across workf…
…low runs. When the `PHP_CodeSniffer` runs, it produces a cache file. When a cache file is present, only changed files are rescanned, making subsequent scans significantly faster. This adds the needed steps to the corresponding GitHub Actions workflows to cache these files across runs. The cache keys include the date of the previous Monday to ensure that the cache is flushed at least weekly. Since GitHub Action caches cannot be updated once created, the scans will take slightly longer as the week progresses and more PHP files are updated. The date within the cache key can be updated to purge twice weekly if the scan time starts to approach the current scan times. This change also introduces a `.cache` directory for all caching files related to build/test tools. Props johnbillion, jrf. Fixes #49783. git-svn-id: https://develop.svn.wordpress.org/trunk@52179 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information
Showing
6 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ on: | |
- '**.php' | ||
# These files configure Composer. Changes could affect the outcome. | ||
- 'composer.*' | ||
# This file configures PHP Compatibility scanning. Changes could affect the outcome. | ||
# This file configures PHP compatibility scanning. Changes could affect the outcome. | ||
- 'phpcompat.xml.dist' | ||
# Changes to workflow files should always verify all workflows are successful. | ||
- '.github/workflows/*.yml' | ||
|
@@ -42,7 +42,8 @@ jobs: | |
# Performs the following steps: | ||
# - Checks out the repository. | ||
# - Sets up PHP. | ||
# - Logs debug information about the runner container. | ||
# - Logs debug information. | ||
# - Configures caching for PHP compatibility scans. | ||
# - Installs Composer dependencies (use cache if possible). | ||
# - Make Composer packages available globally. | ||
# - Logs PHP_CodeSniffer debug information. | ||
|
@@ -69,6 +70,18 @@ jobs: | |
php --version | ||
composer --version | ||
This comment was marked as a violation of GitHub Acceptable Use Policies
|
||
# This date is used to ensure that the PHP compatibility cache is cleared at least once every week. | ||
# http://man7.org/linux/man-pages/man1/date.1.html | ||
- name: "Get last Monday's date" | ||
id: get-date | ||
run: echo "::set-output name=date::$(/bin/date -u --date='last Mon' "+%F")" | ||
|
||
- name: Cache PHP compatibility scan cache | ||
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 | ||
with: | ||
path: .cache/phpcompat.json | ||
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcompat-cache-${{ hashFiles('**/composer.json') }} | ||
|
||
- name: Install Composer dependencies | ||
uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hii Suraj Prajapati's
