From 31ec5540a7cff42afe2f49cc88b35d4166c19232 Mon Sep 17 00:00:00 2001 From: Oscar Otero Date: Tue, 1 Dec 2020 20:37:33 +0100 Subject: [PATCH] php 8, replaced travis with github actions --- .github/workflows/main.yaml | 76 +++++++++++++++++++++++++++++++++++++ .travis.yml | 14 ------- README.md | 7 +--- composer.json | 17 +++++---- 4 files changed, 87 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/main.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..e13e54c --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,76 @@ +name: "testing" + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + qa: + name: Quality assurance + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Coding Standard + run: composer run-script cs + + tests: + name: Tests + runs-on: ubuntu-latest + + strategy: + matrix: + php: + - 7.2 + - 7.3 + - 7.4 + composer-args: [ "" ] + include: + - php: 8.0 + composer-args: --ignore-platform-reqs + fail-fast: false + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - name: Cache PHP dependencies + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest ${{ matrix.composer-args }} + + - name: Tests + run: composer test + + - name: Tests coverage + run: composer coverage diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 52e03f9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: php -sudo: false - -php: - - 7.2 - - 7.3 - - 7.4 - -before_script: - - composer self-update - - composer install -n - -script: - - composer test diff --git a/README.md b/README.md index a05672c..69c3038 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ [![Latest Version on Packagist][ico-version]][link-packagist] [![Software License][ico-license]](LICENSE) -[![Build Status][ico-travis]][link-travis] -[![Quality Score][ico-scrutinizer]][link-scrutinizer] +![Testing][ico-ga] [![Total Downloads][ico-downloads]][link-downloads] Middleware to encode the response body to `gzip` or `deflate` if the `Accept-Encoding` header is present and adds the `Content-Encoding` header. This package is splitted into the following components: @@ -92,11 +91,9 @@ The MIT License (MIT). Please see [LICENSE](LICENSE) for more information. [ico-version]: https://img.shields.io/packagist/v/middlewares/encoder.svg?style=flat-square [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square -[ico-travis]: https://img.shields.io/travis/middlewares/encoder/master.svg?style=flat-square -[ico-scrutinizer]: https://img.shields.io/scrutinizer/g/middlewares/encoder.svg?style=flat-square +[ico-ga]: https://github.com/middlewares/encoder/workflows/testing/badge.svg [ico-downloads]: https://img.shields.io/packagist/dt/middlewares/encoder.svg?style=flat-square [link-packagist]: https://packagist.org/packages/middlewares/encoder -[link-travis]: https://travis-ci.org/middlewares/encoder [link-scrutinizer]: https://scrutinizer-ci.com/g/middlewares/encoder [link-downloads]: https://packagist.org/packages/middlewares/encoder diff --git a/composer.json b/composer.json index b1583cb..3cb95fd 100644 --- a/composer.json +++ b/composer.json @@ -19,16 +19,17 @@ }, "require": { "ext-zlib": "*", - "php": "^7.2", + "php": "^7.2 || ^8.0", "middlewares/utils": "^3.0", "psr/http-server-middleware": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^8.1", + "phpunit/phpunit": "^8|^9", "laminas/laminas-diactoros": "^2.2", "friendsofphp/php-cs-fixer": "^2.0", "squizlabs/php_codesniffer": "^3.0", - "oscarotero/php-cs-fixer-config": "^1.0" + "oscarotero/php-cs-fixer-config": "^1.0", + "phpstan/phpstan": "^0.12" }, "autoload": { "psr-4": { @@ -41,11 +42,11 @@ } }, "scripts": { - "test": [ - "phpunit --coverage-text", - "phpcs" - ], + "cs": "phpcs", "cs-fix": "php-cs-fixer fix", - "coverage": "phpunit --coverage-html=coverage" + "phpstan": "phpstan analyse", + "test": "phpunit", + "coverage": "phpunit --coverage-text", + "coverage-html": "phpunit --coverage-html=coverage" } }