Merge pull request #268 from clue-labs/dockerfile-syntax #416
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
PHPUnit: | |
name: PHPUnit (PHP ${{ matrix.php }} on ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-24.04 | |
- windows-2022 | |
php: | |
- 8.4 | |
- 8.3 | |
- 8.2 | |
- 8.1 | |
- 8.0 | |
- 7.4 | |
- 7.3 | |
- 7.2 | |
- 7.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: xdebug | |
ini-file: development | |
- run: composer install | |
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml | |
if: ${{ matrix.php >= 7.3 }} | |
- run: vendor/bin/phpunit --coverage-text --coverage-clover=clover.xml -c phpunit.xml.legacy | |
if: ${{ matrix.php < 7.3 }} | |
- name: Check 100% code coverage | |
shell: php {0} | |
run: | | |
<?php | |
$metrics = simplexml_load_file('clover.xml')->project->metrics; | |
exit((int) $metrics['statements'] === (int) $metrics['coveredstatements'] ? 0 : 1); | |
PHPStan: | |
name: PHPStan (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
php: | |
- 8.4 | |
- 8.3 | |
- 8.2 | |
- 8.1 | |
- 8.0 | |
- 7.4 | |
- 7.3 | |
- 7.2 | |
- 7.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: none | |
- run: composer install | |
- run: vendor/bin/phpstan | |
Built-in-webserver: | |
name: Built-in webserver (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
php: | |
- 8.4 | |
- 8.3 | |
- 8.2 | |
- 8.1 | |
- 8.0 | |
- 7.4 | |
- 7.3 | |
- 7.2 | |
- 7.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- run: composer install -d tests/integration/ | |
- run: php tests/integration/public/index.php & | |
- run: bash tests/await.bash | |
- run: bash tests/integration.bash | |
Docker: | |
name: Docker (${{ matrix.dockerfile }}) | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
dockerfile: | |
- "Dockerfile-basics" | |
- "Dockerfile-production" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.4 | |
- run: composer install -d tests/integration/ | |
- run: docker build -f tests/integration/${{ matrix.dockerfile }} tests/integration/ | |
- run: docker run -d -p 8080:8080 -v "$PWD/composer.json":/app/composer.json $(docker images -q | head -n1) | |
- run: bash tests/await.bash | |
- run: bash tests/integration.bash | |
- run: docker stop $(docker ps -qn1) | |
- run: docker logs $(docker ps -qn1) | |
if: ${{ always() }} | |
nginx-reverse-proxy: | |
name: nginx (${{ matrix.config.name }}) | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
config: | |
- name: reverse proxy with files | |
path: nginx-reverse-proxy-public.conf | |
- name: minimal reverse proxy | |
path: nginx-reverse-proxy-minimal.conf | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.4 | |
- run: composer install -d tests/integration/ | |
- run: docker build -f tests/integration/Dockerfile-basics tests/integration/ | |
- run: docker run -d -p 8080:8080 -v "$PWD/composer.json":/app/composer.json $(docker images -q | head -n1) | |
- run: docker run -d --net=host -v "$PWD/tests/integration/":/home/framework-x/ -v "$PWD"/tests/integration/${{ matrix.config.path }}:/etc/nginx/conf.d/default.conf nginx:stable-alpine | |
- run: bash tests/await.bash http://localhost/ | |
- run: bash tests/integration.bash http://localhost/ | |
- run: docker stop $(docker ps -qn2) | |
- run: docker logs $(docker ps -qn1) | |
if: ${{ always() }} | |
- run: docker logs $(docker ps -qn2 | tail -n1) | |
if: ${{ always() }} | |
nginx-fpm: | |
name: nginx + PHP-FPM (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
php: | |
- 8.4 | |
- 8.3 | |
- 8.2 | |
- 8.1 | |
- 8.0 | |
- 7.4 | |
- 7.3 | |
- 7.2 | |
- 7.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- run: composer install -d tests/integration/ | |
- run: docker run -d -v "$PWD/tests/integration/":/home/framework-x/ php:${{ matrix.php }}-fpm | |
- run: docker run -d -p 80:80 --link $(docker ps -qn1):php -v "$PWD/tests/integration/":/home/framework-x/ -v "$PWD"/tests/integration/nginx-fpm.conf:/etc/nginx/conf.d/default.conf nginx:stable-alpine | |
- run: bash tests/await.bash http://localhost/ | |
- run: bash tests/integration.bash http://localhost/ | |
- run: docker logs $(docker ps -qn1) | |
if: ${{ always() }} | |
Apache-webserver: | |
name: Apache webserver (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
php: | |
- 8.4 | |
- 8.3 | |
- 8.2 | |
- 8.1 | |
- 8.0 | |
- 7.4 | |
- 7.3 | |
- 7.2 | |
- 7.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- run: composer install -d tests/integration/ | |
- run: docker run -d -p 80:80 -v "$PWD/tests/integration/":/home/framework-x/ php:${{ matrix.php }}-apache sh -c "rmdir /var/www/html;ln -s /home/framework-x/public /var/www/html;ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled; apache2-foreground" | |
- run: bash tests/await.bash http://localhost/ | |
- run: bash tests/integration.bash http://localhost/ | |
- run: docker logs $(docker ps -qn1) | |
if: ${{ always() }} | |
PHP-webserver: | |
name: PHP webserver (PHP ${{ matrix.php }}) | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
php: | |
- 8.4 | |
- 8.3 | |
- 8.2 | |
- 8.1 | |
- 8.0 | |
- 7.4 | |
- 7.3 | |
- 7.2 | |
- 7.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
- run: composer install -d tests/integration/ | |
- run: php -S localhost:8080 tests/integration/public/index.php & | |
- run: bash tests/await.bash | |
- run: bash tests/integration.bash |