Skip to content

Commit

Permalink
feat: php test matrix (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
sitepark-veltrup authored Dec 13, 2024
1 parent 7dd815d commit 5473d24
Show file tree
Hide file tree
Showing 18 changed files with 241 additions and 5,728 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,31 @@ on:
jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
phpVersions: ["8.2", "8.3"]
name: E2E Tests (PHP ${{ matrix.phpVersions }})

steps:
- uses: actions/checkout@v2
- name: Install PHP 8.3

- name: Install PHP ${{ matrix.phpVersions }}
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
php-version: ${{ matrix.phpVersions }}
tools: composer, phive

- name: "Cache tools installed with PHIVE (PHP ${{ matrix.phpVersions }})"
uses: "actions/cache@v3"
with:
path: "${{ runner.temp }}/.phive"
key: "php-phive-${{ hashFiles('.phive/phars.xml') }}"
restore-keys: "php-phive-"

- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 atoolo-e2e-test" | sudo tee -a /etc/hosts
- name: Test
run: bin/run.sh
- name: Test PHP(${{ matrix.phpVersions }})
run: MATRIX_PHP_VERSION=${{ matrix.phpVersions }} bin/run.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/vendor
.idea
composer.lock
/var/cache/*
!var/cache/.gitkeep
/var/log/*
Expand Down
10 changes: 5 additions & 5 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.10.22" location="./tools/phpstan" copy="false" installed="1.10.22"/>
<phar name="composer-normalize" version="^2.32.0" location="./tools/composer-normalize" copy="false" installed="2.32.0"/>
<phar name="phpunit" version="^10.4.0" location="./tools/phpunit.phar" copy="true" installed="10.4.1"/>
<phar name="overtrue/phplint" version="^9.0.4" location="./tools/phplint" copy="false" installed="9.0.4"/>
<phar name="php-cs-fixer" version="^3.58.1" installed="3.58.1" copy="false" location="./tools/php-cs-fixer"/>
<phar name="phpstan" version="^1.10.22" location="./tools/phpstan" copy="false" installed="1.12.12"/>
<phar name="composer-normalize" version="^2.32.0" location="./tools/composer-normalize" copy="false" installed="2.45.0"/>
<phar name="phpunit" version="^10.4.0" location="./tools/phpunit.phar" copy="true" installed="10.5.39"/>
<phar name="overtrue/phplint" version="^9.0.4" location="./tools/phplint" copy="false" installed="9.5.5"/>
<phar name="php-cs-fixer" version="^3.58.1" installed="3.65.0" copy="false" location="./tools/php-cs-fixer"/>
</phive>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[![E2E Test](https://github.com/sitepark/atoolo-e2e-test/actions/workflows/e2e-test.yml/badge.svg)](https://github.com/sitepark/atoolo-e2e-test/actions/workflows/e2e-test.yml)
![php](https://img.shields.io/badge/PHP-8.2-blue)
![php](https://img.shields.io/badge/PHP-8.3-blue)

# End-to-end tests for the atoolo suite

Expand Down
47 changes: 41 additions & 6 deletions bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,47 @@ touch data/php/.bash_history

echo start docker container

#docker compose build
#docker compose build --no-cache
docker compose stop
docker compose rm -f
docker compose up -d
docker compose exec -u root php /tools/setup.sh


# to run outside of github actions
if [ "$MATRIX_PHP_VERSION" == "" ]; then
export MATRIX_PHP_VERSION=8.2
export SOLR_MAPPING_PORT=9091
export APACHE_MAPPING_PORT=9090
export FPM_MAPPING_PORT=9191
export MAILPIT_SMTP_MAPPING_PORT=1025
export MAILPIT_HTTP_MAPPING_PORT=8025
else
export VERSION_AS_NUMBER=${MATRIX_PHP_VERSION/./""}
export SOLR_MAPPING_PORT=${VERSION_AS_NUMBER}91
export APACHE_MAPPING_PORT=${VERSION_AS_NUMBER}90
export FPM_MAPPING_PORT=${VERSION_AS_NUMBER}92
export MAILPIT_SMTP_MAPPING_PORT=${VERSION_AS_NUMBER}25
export MAILPIT_HTTP_MAPPING_PORT=${VERSION_AS_NUMBER}80
export DOCKER_COMPOSE_PROJECT_NAME=atoolo-e2e-test-php${VERSION_AS_NUMBER}
fi

export ENDPOINT_BASE=http://atoolo-e2e-test:${APACHE_MAPPING_PORT}
export MAILPIT_ENDPOINT_BASE=http://atoolo-e2e-test:${MAILPIT_HTTP_MAPPING_PORT}

#docker compose --project-name ${DOCKER_COMPOSE_PROJECT_NAME} build
#docker compose --project-name ${DOCKER_COMPOSE_PROJECT_NAME} build --no-cache
docker compose --project-name "${DOCKER_COMPOSE_PROJECT_NAME}" stop
docker compose --project-name "${DOCKER_COMPOSE_PROJECT_NAME}" rm -f
docker compose --project-name "${DOCKER_COMPOSE_PROJECT_NAME}" up -d
docker compose --project-name "${DOCKER_COMPOSE_PROJECT_NAME}" exec -u root php /tools/setup.sh

# create composer.lock
composer update --no-install
# install dependencies with exists composer.lock so that post-install-cmd scripts are also executed
composer install
composer test

# Without DOCKER_COMPOSE_PROJECT_NAME, it is assumed that the test is executed locally.
# In this case, we leave the containers started so that the tests can simply be repeated
# with `composer test` or via IDE.
if [ "${DOCKER_COMPOSE_PROJECT_NAME}" != "" ]; then
echo stop ${DOCKER_COMPOSE_PROJECT_NAME}
docker compose --project-name "${DOCKER_COMPOSE_PROJECT_NAME}" stop
docker compose --project-name "${DOCKER_COMPOSE_PROJECT_NAME}" rm -f
fi
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=8.2 <8.4.0",
"php": ">=8.2 <8.5.0",
"ext-intl": "*",
"symfony/http-client": "^7.1"
},
Expand Down Expand Up @@ -51,7 +51,7 @@
"@analyse:compatibilitycheck"
],
"analyse:compatibilitycheck": "./vendor/bin/phpcs --standard=./phpcs.compatibilitycheck.xml",
"analyse:phpcsfixer": "./tools/php-cs-fixer check --diff --show-progress=dots",
"analyse:phpcsfixer": "./tools/php-cs-fixer check --diff --show-progress=dots",
"analyse:phplint": "./tools/phplint",
"analyse:phpstan": "./tools/phpstan analyse",
"cs-fix": [
Expand Down
Loading

0 comments on commit 5473d24

Please sign in to comment.