Skip to content

Commit

Permalink
[FEATURE] Add support for newer versions of PHP.
Browse files Browse the repository at this point in the history
Allow the building against different versions of PHP, including:

* 7.4
* 8.0
* 8.1

As the project could be built against any of these versions it no longer
makes sense to ship a `composer.lock` file and thus this has been
removed.
  • Loading branch information
Ian Jenkins committed Mar 1, 2022
1 parent f3ba20b commit e7cc91f
Show file tree
Hide file tree
Showing 33 changed files with 348 additions and 5,140 deletions.
3 changes: 3 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#
# 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. 7.4, 8.0 or 8.1.
PHP_VERSION=${PHP_VERSION}

# A docker network is required to ensure the loopback works as expected among other things.
DOCKER_NETWORK_NAME=${DOCKER_NETWORK_NAME}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
paths:
- "docker/**/Dockerfile"
- "docker/app/Dockerfile_xdebug"
- "docker/app/**/Dockerfile_xdebug"
push:
branches:
- main
Expand All @@ -23,4 +23,4 @@ jobs:
- name: "Lint Dockerfile(s)"
uses: jbergstroem/hadolint-gh-action@v1
with:
dockerfile: "./docker/**/Dockerfile ./docker/app/Dockerfile_xdebug"
dockerfile: "./docker/**/Dockerfile ./docker/app/**/Dockerfile_xdebug"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/vendor/
/tools/*/vendor
composer.lock

/wp
/wp-content/plugins/*
Expand Down Expand Up @@ -51,6 +52,7 @@ debug.log
/tests/.env
/tests/tmp/*
!/tests/tmp/.gitkeep
.phpunit.result.cache

!docker/database/init.sql
auth.json
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
language: php

php:
- 7.4

branches:
only:
- main

services:
- mysql

cache:
directories:
- "/home/travis/.composer/cache"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Admin:
* Getting Started
* [Quickstart](docs/dev/quickstart.md)
* [Docker Setup](docs/dev/docker-setup.md)
* [PHP Versions](docs/dev/php-versions.md)
* [Non Docker Setup](docs/dev/non-docker-setup.md)
* [Fixtures](docs/dev/fixtures.md)
* [Usage](docs/dev/usage.md)
Expand Down
17 changes: 14 additions & 3 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Exit when any command fails
set -e

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

GREEN='\033[0;32m'
BG_GREEN='\033[42m'
Expand Down Expand Up @@ -40,7 +40,15 @@ else
export DOCKER_NETWORK_NAME="boxuk-docker";
fi

envsubst \$PROJECT_NAME,\$STYLEGUIDE_DIR,\$DOCKER_NETWORK_NAME < .env.dist > .env
if [ $4 ]; then
echo -e "Using ${GREEN}${4}${NC} for PHP_VERSION";
export PHP_VERSION="${4}";
else
echo -e "Using ${GREEN}7.4${NC} for PHP_VERSION";
export PHP_VERSION="7.4";
fi

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

if [ ! -f ./docker/database/.env ]; then
Expand Down Expand Up @@ -110,6 +118,9 @@ echo 'Setting up fixtures...'
bin/docker/wp package install git@github.com:nlemoine/wp-cli-fixtures.git;
bin/docker/wp fixtures load;

echo 'Flushing cache...'
bin/docker/wp cache flush;

STYLEGUIDE_HOSTS_ENTRY=
if [ ! -z "${STYLEGUIDE_DIR}" ]; then
STYLEGUIDE_HOSTS_ENTRY="${PROJECT_NAME}.styleguide.local"
Expand Down
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"sort-packages": true,
"preferred-install": "dist",
"platform": {
"php": "7.4",
"ext-mbstring": "1",
"ext-intl": "1"
},
Expand All @@ -44,18 +43,18 @@
},
"require": {
"boxuk/dictator": "^0.8",
"boxuk/wp-hook-attributes": "@dev",
"boxuk/wp-hook-attributes": "^0.0.1",
"boxuk/wp-muplugin-loader": "^1.2",
"cache/memcache-adapter": "^1.2",
"inpsyde/wonolog": "^1.0",
"inpsyde/wp-translation-downloader": "^2.0",
"jamesrwilliams/flagpole": "@beta",
"oomphinc/composer-installers-extender": "^2",
"roots/wordpress": "^5",
"symfony/config": "^5.0",
"symfony/dependency-injection": "^5.0",
"symfony/dotenv": "^5.0",
"symfony/yaml": "^5.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",
"wp-cli/scaffold-command": "^2.0",
"wp-cli/wp-cli": "^2.5",
"wpackagist-plugin/advanced-caching": "@dev",
Expand All @@ -64,7 +63,7 @@
"wpackagist-plugin/surge": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7",
"phpunit/phpunit": "^7 || ^8 || ^9",
"wp-phpunit/wp-phpunit": "^5.4",
"yoast/phpunit-polyfills": "^1.0"
},
Expand Down
Loading

0 comments on commit e7cc91f

Please sign in to comment.