Skip to content

Commit

Permalink
Merge pull request #253 from pantheon-systems/release_1.4.2
Browse files Browse the repository at this point in the history
Release 1.4.2
  • Loading branch information
jazzsequence authored Oct 16, 2023
2 parents 550d56b + e7bdda8 commit 3d40fb9
Show file tree
Hide file tree
Showing 19 changed files with 707 additions and 364 deletions.
86 changes: 3 additions & 83 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,7 @@ workflows:
version: 2
main:
jobs:
- lint
- test-behat:
requires:
- lint
- test-phpunit:
name: "Test with PHP 7.4"
requires:
- lint
php_version: "7.4"
- test-phpunit:
name: "Test with PHP 8.0"
requires:
- lint
php_version: "8.0"
- test-phpunit:
name: "Test with PHP 8.1"
requires:
- lint
php_version: "8.1"
- test-phpunit:
name: "Test with PHP 8.2"
requires:
- lint
php_version: "8.2"
- test-behat
nightly:
triggers:
- schedule:
Expand All @@ -38,25 +15,8 @@ workflows:
jobs:
- test-behat
jobs:
lint:
working_directory: ~/pantheon-systems/pantheon-advanced-page-cache
docker:
- image: quay.io/pantheon-public/build-tools-ci:8.x-php8.0
steps:
- checkout
- restore_cache:
keys:
- test-lint-dependencies-{{ checksum "composer.json" }}
- run: composer install -n --prefer-dist
- save_cache:
key: test-lint-dependencies-{{ checksum "composer.json" }}
paths:
- vendor
- run:
name: "Run PHP Lint"
command: |
composer phpcs
test-behat:
resource_class: small
working_directory: ~/pantheon-systems/pantheon-advanced-page-cache
parallelism: 1
docker:
Expand Down Expand Up @@ -96,49 +56,9 @@ jobs:
exit 0
fi
terminus auth:login --machine-token=$TERMINUS_TOKEN
- run: ./bin/validate-fixture-version.sh
- run: ./bin/behat-prepare.sh
- run: ./bin/behat-test.sh --strict
- run:
command: ./bin/behat-cleanup.sh
when: always
test-phpunit:
parameters:
php_version:
type: enum
enum:
- "7.4"
- "8.2"
- "8.1"
- "8.0"
working_directory: ~/pantheon-systems/pantheon-advanced-page-cache
docker:
- image: cimg/php:<< parameters.php_version >>
- image: circleci/mariadb:10.4
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
steps:
- checkout
- restore_cache:
keys:
- test-phpunit-dependencies-{{ checksum "composer.json" }}
- run: composer install -n --prefer-dist --ignore-platform-reqs
- save_cache:
key: test-phpunit-dependencies-{{ checksum "composer.json" }}
paths:
- vendor
- run:
name: "Install Extras"
command: |
sudo apt-get update
sudo apt-get install subversion
sudo apt-get install mariadb-client
- run:
name: "Run Tests"
command: |
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 latest
composer phpunit
WP_MULTISITE=1 composer phpunit
rm -rf $WP_TESTS_DIR $WP_CORE_DIR
bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1 nightly true
composer phpunit
89 changes: 89 additions & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Lint and Test

on:
schedule:
- cron: '0 0 * * *'
pull_request:
branches:
- '**'

