Skip to content

Commit

Permalink
#125: Make PHP 8.4 available.
Browse files Browse the repository at this point in the history
  • Loading branch information
reynoldsalec committed Sep 24, 2024
1 parent c4aab86 commit 45d8c20
Show file tree
Hide file tree
Showing 15 changed files with 593 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/build-php-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
fail-fast: false
matrix:
include:
- image: php
tag: 8.4-fpm-4
context: images/8.4-fpm
- image: php
tag: 8.4-apache-4
context: images/8.4-apache
- image: php
tag: 8.3-fpm-4
context: images/8.3-fpm
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-php8-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
lando-version:
- 3-edge-slim
os:
Expand Down
2 changes: 1 addition & 1 deletion builders/php.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module.exports = {
name: 'php',
config: {
version: '7.4',
supported: ['8.3', '8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4', '5.3'],
supported: ['8.4', '8.3', '8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4', '5.3'],
legacy: ['7.2', '7.1', '7.0', '5.6', '5.5', '5.4', '5.3'],
gen2: ['5.5', '5.4', '5.3'],
gen3: ['7.2', '7.1', '7.0', '5.6'],
Expand Down
3 changes: 3 additions & 0 deletions examples/8.4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor
composer.json
test
58 changes: 58 additions & 0 deletions examples/8.4/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: lando-php83
events:
post-start:
- defaults: php -i | grep memory_limit | grep -e "-1"
services:
defaults:
type: php:8.4
composer_version: false
cli:
type: php:8.4
composer_version: false
via: cli
build_as_root:
- curl -sL https://deb.nodesource.com/setup_14.x | bash -
- apt-get update -y
- apt-get install -y nodejs
cliworker:
type: php:8.4
composer_version: false
via: cli
command: sleep infinity
custom:
type: php:8.4
composer_version: "2.5.6"
via: nginx
ssl: true
webroot: web
xdebug: true
config:
php: config/php.ini
overrides:
image: devwithlando/php:8.4-fpm-4
environment:
DUALBLADE: maxim
OTHER: thing
custom_nginx:
build_as_root:
- mkdir -p /app/test && touch /app/test/managed_build_step
overrides:
environment:
MORE: things
OTHER: stuff
tooling:
php:
service: defaults
node:
service: :host
options:
host:
description: The service to use
default: cli
alias:
- h

# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
plugins:
"@lando/php": ../..
127 changes: 127 additions & 0 deletions examples/8.4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# PHP 8.4 Example

This example exists primarily to test the following documentation:

* [PHP Service](https://docs.lando.dev/config/php.html)
* [Installing Node in a PHP Service](https://docs.lando.dev/guides/installing-node-in-your-lando-php-service.html)
* [Issue #1990](https://github.com/lando/lando/issues/1990)
* [Issue #2192](https://github.com/lando/lando/issues/2192)

And probably other stuff

## Start up tests

Run the following commands to get up and running with this example.

```bash
# Should start up successfully
lando poweroff
lando start
```

## Verification commands

Run the following commands to validate things are rolling as they should.

```bash
# Should use 8.4 as the default php version
lando exec defaults -- php -v | grep "PHP 8.4"

# Should use 10.x as the default postgresql-client version
lando exec defaults -- psql -V | grep "10."

# Should use apache 2.4 as the default webserver version
lando exec defaults -- apachectl -V | grep "2.4."

# Should only serve over http by default
lando exec defaults -- curl https://localhost || echo $? | grep 1

# Should serve from the app root by default
lando exec defaults -- curl http://localhost | grep "ROOTDIR"

# Should have a 1G php mem limit on appserver
lando exec defaults -- curl http://localhost | grep "memory_limit" | grep "1G"

# Should have COMPOSER_MEMORY_LIMIT set to -1
lando exec defaults -- env | grep "COMPOSER_MEMORY_LIMIT=-1"

# Should install composer 2.x by default
lando exec defaults -- composer --version --no-ansi | grep "Composer version 2."

# Should have unlimited memory for php for CLI opts
lando php -i | grep memory_limit | grep -e "-1"
lando exec defaults -- php -i | grep "memory_limit" | grep -e "-1"

# Should not enable xdebug by default
lando exec defaults -- php -m | grep xdebug || echo $? | grep 1

# Should have a PATH_INFO and PATH_TRANSLATED SERVER vars
lando exec custom_nginx -- curl https://localhost | grep SERVER | grep PATH_INFO
lando exec custom_nginx -- curl https://localhost | grep SERVER | grep PATH_TRANSLATED

# Should use specified php version if given
lando exec custom -- php -v | grep "PHP 8.4"

# Should install composer 2.5.6 if version number is set
lando exec custom -- composer --version --no-ansi | grep "Composer version 2.5.6"

# Should serve via nginx if specified
lando exec custom_nginx -- curl http://localhost | grep "WEBDIR"

# Should serve via https if specified
lando exec custom_nginx -- curl https://localhost | grep "WEBDIR"

# Should enable xdebug if specified
lando exec custom -- php -m | grep "xdebug"

# Should not serve port 80 for cli
lando exec cli -- curl http://localhost || echo $? | grep 1

# Should install the composer 2.x using the false flag
lando exec cli -- composer --version --no-ansi | grep "Composer version 2."

# Should use custom php ini if specified
lando exec custom -- php -i | grep memory_limit | grep 514
lando exec custom -- curl http://custom_nginx | grep html_errors | grep On | grep On

# Should inherit overrides from its generator
lando exec custom -- env | grep DUALBLADE | grep maxim
lando exec custom_nginx -- env | grep DUALBLADE | grep maxim

# Should be able to run build steps on lando managed nginx service
# https://github.com/lando/lando/issues/1990
lando exec custom_nginx -- cat /app/test/managed_build_step

# Should be able to override lando managed nginx service
# https://github.com/lando/lando/issues/1990
lando exec custom_nginx -- env | grep OTHER | grep stuff
lando exec custom_nginx -- env | grep MORE | grep things

# Should set PATH_INFO and PATH_TRANSLATED if appropriate
# https://github.com/lando/lando/issues/2192
lando exec custom_nginx -- curl http://localhost/path_info.php/a/b.php | grep PATH_INFO | grep "/a/b.php"
lando exec custom_nginx -- curl http://localhost/path_info.php/a/b.php | grep PATH_TRANSLATED | grep "/app/web/a/b.php"
lando exec custom_nginx -- curl http://localhost/path_info.php/a/b.php | grep SCRIPT_NAME | grep "/path_info.php"
lando exec defaults -- curl http://localhost/path_info.php/a/b.php | grep PATH_INFO | grep "/a/b.php"
lando exec defaults -- curl http://localhost/path_info.php/a/b.php | grep PATH_TRANSLATED | grep "/app/a/b.php"
lando exec defaults -- curl http://localhost/path_info.php/a/b.php | grep SCRIPT_NAME | grep "/path_info.php"

# Should allow cli services to specify a boot up command
lando info -s cliworker --deep | grep Cmd | grep sleep | grep infinity

# Should install the latest composer 2.x by default.
lando exec cliworker -- composer --version --no-ansi | grep "Composer version 2."

# Should have node14 installed in cli service
lando node -v | grep v14.
```

## Destroy tests

Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
lando destroy -y
lando poweroff
```
Loading

0 comments on commit 45d8c20

Please sign in to comment.