Skip to content

Commit

Permalink
php 8, replaced travis with github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Dec 1, 2020
1 parent af8f0bb commit 31ec554
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 27 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
}

0 comments on commit 31ec554

Please sign in to comment.