From 7aa829df379601af4d97ccc9327080f61f5a7d03 Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Fri, 12 Jul 2024 22:17:45 +0200 Subject: [PATCH] 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/ - - -