Skip to content

Commit

Permalink
Skip WP Handling of 404s for static files (#111)
Browse files Browse the repository at this point in the history
* Allow skipping of WP 404 handling for static files. Update code to fix issue where updating cache level setting didn't always work properly.

* Update dependencies

* Use an updated version of Node

* Whitelist the `dealerdirect/phpcodesniffer-composer-installer` Composer plugin

* Fix tests / linting

* Bump version and update documentation
  • Loading branch information
wpscholar authored Jan 11, 2022
1 parent ed6f584 commit 44dc2aa
Show file tree
Hide file tree
Showing 9 changed files with 1,026 additions and 822 deletions.
104 changes: 66 additions & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: PR Actions
on:
pull_request:
push:
branches: [master]
branches: [ master ]

jobs:
test:
Expand All @@ -12,40 +12,68 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Install dependencies
run: npm install

- name: Install WordPress
run: |
chmod -R 767 ./
npm run wp-env start
- name: Run the tests
run: npm run test
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer, cs2pr

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer vendor directory
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x

- name: Log debug information
run: |
php --version
composer --version
node --version
npm --version
- name: Validate composer.json and composer.lock files
run: composer validate

- name: Install PHP Dependencies
run: composer install --no-progress --optimize-autoloader

- name: Run linting
run: composer run lint

- name: Install dependencies
run: npm install

- name: Install WordPress
run: |
chmod -R 767 ./
npm run wp-env start
- name: Run the tests
run: npm run test
15 changes: 10 additions & 5 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"mappings": {
"wp-content/mu-plugins": "."
},
"port": 8870,
"testsPort": 8871
"config": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": true
},
"plugins": [
"."
],
"port": 8870,
"testsPort": 8871
}
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@

Endurance Page Cache adds basic file-based caching to WordPress, as well as more advanced caching solutions in nginx and Cloudflare. EPC is designed to run best on Endurance systems and your mileage may vary.

## Installation

- Run `git clone git@github.com:bluehost/endurance-page-cache.git` to pull down the code.
- Run `composer install` to install PHP dev dependencies.
- Run `npm install` to install JS dev dependencies.

## Running linting

- Run `composer run lint`

## Running tests

- Run `npm run wp-env start` to boot the WordPress environment
- Run `npm run test` to run the tests

## Tagging a new release

- Bump the version number in the header of the `endurance-page-cache.php` file (also the `EPC_VERSION`) and in `package.json`.
- Bump the version number in the header of the `endurance-page-cache.php` file (also the `EPC_VERSION` constant).
- Push all changes to `master`.
- Merge all changes to `production`.
- Create a release on GitHub for the new version.
Expand Down
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"config": {
"platform": {
"php": "7.4.18"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"require-dev": {
Expand All @@ -44,5 +47,8 @@
"fix": [
"vendor/bin/phpcbf endurance-page-cache.php --standard=Bluehost"
]
},
"require": {
"yoast/phpunit-polyfills": "^1.0"
}
}
Loading

0 comments on commit 44dc2aa

Please sign in to comment.