Skip to content

Commit

Permalink
#116: Test things without hackalicious and php tests (#131)
Browse files Browse the repository at this point in the history
* #116: Test things without hackalicious

* #116: Add php 8.0 tests

* #116: Add php other php tests

* #116: Scale back tests for a sec

* #116: Scale back tests for a sec part 2

* #116: Scale tests back up

* #116: Scale tests back up part 2

* #116: Scale tests back up part 3
  • Loading branch information
pirog committed Oct 29, 2021
1 parent 81a5b00 commit 13918a3
Show file tree
Hide file tree
Showing 92 changed files with 1,808 additions and 46 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/pr-php-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: PHP Tests

on:
pull_request:

jobs:
leia-tests:
runs-on: ${{ matrix.os }}
env:
TERM: xterm
strategy:
matrix:
leia-tests:
- examples/php-8.0
- examples/php-7.4
- examples/php-7.3
- examples/php-7.2
- examples/php-7.1
- examples/php-7.0
- examples/php-5.6
- examples/php-5.5
# - examples/php-5.4
lando-versions:
- edge
os:
- ubuntu-20.04
node-version:
- '14'

steps:
# Install deps and cache
- name: Checkout code
uses: actions/checkout@v2
- name: Install node ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Install Yarn dependencies
run: yarn install --prefer-offline --frozen-lockfile

# This block should eventually become use lando/actions-hyperdrive@v2
- name: Verify Docker dependencies
run: |
docker --version | grep "20.10."
docker-compose --version | grep "1.29."
- name: Grab latest edge Lando CLI
run: |
sudo curl -fsSL -o /usr/local/bin/lando "https://files.lando.dev/cli/lando-linux-x64-${{ matrix.lando-versions }}"
sudo chmod +x /usr/local/bin/lando
- name: Move in lando config appropriate for testing
run: |
mkdir -p ~/.lando/cache
cp -f actions-lando-config.yml ~/.lando/config.yml
echo false > ~/.lando/cache/report_errors
lando --clear
- name: Verify Lando works and we are dogfooding this plugin for tests
run: |
lando version
lando config --path plugins | grep platformsh | grep /home/runner/work/platformsh/platformsh || echo "::error:: Not dogfooding this plugin correctly! "
cd ${{ matrix.leia-tests }}
lando config --path plugins | grep platformsh | grep dir | grep /home/runner/work/platformsh/platformsh || echo "::error:: Not dogfooding this plugin correctly! "
# This block should eventually become use lando/actions-leia@v2
# @NOTE? Do we want a way for our leia-action to configure apparmor since
# this might break a whole bunch of tests? or is this literally just a thing
# for the platform.sh mysql/mariadb container?
- name: Configure apparmor
run: |
set -x
sudo apt-get remove mysql-server --purge
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: Run leia tests
shell: bash
run: yarn leia "./${{ matrix.leia-tests }}/README.md" -c 'Destroy tests' --stdin --shell bash

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## IN DEVELOPMENT

## v0.6.0 - [October 29, 2021](https://github.com/lando/cli/releases/tag/v0.6.0)