jobs:
validate-readme-spacing:
name: Validate README Spacing
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pantheon-systems/validate-readme-spacing@v1
lint:
name: PHPCS Linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor
key: test-lint-dependencies-{{ checksum "composer.json" }}
restore-keys: test-lint-dependencies-{{ checksum "composer.json" }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: Install dependencies
run: composer install -n --prefer-dist
- name: Run PHPCS
run: composer lint
php8-compatibility:
name: PHP 8.x Compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pantheon-systems/phpcompatibility-action@dev
with:
paths: ${{ github.workspace }}/*.php ${{ github.workspace }}/inc/*.php
test-versions: 8.0-
wporg-validation:
name: WP.org Plugin Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pantheon-systems/action-wporg-validator@1.0.0
with:
type: 'plugin'
test:
needs: lint
name: Test
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.5
strategy:
matrix:
php_version: [7.4, 8.3]
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: mysqli, zip, imagick
- name: Start MySQL Service
run: sudo systemctl start mysql
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor
key: test-dependencies-{{ checksum "composer.json" }}
restore-keys: test-dependencies-{{ checksum "composer.json" }}
- name: Install dependencies
run: |
if [ ${{ matrix.php_version }} = "7.4" ]; then
composer update
fi
composer install
- name: Run PHPUnit
run: bash ./bin/phpunit-test.sh
12 changes: 0 additions & 12 deletions .github/workflows/lint.yml

This file was deleted.

9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Tags:** pantheon, cdn, cache
**Requires at least:** 4.7
**Tested up to:** 6.3
**Stable tag:** 1.4.1
**Stable tag:** 1.4.2
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -320,11 +320,14 @@ Pantheon Advanced Page Cache integrates with WordPress plugins, including:
See [CONTRIBUTING.md](https://github.com/pantheon-systems/pantheon-advanced-page-cache/blob/master/CONTRIBUTING.md) for information on contributing.

## Changelog ##
### 1.4.2 (October 16, 2023) ###
* Updates Pantheon WP Coding Standards to 2.0 [[#249](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/249)]
* Fixes an issue where a PHP warning was thrown when surrogate keys were emitted from archive pages with multiple post types. [[#252](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/252)]

### 1.4.1 ###
### 1.4.1 (August 8, 2023) ###
* Send the REST API response header to the result and not the REST server [[#237](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/237)]. Props [@srtfisher](https://github.com/srtfisher) & [@felixarntz](https://github.com/felixarntz).

### 1.4.0 ###
### 1.4.0 (August 1, 2023) ###
* Bumped Dependencies [[236](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/236)]
* Add filter `pantheon_should_add_terms` to allow disabling surrogate keys for posts' taxonomy terms [[239](https://github.com/pantheon-systems/pantheon-advanced-page-cache/pull/239)]

Expand Down
10 changes: 2 additions & 8 deletions bin/behat-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ cd $BASH_DIR/..
rsync -av --exclude='node_modules/' --exclude='vendor/' --exclude='tests/' ./* $PREPARE_DIR/wp-content/plugins/pantheon-advanced-page-cache
rm -rf $PREPARE_DIR/wp-content/plugins/pantheon-advanced-page-cache/.git

# Download the latest Classic Editor release from WordPress.org
wget -O $PREPARE_DIR/classic-editor.zip https://downloads.wordpress.org/plugin/classic-editor.zip
unzip $PREPARE_DIR/classic-editor.zip -d $PREPARE_DIR
mv $PREPARE_DIR/classic-editor $PREPARE_DIR/wp-content/plugins/
rm $PREPARE_DIR/classic-editor.zip

###
# Push files to the environment
###
Expand All @@ -80,6 +74,6 @@ terminus build:workflow:wait $TERMINUS_SITE.$TERMINUS_ENV
terminus wp $SITE_ENV -- core install --title=$TERMINUS_ENV-$TERMINUS_SITE --url=$PANTHEON_SITE_URL --admin_user=$WORDPRESS_ADMIN_USERNAME --admin_email=pantheon-advanced-page-cache@getpantheon.com --admin_password=$WORDPRESS_ADMIN_PASSWORD
} &> /dev/null
terminus wp $SITE_ENV -- cache flush
terminus wp $SITE_ENV -- plugin activate pantheon-advanced-page-cache classic-editor
terminus wp $SITE_ENV -- theme activate twentyseventeen
terminus wp $SITE_ENV -- plugin activate pantheon-advanced-page-cache
terminus wp $SITE_ENV -- theme activate twentytwentythree
terminus wp $SITE_ENV -- rewrite structure '/%year%/%monthnum%/%day%/%postname%/'
61 changes: 61 additions & 0 deletions bin/install-local-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
set -e

# Initialize variables with default values
TMPDIR="/tmp"
DB_NAME="wordpress_test"
DB_USER="root"
DB_PASS=""
DB_HOST="127.0.0.1"
WP_VERSION="latest"
SKIP_DB=""

# Display usage information
usage() {
echo "Usage:"
echo "./install-local-tests.sh [--dbname=wordpress_test] [--dbuser=root] [--dbpass=''] [--dbhost=127.0.0.1] [--wpversion=latest] [--no-db]"
}

# Parse command-line arguments
for i in "$@"
do
case $i in
--dbname=*)
DB_NAME="${i#*=}"
shift
;;
--dbuser=*)
DB_USER="${i#*=}"
shift
;;
--dbpass=*)
DB_PASS="${i#*=}"
shift
;;
--dbhost=*)
DB_HOST="${i#*=}"
shift
;;
--wpversion=*)
WP_VERSION="${i#*=}"
shift
;;
--no-db)
SKIP_DB="true"
shift
;;
*)
# unknown option
usage
exit 1
;;
esac
done

# Run install-wp-tests.sh
echo "Installing local tests into ${TMPDIR}"
bash "$(dirname "$0")/install-wp-tests.sh" "$DB_NAME" "$DB_USER" "$DB_PASS" "$DB_HOST" "$WP_VERSION" "$SKIP_DB"

# Run PHPUnit
echo "Running PHPUnit"
composer phpunit
18 changes: 18 additions & 0 deletions bin/phpunit-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e

DIRNAME=$(dirname "$0")

bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 latest
echo "Running PHPUnit on Single Site"
composer phpunit
rm -rf $WP_TESTS_DIR $WP_CORE_DIR

bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 nightly true
echo "Running PHPUnit on Single Site (Nightly WordPress)"
composer phpunit

bash "${DIRNAME}/install-wp-tests.sh" wordpress_test root root 127.0.0.1 latest true
echo "Running PHPUnit on Multisite"
WP_MULTISITE=1 composer phpunit
43 changes: 43 additions & 0 deletions bin/validate-fixture-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'

main(){
export TERMINUS_HIDE_GIT_MODE_WARNING=1
local DIRNAME=$(dirname "$0")

if [ -z "${TERMINUS_SITE}" ]; then
echo "TERMINUS_SITE environment variable must be set"
exit 1
fi

if ! terminus whoami > /dev/null; then
if [ -z "${TERMINUS_TOKEN}" ]; then
echo "TERMINUS_TOKEN environment variable must be set or terminus already logged in."
exit 1
fi
terminus auth:login --machine-token="${TERMINUS_TOKEN}"
fi

# Use find to locate the file with a case-insensitive search
README_FILE_PATH=$(find ${DIRNAME}/.. -iname "readme.txt" -print -quit)
if [[ -z "$README_FILE_PATH" ]]; then
echo "readme.txt not found."
exit 1
fi

local TESTED_UP_TO
TESTED_UP_TO=$(grep -i "Tested up to:" "${README_FILE_PATH}" | tr -d '\r\n' | awk -F ': ' '{ print $2 }')
echo "Tested Up To: ${TESTED_UP_TO}"
local FIXTURE_VERSION
FIXTURE_VERSION=$(terminus wp "${TERMINUS_SITE}.dev" -- core version)
echo "Fixture Version: ${FIXTURE_VERSION}"

if ! php -r "exit(version_compare('${TESTED_UP_TO}', '${FIXTURE_VERSION}'));"; then
echo "${FIXTURE_VERSION} is less than ${TESTED_UP_TO}"
echo "Please update ${TERMINUS_SITE} to at least WordPress ${TESTED_UP_TO}"
exit 1
fi
}

main
Loading

0 comments on commit 3d40fb9

Please sign in to comment.