Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SETUP] Set PHP 8.2 as default, add PHP 8.3 support #415

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.

# Which version of PHP would you like to use? The major and minor version needed only, e.g. 8.0 or 8.1.
# Which version of PHP would you like to use? The major and minor version needed only, e.g. 8.1, 8.2 or 8.3.
PHP_VERSION=${PHP_VERSION}

# A docker network is required to ensure the loopback works as expected among other things.
Expand Down
28 changes: 26 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@ updates:
prefix: "[DEPS]"
# Docker app image.
- package-ecosystem: docker
directory: "/docker/app/php8.0"
directory: "/docker/app/php8.3"
registries: "*"
schedule:
interval: daily
open-pull-requests-limit: 10
commit-message:
prefix: "[SETUP]"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
# Docker app image.
- package-ecosystem: docker
directory: "/docker/app/php8.2"
registries: "*"
schedule:
interval: daily
Expand Down Expand Up @@ -148,7 +160,19 @@ updates:
update-types: ["version-update:semver-major"]
# Docker styleguide image.
- package-ecosystem: docker
directory: "/docker/styleguide/php8.0"
directory: "/docker/styleguide/php8.3"
registries: "*"
schedule:
interval: daily
open-pull-requests-limit: 10
commit-message:
prefix: "[SETUP]"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
# Docker styleguide image.
- package-ecosystem: docker
directory: "/docker/styleguide/php8.2"
registries: "*"
schedule:
interval: daily
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

