Skip to content

Commit

Permalink
Add PHP 8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Dec 28, 2020
1 parent 3e14279 commit b542032
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 53 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
name: build

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2', '7.3', '7.4']
operating-system: [ ubuntu-latest ]
php-versions: [ '7.3', '7.4', '8.0' ]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, pdo, pdo_mysql, intl, zip
extensions: mbstring, intl, zip
coverage: none

- name: Check PHP Version
Expand All @@ -34,8 +34,15 @@ jobs:
- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Install dependencies for PHP 7
if: matrix.php-versions < '8.0'
run: composer update --prefer-dist --no-progress

- name: Install dependencies for PHP 8
if: matrix.php-versions >= '8.0'
run: composer update --prefer-dist --no-progress --ignore-platform-req=php

- name: Run test suite
run: composer check-all
run: composer check
env:
PHP_CS_FIXER_IGNORE_ENV: 1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
composer.lock
nbproject/
vendor/
build/
build/
.phpunit.result.cache
4 changes: 2 additions & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tools:

build:
environment:
php: 7.2
php: 7.4
mysql: false
node: false
postgresql: false
Expand All @@ -34,7 +34,7 @@ build:
tests:
before:
-
command: composer test-coverage
command: composer test:coverage
coverage:
file: 'build/logs/clover.xml'
format: 'clover'
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Audio format detection library for PHP.

[![Latest Version on Packagist](https://img.shields.io/github/release/selective-php/audio-type.svg?style=flat-square)](https://packagist.org/packages/selective/audio-type)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Latest Version on Packagist](https://img.shields.io/github/release/selective-php/audio-type.svg)](https://packagist.org/packages/selective/audio-type)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
[![build](https://github.com/selective-php/audio-type/workflows/build/badge.svg)](https://github.com/selective-php/audio-type/actions)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/selective-php/audio-type.svg?style=flat-square)](https://scrutinizer-ci.com/g/selective-php/audio-type/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/quality/g/selective-php/audio-type.svg?style=flat-square)](https://scrutinizer-ci.com/g/selective-php/audio-type/?branch=master)
[![Total Downloads](https://img.shields.io/packagist/dt/selective/audio-type.svg?style=flat-square)](https://packagist.org/packages/selective/audio-type/stats)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/selective-php/audio-type.svg)](https://scrutinizer-ci.com/g/selective-php/audio-type/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/quality/g/selective-php/audio-type.svg)](https://scrutinizer-ci.com/g/selective-php/audio-type/?branch=master)
[![Total Downloads](https://img.shields.io/packagist/dt/selective/audio-type.svg)](https://packagist.org/packages/selective/audio-type/stats)


## Features
Expand Down Expand Up @@ -35,7 +35,7 @@ Audio format detection library for PHP.

## Requirements

* PHP 7.2+
* PHP 7.3+ or 8.0+

## Installation

Expand Down
51 changes: 26 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,43 @@
"homepage": "https://github.com/selective-php/audio-type",
"license": "MIT",
"require": {
"php": "^7.2"
"php": "^7.3 || ^8.0"
},
"require-dev": {
"overtrue/phplint": "^1.1",
"phpunit/phpunit": "^7",
"phpstan/phpstan": "*",
"squizlabs/php_codesniffer": "^3.4"
"friendsofphp/php-cs-fixer": "^2.16",
"overtrue/phplint": "^2.3",
"phpstan/phpstan": "0.*",
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "^3.5"
},
"scripts": {
"test": "phpunit --configuration phpunit.xml",
"test-coverage": "phpunit --configuration phpunit.xml --coverage-clover build/logs/clover.xml --coverage-html build/coverage",
"check-style": "phpcs --standard=phpcs.xml",
"fix-style": "phpcbf --standard=phpcs.xml",
"phpstan": "phpstan analyse src tests --level=max -c phpstan.neon --no-progress",
"lint": "phplint ./ --exclude=vendor --no-interaction --no-cache",
"install-cs": "php -r \"@mkdir('build'); copy('https://cs.symfony.com/download/php-cs-fixer-v2.phar', 'build/php-cs-fixer-v2.phar');\"",
"fix-cs": "php build/php-cs-fixer-v2.phar fix --config=.cs.php",
"check-cs": "php build/php-cs-fixer-v2.phar fix --dry-run --format=txt --verbose --diff --diff-format=udiff --config=.cs.php",
"check-all": [
"@lint",
"@check-style",
"@phpstan",
"@test-coverage"
]
"config": {
"sort-packages": true
},
"autoload": {
"psr-4": {
"Selective\\AudioType\\": "src"
"Selective\\AudioType\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Selective\\AudioType\\Test\\": "tests"
"Selective\\AudioType\\Test\\": "tests/"
}
},
"config": {
"sort-packages": true
"scripts": {
"check": [
"@lint",
"@cs:check",
"@sniffer:check",
"@phpstan",
"@test:coverage"
],
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --diff-format=udiff --config=.cs.php",
"cs:fix": "php-cs-fixer fix --config=.cs.php",
"lint": "phplint ./ --exclude=vendor --no-interaction --no-cache",
"phpstan": "phpstan analyse src tests --level=max -c phpstan.neon --no-progress --ansi",
"sniffer:check": "phpcs --standard=phpcs.xml",
"sniffer:fix": "phpcbf --standard=phpcs.xml",
"test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always",
"test:coverage": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage"
}
}
23 changes: 12 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
timeoutForLargeTests="900">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="false">
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory>vendor</directory>
<directory>build</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">src</directory>
<exclude>
<directory>vendor</directory>
<directory>build</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

0 comments on commit b542032

Please sign in to comment.