Lando is **free** and **open source** software that relies on contributions from developers like you! If you like Lando then help us spend more time making, updating and supporting it by [contributing](https://github.com/sponsors/lando).

* Updated to recent `php` images, resolves [#]

## v0.5.0 - [October 6, 2021](https://github.com/lando/cli/releases/tag/v0.5.0)

Lando is **free** and **open source** software that relies on contributions from developers like you! If you like Lando then help us spend more time making, updating and supporting it by [contributing](https://github.com/sponsors/lando).
Expand Down
20 changes: 20 additions & 0 deletions examples/php-5.4/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Drupal editor configuration normalization
# @see http://editorconfig.org/

# This is the top-most .editorconfig file; do not search in parent directories.
root = true

# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[composer.{json,lock}]
indent_size = 4

[.platform.app.yaml]
indent_size = 4
11 changes: 11 additions & 0 deletions examples/php-5.4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
vendor
files
data
private
.platform/local

*.sql
*.tar.gz
*.tar

.DS_Store
10 changes: 10 additions & 0 deletions examples/php-5.4/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: lando-platformsh-php-5.4
recipe: platformsh
config:
id: DISCONNECTED


# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
plugins:
"@lando/platformsh": ./../../
9 changes: 9 additions & 0 deletions examples/php-5.4/.platform.app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: vanilla
type: "php:5.4"
build:
flavor: none
web:
locations:
"/":
root: "."
passthru: "/index.php"
12 changes: 12 additions & 0 deletions examples/php-5.4/.platform/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The routes of the project.
#
# Each route describes how an incoming URL is going
# to be processed by Platform.sh.

"https://vanilla.{default}/":
type: upstream
upstream: "vanilla:http"

"https://advanced.{default}/":
type: upstream
upstream: "advanced:http"
77 changes: 77 additions & 0 deletions examples/php-5.4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Platform.sh PHP 5.4 Example
===========================

This example exists to test this plugin's implementation of Platform.sh's `php:5.4` service.

* [`php:5.4`](https://docs.platform.sh/configuration/services/php.html)

Start up tests
--------------

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

```bash
# Should poweroff
lando poweroff

# Should start up successfully
lando start
```

Verification commands
---------------------

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

```bash
# Should have the expected platformsh containers and images
docker ps --filter label=com.docker.compose.project=landoplatformshphp54 | grep docker.registry.platform.sh/php-5.4 | grep landoplatformshphp54_vanilla_1
docker ps --filter label=com.docker.compose.project=landoplatformshphp54 | grep docker.registry.platform.sh/php-5.4 | grep landoplatformshphp54_advanced_1

# Should be running application containers as web
lando ssh -s vanilla -c "id" | grep web
lando ssh -s advanced -c "id" | grep web

# Should have the platform cli in application containers
lando ssh -s vanilla -c "platform -V"
lando ssh -s advanced -c "platform -V"

# Should be running the correct php version
lando ssh -s vanilla -c "php --version" | grep 5.4.
lando ssh -s advanced -c "php --version" | grep 5.4.

# Should serve php files
lando ssh -s vanilla -c "curl localhost:80" | grep "PHP Version 5.4."
lando ssh -s advanced -c "curl localhost:80" | grep "PHP Version 5.4."

# Should have the correct version of composer
# lando ssh -s vanilla -c "composer --version --no-ansi" | grep "Composer 1."
lando ssh -s advanced -c "composer --version --no-ansi" | grep "Composer 2."

# Should prefer deps installed in application yamls
# lando ssh -s vanilla -c "which composer" | grep "/usr/local/bin/composer"
lando ssh -s advanced -c "which composer" | grep "/app/.platform/local/deps/php/vendor/bin/composer"

# Should have the correct extensions installed
lando ssh -s vanilla -c "php -m" | grep redis || echo "$?" | grep 1
lando ssh -s advanced -c "php -m" | grep redis

# Should run build hooks
lando ssh -s advanced -c "stat /tmp/build"

# Should run deploy hooks
lando ssh -s advanced -c "stat /tmp/deploy"
```

Destroy tests
-------------

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

```bash
# Should be able to destroy our app
lando destroy -y

# Should poweroff
lando poweroff
```
26 changes: 26 additions & 0 deletions examples/php-5.4/advanced/.platform.app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: advanced
type: "php:5.4"
runtime:
extensions:
- redis
dependencies:
php:
"platformsh/client": "2.x-dev"
"composer/composer": "^2"
build:
flavor: composer
hooks:
build: |
set -e
touch /tmp/build
deploy: |
set -e
touch /tmp/deploy
web:
locations:
"/":
root: "."
passthru: "/index.php"
commands:
start: /usr/sbin/php5-fpm
3 changes: 3 additions & 0 deletions examples/php-5.4/advanced/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
phpinfo();
?>
3 changes: 3 additions & 0 deletions examples/php-5.4/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
phpinfo();
?>
20 changes: 20 additions & 0 deletions examples/php-5.5/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Drupal editor configuration normalization
# @see http://editorconfig.org/

# This is the top-most .editorconfig file; do not search in parent directories.
root = true

# All files.
[*]
end_of_line = LF
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[composer.{json,lock}]
indent_size = 4

[.platform.app.yaml]
indent_size = 4
11 changes: 11 additions & 0 deletions examples/php-5.5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
vendor
files
data
private
.platform/local

*.sql
*.tar.gz
*.tar

.DS_Store
10 changes: 10 additions & 0 deletions examples/php-5.5/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: lando-platformsh-php-5.5
recipe: platformsh
config:
id: DISCONNECTED


# This is important because it lets lando know to test against the plugin in this repo
# DO NOT REMOVE THIS!
plugins:
"@lando/platformsh": ./../../
9 changes: 9 additions & 0 deletions examples/php-5.5/.platform.app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: vanilla
type: "php:5.5"
build:
flavor: none
web:
locations:
"/":
root: "."
passthru: "/index.php"
12 changes: 12 additions & 0 deletions examples/php-5.5/.platform/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The routes of the project.
#
# Each route describes how an incoming URL is going
# to be processed by Platform.sh.

"https://vanilla.{default}/":
type: upstream
upstream: "vanilla:http"

"https://advanced.{default}/":
type: upstream
upstream: "advanced:http"

0 comments on commit 13918a3

Please sign in to comment.