Skip to content

Commit

Permalink
Move the CI checks to GitHub Actions (see #16)
Browse files Browse the repository at this point in the history
Description
-----------

-

Commits
-------

7199d9e Move the CI checks to GitHub Actions
068cf0b Use phpdbg to generate the coverage reports (PhpUnit 5.7 does not support pcov)
09caa16 Do not test PHP 7.4 yet as long as we have to support PHP 5.6 and PhpUnit 5.7
  • Loading branch information
leofeyer committed Mar 18, 2020
1 parent 031e746 commit 3fc2e84
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 170 deletions.
43 changes: 0 additions & 43 deletions .appveyor.yml

This file was deleted.

136 changes: 136 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,136 @@
name: CI

on:
pull_request: ~
push:
branches:
- master
tags:
- '*'
schedule:
- cron: 0 13 * * MON,TUE

jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
tools: prestissimo, flex
coverage: none

- name: Checkout
uses: actions/checkout@v2

- name: Install the dependencies
run: composer install --no-interaction --no-suggest

- name: Generate the coverage report
run: phpdbg -qrr vendor/bin/phpunit --coverage-clover=clover.xml --colors=always

- name: Upload the coverage report
uses: codecov/codecov-action@v1
with:
file: ./clover.xml
fail_ci_if_error: true

coding-style:
name: Coding Style
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo, zlib
tools: prestissimo, flex
coverage: none

- name: Checkout
uses: actions/checkout@v2

- name: Install the dependencies
run: composer install --no-interaction --no-suggest

- name: Check the coding style
run: vendor/bin/php-cs-fixer fix --diff --diff-format=udiff --dry-run

tests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
if: github.event_name != 'push'
strategy:
fail-fast: false
matrix:
php: [5.6, 7.2, 7.3]
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
tools: prestissimo, flex
coverage: none

- name: Checkout
uses: actions/checkout@v2

- name: Install the dependencies
run: composer install --no-interaction --no-suggest

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always

prefer-lowest:
name: Prefer Lowest
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
tools: prestissimo, flex
coverage: none

- name: Checkout
uses: actions/checkout@v2

- name: Install the dependencies
run: composer update --prefer-lowest --prefer-stable --no-interaction --no-suggest

- name: Run the unit tests
run: vendor/bin/phpunit --colors=always

windows:
name: Windows
runs-on: windows-latest
if: github.event_name != 'push'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.3
extensions: dom, fileinfo, filter, gd, hash, intl, json, mbstring, pcre, pdo_mysql, zlib
ini-values: memory_limit=1G
tools: prestissimo, flex
coverage: none

- name: Adjust the Git autocrlf setting
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v2

- name: Install the dependencies
run: composer install --no-interaction --no-suggest --no-progress

- name: Run the unit tests
run: vendor/bin/phpunit.bat --colors=always
84 changes: 0 additions & 84 deletions .travis.yml

This file was deleted.

8 changes: 8 additions & 0 deletions codecov.yml
@@ -0,0 +1,8 @@
coverage:
status:
patch: false
project:
default:
threshold: 0.2%

comment: false
10 changes: 2 additions & 8 deletions composer.json
Expand Up @@ -15,16 +15,10 @@
"imagine/imagine": "^0.6 || ^0.7 || ^1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.12.7",
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5.7.26 || ^7.5",
"friendsofphp/php-cs-fixer": "^2.14",
"phpunit/phpunit": "^5.7.26",
"symfony/filesystem": "^2.8 || ^3.0 || ^4.0"
},
"extra": {
"branch-alias": {
"dev-master": "0.2.x-dev"
}
},
"autoload": {
"psr-4": {
"Contao\\ImagineSvg\\": "src/"
Expand Down
20 changes: 3 additions & 17 deletions src/Effects.php
Expand Up @@ -26,9 +26,6 @@ class Effects implements EffectsInterface
*/
private $document;

/**
* @param \DOMDocument $document
*/
public function __construct(\DOMDocument $document)
{
$this->document = $document;
Expand All @@ -42,10 +39,7 @@ public function gamma($correction)
$gamma = (float) $correction;

if ($gamma <= 0) {
throw new InvalidArgumentException(sprintf(
'Invalid gamma correction value %s, must be a positive float or integer',
var_export($correction, true)
));
throw new InvalidArgumentException(sprintf('Invalid gamma correction value %s, must be a positive float or integer', var_export($correction, true)));
}

$funcAttributes = [
Expand Down Expand Up @@ -140,10 +134,7 @@ public function blur($sigma = 1)
$deviation = (float) $sigma;

if ($deviation <= 0) {
throw new InvalidArgumentException(sprintf(
'Invalid sigma %s, must be a positive float or integer',
var_export($sigma, true)
));
throw new InvalidArgumentException(sprintf('Invalid sigma %s, must be a positive float or integer', var_export($sigma, true)));
}

$this->addFilterElement('feGaussianBlur', [
Expand All @@ -161,10 +152,7 @@ public function brightness($brightness)
$intercept = ((int) $brightness) / 100;

if ($intercept < -1 || $intercept > 1) {
throw new InvalidArgumentException(sprintf(
'Invalid brightness value %s, must be between -100 and 100',
var_export($brightness, true)
));
throw new InvalidArgumentException(sprintf('Invalid brightness value %s, must be between -100 and 100', var_export($brightness, true)));
}

$funcAttributes = [
Expand Down Expand Up @@ -211,7 +199,6 @@ public function convolve(Matrix $matrix)
* Create and add a new filter element.
*
* @param string $name
* @param array $attributes
*/
private function addFilterElement($name, array $attributes)
{
Expand Down Expand Up @@ -279,7 +266,6 @@ private function wrapSvg()
* Create element with the specified attributes.
*
* @param string $name
* @param array $attributes
*
* @return \DOMElement
*/
Expand Down

0 comments on commit 3fc2e84

Please sign in to comment.