Skip to content

Commit

Permalink
[CMSP-676] WP Redis PHP 8.3 compatibility checks (#446)
Browse files Browse the repository at this point in the history
* add wpunit-helpers

* bump php version for linting to 8.3 and add php execution check

* add php8 compat checker

* add test first pass
still need to enable redis

* bump composer.lock

* add and use redis tests

* update the phpcs:ignore line

* maybe start redis?

* setup and test redis

* test with redis disabled

* check if the database exists before running redis-enabled tests

* fine..

* remove phpunit tests from circle

* add some linebreaks between the phpunit runs

* add -e to echoes

* add emoji for the tests
so they're easier to see and because I'm a dork

* remove scripts sourced from wpunit-helpers from source control

* add a matrix for redis enabled true/false

* use a single script
and export the WP_REDIS_USE_CACHE_GROUPS var for redis tests

* we don't need the redis test now

* we don't need the line breaks anymore
  • Loading branch information
jazzsequence authored Oct 13, 2023
1 parent d8eb080 commit 9b4bb9c
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 392 deletions.
136 changes: 0 additions & 136 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ workflows:
main:
jobs:
- test-behat
- test-phpunit-redis-disabled-74
- test-phpunit-redis-enabled-74
- test-phpunit-redis-disabled-82
- test-phpunit-redis-enabled-82
nightly:
triggers:
- schedule:
Expand All @@ -18,44 +14,6 @@ workflows:
jobs:
- test-behat

commands:
install-extras:
steps:
- run:
name: "Install Extra Dependencies"
command: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B
sudo apt-get update
sudo apt-get install subversion
sudo apt-get install -y libmagickwand-dev --no-install-recommends
yes '' | sudo pecl install imagick || true
sudo docker-php-ext-enable imagick
sudo docker-php-ext-install mysqli
install-mariadb-10-5:
steps:
- run: sudo apt-get install mariadb-client-10.5
install-mariadb-10-6:
steps:
- run: sudo apt-get install mariadb-client-10.6
install-redis-extras:
steps:
- run:
name: "Install Redis Extras"
command: |
yes '' | sudo pecl install redis || true
sudo docker-php-ext-enable redis
run-phpunit-tests:
steps:
- 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
WP_REDIS_USE_CACHE_GROUPS=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
jobs:
test-behat:
resource_class: small
Expand Down Expand Up @@ -104,97 +62,3 @@ jobs:
- run:
command: ./bin/behat-cleanup.sh
when: always
test-phpunit-redis-disabled-74:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: circleci/php:7.4-node-browsers
- image: cimg/mariadb:10.3
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
steps:
- checkout
- restore_cache:
keys:
- test-phpunit-74-dependencies-{{ checksum "composer.json" }}
- run: composer update
- run: composer install -n --prefer-dist
- save_cache:
key: test-phpunit-74-dependencies-{{ checksum "composer.json" }}
paths:
- vendor
- install-extras
- install-mariadb-10-5
- run-phpunit-tests
test-phpunit-redis-enabled-74:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: circleci/php:7.4-node-browsers
- image: cimg/mariadb:10.3
- image: cimg/redis:6.2
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
steps:
- checkout
- restore_cache:
keys:
- test-phpunit-74-dependencies-{{ checksum "composer.json" }}
- run: composer update
- run: composer install -n --prefer-dist
- save_cache:
key: test-phpunit-74-dependencies-{{ checksum "composer.json" }}
paths:
- vendor
- install-extras
- install-mariadb-10-5
- install-redis-extras
- run-phpunit-tests
test-phpunit-redis-disabled-82:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: cimg/php:8.2.0
- image: cimg/mariadb:10.3
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
steps:
- checkout
- restore_cache:
keys:
- test-phpunit-82-dependencies-{{ checksum "composer.json" }}
- run: composer install -n --prefer-dist
- save_cache:
key: test-phpunit-82-dependencies-{{ checksum "composer.json" }}
paths:
- vendor
- install-extras
- install-mariadb-10-6
- run-phpunit-tests
test-phpunit-redis-enabled-82:
resource_class: small
working_directory: ~/pantheon-systems/wp-redis
docker:
- image: cimg/php:8.2.0
- image: cimg/mariadb:10.3
- image: cimg/redis:6.2
environment:
- WP_TESTS_DIR: "/tmp/wordpress-tests-lib"
- WP_CORE_DIR: "/tmp/wordpress/"
steps:
- checkout
- restore_cache:
keys:
- test-phpunit-82-dependencies-{{ checksum "composer.json" }}
- run: composer install -n --prefer-dist
- save_cache:
key: test-phpunit-82-dependencies-{{ checksum "composer.json" }}
paths:
- vendor
- install-extras
- install-mariadb-10-6
- install-redis-extras
- run-phpunit-tests
61 changes: 60 additions & 1 deletion .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: 8.3
- name: Install dependencies
run: composer install -n --prefer-dist
- name: Run PHP Lint
Expand All @@ -39,3 +39,62 @@ jobs:
uses: pantheon-systems/[email protected]
with:
type: plugin
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
test-versions: 8.0-
test:
needs: lint
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
php_version: [7.4, 8.2, 8.3]
redis_enabled: [true, false]
services:
mariadb:
image: mariadb:${{ (matrix.php_version == '7.4') && '10.5' || '10.6' }}
redis:
image: redis:6.2
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: mysqli, zip, imagick, redis
- name: Start MySQL Service
run: sudo systemctl start mysql
- name: Test Redis
run: |
sudo apt-get install -y redis-tools
redis-cli -h localhost ping
- 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: |
if [ ${{ matrix.redis_enabled }} = 'true' ]; then
export WP_REDIS_USE_CACHE_GROUPS=1
echo -e "🔋 Testing with Redis enabled"
else
echo -e "🪫 Testing with Redis disabled"
fi
bash ./bin/phpunit-test.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ vendor/
phpredis
pantheon-wordpress-upstream-master
tests/pantheon-wordpress-upstream
bin/install-local-tests.sh
bin/install-wp-tests.sh
bin/phpunit-test.sh
151 changes: 0 additions & 151 deletions bin/install-wp-tests.sh

This file was deleted.

Loading

0 comments on commit 9b4bb9c

Please sign in to comment.