From 7aa829df379601af4d97ccc9327080f61f5a7d03 Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:17:45 +0200 Subject: [PATCH 1/9] Update build --- .github/workflows/build.yml | 28 ++++++++++ .github/workflows/tests.yml | 35 ------------- README.md | 2 +- composer.json | 102 +++++++++++++++++++----------------- phpstan.neon | 4 ++ phpunit.xml.dist | 19 ------- 6 files changed, 86 insertions(+), 104 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/tests.yml create mode 100644 phpstan.neon delete mode 100644 phpunit.xml.dist diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2003ee4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: build + +on: [ push, pull_request ] + +jobs: + build: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: [ ubuntu-latest ] + php-versions: [ 7.4, 8.0, 8.1, 8.2, 8.3 ] + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: xdebug + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run test suite + run: composer test:all diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 1e714b1..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Tests - -on: [push, pull_request] - -jobs: - tests: - name: Tests PHP ${{ matrix.php }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php: [7.4, 8.0, 8.1, 8.2, 8.3] - include: - - php: 8.1 - analysis: true - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: xdebug - - - name: Install dependencies with Composer - uses: ramsey/composer-install@v2 - - - name: Coding standards - if: matrix.analysis - run: vendor/bin/phpcs - - - name: Tests - run: vendor/bin/phpunit --coverage-clover clover.xml diff --git a/README.md b/README.md index 7432f36..4b1df73 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Latest Version on Packagist](https://img.shields.io/github/release/slimphp/php-view.svg)](https://packagist.org/packages/slim/PHP-View) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) -[![Build Status](https://github.com/slimphp/PHP-View/actions/workflows/tests.yml/badge.svg?branch=3.x)](https://github.com/slimphp/PHP-View/actions) +[![Build Status](https://github.com/slimphp/PHP-View/actions/workflows/build.yml/badge.svg?branch=3.x)](https://github.com/slimphp/PHP-View/actions) [![Total Downloads](https://img.shields.io/packagist/dt/slim/PHP-View.svg)](https://packagist.org/packages/slim/PHP-View/stats) diff --git a/composer.json b/composer.json index 364b479..f704f87 100644 --- a/composer.json +++ b/composer.json @@ -1,52 +1,56 @@ { - "name": "slim/php-view", - "type": "library", - "description": "Render PHP view scripts into a PSR-7 Response object.", - "keywords": [ - "slim", - "framework", - "view", - "template", - "php", - "phtml", - "renderer" - ], - "license": "MIT", - "authors": [ - { - "name": "Glenn Eggleton", - "email": "geggleto@gmail.com" - } - ], - "require": { - "php": "^7.4 || ^8.0", - "psr/http-message": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^9.6", - "slim/psr7": "^1.6", - "squizlabs/php_codesniffer": "^3.10" - }, - "autoload": { - "psr-4": { - "Slim\\Views\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "Slim\\Tests\\": "tests" - } - }, - "scripts": { - "test": [ - "@phpcs", - "@phpunit" - ], - "phpunit": "phpunit", - "phpcs": "phpcs", - "test:coverage": "phpunit --configuration phpunit.xml.dist --coverage-clover build/logs/clover.xml --coverage-html build/coverage" - }, - "config": { - "sort-packages": true + "name": "slim/php-view", + "description": "Render PHP view scripts into a PSR-7 Response object.", + "license": "MIT", + "type": "library", + "keywords": [ + "slim", + "framework", + "view", + "template", + "php", + "phtml", + "renderer" + ], + "authors": [ + { + "name": "Glenn Eggleton", + "email": "geggleto@gmail.com" + } + ], + "require": { + "php": "^7.4 || ^8.0", + "psr/http-message": "^1.1" + }, + "require-dev": { + "phpstan/phpstan": "^1", + "phpunit/phpunit": "^9", + "slim/psr7": "^1.6", + "squizlabs/php_codesniffer": "^3.10" + }, + "autoload": { + "psr-4": { + "Slim\\Views\\": "src" } + }, + "autoload-dev": { + "psr-4": { + "Slim\\Tests\\": "tests" + } + }, + "config": { + "sort-packages": true + }, + "scripts": { + "sniffer:check": "phpcs --standard=phpcs.xml", + "sniffer:fix": "phpcbf --standard=phpcs.xml", + "stan": "phpstan analyse -c phpstan.neon --no-progress --ansi", + "test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always", + "test:all": [ + "@sniffer:check", + "@stan", + "@test" + ], + "test:coverage": "php -d xdebug.mode=coverage -r \\\"require 'vendor/bin/phpunit';\\\" -- --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage" + } } diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..077ee5a --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + level: 5 + paths: + - src diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 1fbf04e..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,19 +0,0 @@ - - - - - ./tests/ - - - - - ./src/ - - - From 2142966dd927faf0869403882d38e8d14a3f861e Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:22:38 +0200 Subject: [PATCH 2/9] Update phpunit settings --- .gitignore | 1 - phpunit.xml | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 phpunit.xml diff --git a/.gitignore b/.gitignore index a3a64a2..78f83f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .DS_Store composer.lock -phpunit.xml vendor .idea composer.phar diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..1fbf04e --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,19 @@ + + + + + ./tests/ + + + + + ./src/ + + + From e46a03a7613e2f6805c530ab929f58f51750eeea Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:24:59 +0200 Subject: [PATCH 3/9] Update phpstan settings --- phpstan.neon | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon b/phpstan.neon index 077ee5a..b35f3d4 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,3 +2,4 @@ parameters: level: 5 paths: - src + - tests From f5d93ee0613d43efe749356c640e4a5d6c415a74 Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:29:34 +0200 Subject: [PATCH 4/9] Update build name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2003ee4..b92ed30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: build on: [ push, pull_request ] jobs: - build: + tests: runs-on: ${{ matrix.operating-system }} strategy: matrix: From 90f34c2c02635d1b70435ce6c052fd284ef5a370 Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:31:35 +0200 Subject: [PATCH 5/9] Update build name --- .github/workflows/{build.yml => tests.yml} | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{build.yml => tests.yml} (98%) diff --git a/.github/workflows/build.yml b/.github/workflows/tests.yml similarity index 98% rename from .github/workflows/build.yml rename to .github/workflows/tests.yml index b92ed30..7669db0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: build +name: Tests on: [ push, pull_request ] diff --git a/README.md b/README.md index 4b1df73..7432f36 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Latest Version on Packagist](https://img.shields.io/github/release/slimphp/php-view.svg)](https://packagist.org/packages/slim/PHP-View) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) -[![Build Status](https://github.com/slimphp/PHP-View/actions/workflows/build.yml/badge.svg?branch=3.x)](https://github.com/slimphp/PHP-View/actions) +[![Build Status](https://github.com/slimphp/PHP-View/actions/workflows/tests.yml/badge.svg?branch=3.x)](https://github.com/slimphp/PHP-View/actions) [![Total Downloads](https://img.shields.io/packagist/dt/slim/PHP-View.svg)](https://packagist.org/packages/slim/PHP-View/stats) From f4b6e746e340be64678001558eb018aa77e85dfa Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:39:04 +0200 Subject: [PATCH 6/9] Update build name --- .github/workflows/tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7669db0..ac6ed19 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,12 +4,11 @@ on: [ push, pull_request ] jobs: tests: - runs-on: ${{ matrix.operating-system }} + name: Tests PHP ${{ matrix.php }} strategy: matrix: operating-system: [ ubuntu-latest ] php-versions: [ 7.4, 8.0, 8.1, 8.2, 8.3 ] - name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} steps: - name: Checkout From 0daae30d1d4a4eab1dfee8d16e3e9275df1bff15 Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:44:31 +0200 Subject: [PATCH 7/9] Update build --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ac6ed19..84bd957 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,10 +5,11 @@ on: [ push, pull_request ] jobs: tests: name: Tests PHP ${{ matrix.php }} + runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - operating-system: [ ubuntu-latest ] - php-versions: [ 7.4, 8.0, 8.1, 8.2, 8.3 ] + php: [ 7.4, 8.0, 8.1, 8.2, 8.3 ] steps: - name: Checkout From 9fd8252d175a3fcdfcb2b17984b201e8f400795b Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:53:43 +0200 Subject: [PATCH 8/9] Update phpunit settings --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f704f87..b576a87 100644 --- a/composer.json +++ b/composer.json @@ -51,6 +51,6 @@ "@stan", "@test" ], - "test:coverage": "php -d xdebug.mode=coverage -r \\\"require 'vendor/bin/phpunit';\\\" -- --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage" + "test:coverage": "php -d xdebug.mode=coverage -r \"require 'vendor/bin/phpunit';\" -- --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage" } } From 7fa4150e8cac0fcbb85a5a1d9134c48b33d5c30b Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:55:56 +0200 Subject: [PATCH 9/9] Change build name to lowercase --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 84bd957..a9812da 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Tests +name: tests on: [ push, pull_request ]