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 6, 2020
1 parent 3545874 commit 4084bd1
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 25 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: build

on: [push]
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.2', '7.3', '7.4', '8.0' ]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

services:
Expand All @@ -26,7 +26,7 @@ jobs:
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
Expand All @@ -50,8 +50,24 @@ 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-reqs

- name: Run test suite for PHP 7.2
if: matrix.php-versions == '7.2'
- run: composer lint
- run: cs:check
- run: sniffer:check
- run: phpstan
- run: test:scrutinizer

- name: Run test suite
if: matrix.php-versions > '7.2'
run: composer check
env:
PHP_CS_FIXER_IGNORE_ENV: 1
2 changes: 1 addition & 1 deletion .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: true
node: false
postgresql: false
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"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"
"test:coverage": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage",
"test:scrutinizer": "phpunit --configuration phpunit8.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage"
}
}
39 changes: 22 additions & 17 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true" backupGlobals="false" backupStaticAttributes="false">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<exclude>
<directory>build</directory>
<directory>docs</directory>
<directory>tmp</directory>
<directory>vendor</directory>
</exclude>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="vendor/autoload.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory>build</directory>
<directory>docs</directory>
<directory>tmp</directory>
<directory>vendor</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
</phpunit>
19 changes: 19 additions & 0 deletions phpunit8.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true" backupGlobals="false" backupStaticAttributes="false">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<exclude>
<directory>build</directory>
<directory>docs</directory>
<directory>tmp</directory>
<directory>vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

0 comments on commit 4084bd1

Please sign in to comment.