/wp-content/uploads
/wp-content/vendor
/wp-content/db.php
/wp-content/object-cache.php
/wp-content/advanced-cache.php
/wp-content/cache
Expand Down Expand Up @@ -53,6 +52,7 @@ debug.log
/tests/tmp/*
!/tests/tmp/.gitkeep
.phpunit.result.cache
.phpunit.cache/

!docker/database/init.sql
auth.json
Expand Down
27 changes: 22 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
language: php

os: linux
dist: focal

php:
- 8.0
- 8.1.0 # See https://travis-ci.community/t/php-8-1-support/12439/16

matrix:
# PHP 8.3 not currently supported by Travis.
# Available versions: https://docs.travis-ci.com/user/languages/php/#php-versions
- 8.2.9
- 8.1.9

# Running PHP 8.2 on Travis requires the 'libonig5' package to be included.
# See: https://chrisguitarguy.com/2023/01/23/using-php-8-2-on-travisci/
addons:
apt:
packages:
- libonig5

jobs:
allow_failures:
- php: 8.1.0
- php: 8.1.9
fast_finish: true

branches:
Expand All @@ -20,7 +30,13 @@ services:

cache:
directories:
- ".cache/phpstan"
- "/home/travis/.cache/phpcs"
- "/home/travis/.composer/cache"
- "node_modules"
- "wp-content/client-mu-plugins/vendor"
- "styleguide/vendor"
- "styleguide/node_modules"
- "tests/tmp"

before_install:
Expand All @@ -40,5 +56,6 @@ script:
- composer check-platform-reqs --no-dev
- ./tools/php_codesniffer/vendor/bin/phpcs . --severity=1
- ./bin/php-security-checker
- ./bin/phpstan --memory-limit=4G --configuration=phpstan.neon.dist
- export WP_MULTISITE=0; ./bin/phpunit --exclude-group=ms-required
- export WP_MULTISITE=1; ./bin/phpunit --exclude-group=ms-excluded
4 changes: 4 additions & 0 deletions bin/docker/phpstan
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

#!/usr/bin/env bash

docker-compose exec --user www-data app ./bin/phpstan "$@"
73 changes: 41 additions & 32 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,59 @@
# Exit when any command fails
set -e

# Usage: bin/install [project_name] [styleguide_dir] [docker_network_name] [php_version]
# Usage: bin/install --project=[project_name] --styleguide=[styleguide_dir] --network=[docker_network_name] --php=[php_version]
#
# Defaults: project_name = boxuk-wp-skeleton, styleguide_dir = empty, docker_network_name = boxuk-docker, php_version = 8.0
# Defaults: project_name = boxuk-wp-skeleton, styleguide_dir = empty, docker_network_name = boxuk-docker, php_version = 8.2
# All arguments are optional.

# Set defaults
export PROJECT_NAME="boxuk-wp-skeleton"
export STYLEGUIDE_DIR=""
export DOCKER_NETWORK_NAME="boxuk-docker"
export PHP_VERSION="8.2"

GREEN='\033[0;32m'
BG_GREEN='\033[42m'
BOLD='\033[1m'
NC='\033[0m' # No Color

# Thanks to: https://stackoverflow.com/a/14203146
for i in "$@"; do
case $i in
--project=*)
export PROJECT_NAME="${i#*=}"
shift # past argument=value
;;
--styleguide=*)
export STYLEGUIDE_DIR="${i#*=}"
shift # past argument=value
;;
--network=*)
export DOCKER_NETWORK_NAME="${i#*=}"
shift # past argument=value
;;
--php=*)
export PHP_VERSION="${i#*=}"
shift # past argument=value
;;
-*|--*)
echo "Unknown option $i"
exit 1
;;
*)
;;
esac
done

# Remove any existing styleguide nginx conf if it exists
rm -f docker/nginx/conf/styleguide.conf

echo 'Setting up .env vars...';

if [ $1 ]; then
echo -e "Using ${GREEN}${1}${NC} for PROJECT_NAME";
export PROJECT_NAME="${1}";
else
echo -e "Using ${GREEN}boxuk-wp-skeleton${NC} for PROJECT_NAME";
export PROJECT_NAME="boxuk-wp-skeleton";
fi

if [ $2 ]; then
echo -e "Using ${GREEN}${2}${NC} for STYLEGUIDE_DIR";
export STYLEGUIDE_DIR="${2}";
else
export STYLEGUIDE_DIR="";
fi

if [ $3 ]; then
echo -e "Using ${GREEN}${3}${NC} for DOCKER_NETWORK_NAME";
export DOCKER_NETWORK_NAME="${3}";
else
echo -e "Using ${GREEN}boxuk-docker${NC} for DOCKER_NETWORK_NAME";
export DOCKER_NETWORK_NAME="boxuk-docker";
fi

if [ $4 ]; then
echo -e "Using ${GREEN}${4}${NC} for PHP_VERSION";
export PHP_VERSION="${4}";
else
echo -e "Using ${GREEN}8.0${NC} for PHP_VERSION";
export PHP_VERSION="8.0";
fi
echo -e "Using ${GREEN}${PROJECT_NAME}${NC} for PROJECT_NAME";
echo -e "Using ${GREEN}${STYLEGUIDE_DIR}${NC} for STYLEGUIDE_DIR";
echo -e "Using ${GREEN}${DOCKER_NETWORK_NAME}${NC} for DOCKER_NETWORK_NAME";
echo -e "Using ${GREEN}${PHP_VERSION}${NC} for PHP_VERSION";

envsubst \$PROJECT_NAME,\$STYLEGUIDE_DIR,\$DOCKER_NETWORK_NAME,\$PHP_VERSION < .env.dist > .env
envsubst \$PROJECT_NAME,\$STYLEGUIDE_DIR < ./docker/app/.env.dist > ./docker/app/.env
Expand Down
6 changes: 3 additions & 3 deletions bin/vip-install
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e

# Usage: bin/vip-install [project_name] [styleguide_dir] [docker_network_name] [PHP_VERSION]
#
# Defaults: project_name = boxuk-wp-skeleton, styleguide_dir = empty, docker_network_name = boxuk-docker, php_version = 8.0
# Defaults: project_name = boxuk-wp-skeleton, styleguide_dir = empty, docker_network_name = boxuk-docker, php_version = 8.2

GREEN='\033[0;32m'
BG_GREEN='\033[42m'
Expand Down Expand Up @@ -61,8 +61,8 @@ if [ $4 ]; then
echo -e "Using ${GREEN}${4}${NC} for PHP_VERSION";
export PHP_VERSION="${4}";
else
echo -e "Using ${GREEN}8.0${NC} for PHP_VERSION";
export PHP_VERSION="8.0";
echo -e "Using ${GREEN}8.2${NC} for PHP_VERSION";
export PHP_VERSION="8.2";
fi

envsubst \$PROJECT_NAME,\$STYLEGUIDE_DIR,\$DOCKER_NETWORK_NAME,\$PHP_VERSION < .env.dist > .env
Expand Down
25 changes: 13 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,28 @@
"boxuk/wp-hook-attributes": "^0.0.2",
"boxuk/wp-muplugin-loader": "^2.0",
"cache/memcache-adapter": "^1.2",
"inpsyde/wonolog": "^1.0",
"inpsyde/wp-translation-downloader": "^2.0",
"inpsyde/wonolog": "^2.0",
"inpsyde/wp-translation-downloader": "^2.5",
"jamesrwilliams/flagpole": "@beta",
"oomphinc/composer-installers-extender": "^2",
"roots/wordpress-core-installer": "^1.100",
"roots/wordpress-full": "^6.0",
"symfony/config": "^5.0 || ^6.0",
"symfony/dependency-injection": "^5.0 || ^6.0",
"symfony/dotenv": "^5.0 || ^6.0",
"symfony/yaml": "^5.0 || ^6.0",
"roots/wordpress-full": "^6.4",
"symfony/config": "^6.0 || ^7.0",
"symfony/dependency-injection": "^6.0 || ^7.0",
"symfony/dotenv": "^6.0 || ^7.0",
"symfony/yaml": "^6.0 || ^7.0",
"wp-cli/scaffold-command": "^2.0",
"wp-cli/wp-cli": "^2.5",
"wpackagist-plugin/advanced-caching": "@dev",
"wp-cli/wp-cli": "^2.9",
"wpackagist-plugin/memcached": "^4.0",
"wpackagist-plugin/query-monitor": "^3.5",
"wpackagist-plugin/surge": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7 || ^8 || ^9",
"wp-phpunit/wp-phpunit": "^6.0",
"yoast/phpunit-polyfills": "^1.0"
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9",
"szepeviktor/phpstan-wordpress": "^1.3",
"wp-phpunit/wp-phpunit": "^6.4",
"yoast/phpunit-polyfills": "^2"
},
"suggest": {
"wp-cli/i18n-command": "Needed for the i18n-twig WP CLI command.",
Expand Down
Loading