From 62ed02ef11f6f1f39ec729278947a4fade59a3d4 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 20 Jun 2020 18:17:43 +0200 Subject: [PATCH] PHPCS: enable caching between runs (Premium) Since PHPCS 3.0.0, PHPCS has a caching feature available. In this PR, this caching feature is now turned on for this repo. This means in effect that the very first run of PHPCS with this feature will be marginally slower (on any individual machine). Most runs _after_ that though, will be significantly faster as PHPCS will only scan the files which have changed since the previous run. The cache will automatically be invalidated and rebuild whenever relevant, like when the version of one of the PHPCS dependencies has changed or when PHPCS itself has been changed. To (temporarily) turn caching off, run PHPCS like so: ```bash composer check-cs -- --no-cache ``` The cache file is set to be saved to a `.cache` directory to allow Travis to benefit from this feature as well. As this directory _has_ to exist for the cache file to be written to it, it is created and committed to the repo with a `.gitkeep` file Note: this is a sister-PR to the PR in the Premium repo which adds the caching configuration to the PHPCS ruleset. This PR **has** to be merged first!! Commit details: `/.cache/` directory: * Create the directory and place a `.gitkeep` file in it to allow it to be committed. `.gitignore`: * Prevent committing of cache files (already in place), but allow committing of the `.cache` directory. `.gitattributes`: * Do not include the `.cache` directory in distributable archives. Travis: * Use the Travis caching feature to cache the new `.cache` directory (including the cache file) between runs to allow Travis to benefit from the PHPCS caching as well. --- .cache/.gitkeep | 1 + .gitattributes | 1 + .gitignore | 1 + .travis.yml | 1 + 4 files changed, 4 insertions(+) create mode 100644 .cache/.gitkeep diff --git a/.cache/.gitkeep b/.cache/.gitkeep new file mode 100644 index 00000000000..dc3fefec266 --- /dev/null +++ b/.cache/.gitkeep @@ -0,0 +1 @@ +# This directory has to exist to allow cache files to be written to it. \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index e4047be148d..8ffbfee1f3a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ # Set default behaviour, in case users don't have core.autocrlf set. * text=auto +.cache export-ignore .github export-ignore deploy_keys export-ignore grunt export-ignore diff --git a/.gitignore b/.gitignore index 3e56c8c964f..a72985660a7 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ tmp/ *.bak *.log *.[Cc]ache +!.cache *.cpr *.orig *.php.in diff --git a/.travis.yml b/.travis.yml index 98fdc6cbcd3..5c5a78fa99e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -109,6 +109,7 @@ cache: yarn: true directories: - $HOME/.composer/cache + - .cache - node_modules before_install: