Skip to content

Commit

Permalink
Merge pull request #3 from php-api-clients/replace-cs-tool
Browse files Browse the repository at this point in the history
Replace squizlabs/php_codesniffer with friendsofphp/php-cs-fixer
  • Loading branch information
WyriHaximus committed May 11, 2017
2 parents 41f90b3 + 0eb3d27 commit 45dfddc
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 145 deletions.
17 changes: 13 additions & 4 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

use ApiClients\Tools\TestUtilities\PhpCsFixerConfig;

return PhpCsFixerConfig::create()->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
);
return (function ()
{
$path = __DIR__ . DIRECTORY_SEPARATOR . 'src';

return PhpCsFixerConfig::create()
->setFinder(
PhpCsFixer\Finder::create()
->in($path)
->append([$path])
)
->setUsingCache(false)
;
})();
43 changes: 28 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,53 @@ sudo: false
## Cache composer bits
cache:
directories:
- $HOME/.composer/cache
- $HOME/.humbug

## PHP versions we test against
php:
- 7.0
- 7.1
- nightly
- $HOME/.composer/cache/files

## Build matrix for lowest and highest possible targets
matrix:
include:
- php: 7.0
env: dependencies=lowest
env:
- qaExtended=true
- php: 7.1
- php: nightly
env:
- dropPlatform=false
- php: 7.0
env:
- dependencies=lowest
- php: 7.1
env: dependencies=lowest
env:
- dependencies=lowest
- php: nightly
env: dependencies=lowest
env:
- dependencies=lowest
- dropPlatform=false
- php: 7.0
env: dependencies=highest
env:
- dependencies=highest
- php: 7.1
env: dependencies=highest
env:
- dependencies=highest
- php: nightly
env: dependencies=highest
env:
- dependencies=highest
- dropPlatform=false

## Install or update dependencies
install:
- composer validate
- if [ -z "$dropPlatform" ]; then composer config --unset platform.php; fi;
- if [ -z "$qaExtended" ]; then phpenv config-rm xdebug.ini || :; fi;
- if [ -z "$dependencies" ]; then composer install --prefer-dist; fi;
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-dist -n; fi;
- if [ "$dependencies" = "highest" ]; then composer update --prefer-dist -n; fi;
- composer show

## Run the actual test
script: make ci
script:
- if [ -z "$qaExtended" ]; then make ci; fi;
- if [ "$qaExtended" = "true" ]; then make ci-extended; fi;

## Gather coverage and set it to coverage servers
after_script: make ci-coverage
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ all-coverage:
ci:
composer run-script qa-ci --timeout=0

ci-with-coverage:
composer run-script qa-ci-coverage --timeout=0
ci-extended:
composer run-script qa-ci-extended --timeout=0

contrib:
composer run-script qa-contrib --timeout=0
Expand Down
35 changes: 20 additions & 15 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
build: false
platform:
- x64
clone_folder: c:\projects\php-api-client

clone_folder: c:\projects\php-project-workspace

## Build matrix for lowest and highest possible targets
environment:
matrix:
- dependencies: lowest
php_ver_target: 7.0
- dependencies: lowest
php_ver_target: 7.1
- dependencies: current
php_ver_target: 7.0
- dependencies: current
php_ver_target: 7.1
- dependencies: highest
php_ver_target: 7.0
- dependencies: highest
php_ver_target: 7.1

## Cache composer bits
## Cache composer file
cache:
- c:\tools\php -> appveyor.yml
- c:\projects\php-api-client\vendor -> composer.lock
- '%LOCALAPPDATA%\Composer\files -> composer.lock'

## Set up environment varriables
Expand All @@ -27,8 +33,7 @@ init:
## Install PHP and composer, and run the appropriate composer command
install:
- IF EXIST c:\tools\php (SET PHP=0)
- IF %PHP%==1 cinst -y OpenSSL.Light
- IF %PHP%==1 cinst -y php
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
- cd c:\tools\php
- IF %PHP%==1 copy php.ini-production php.ini /Y
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
Expand All @@ -37,14 +42,14 @@ install:
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\projects\php-api-client
- IF %dependencies%==lowest composer update --prefer-lowest --no-progress -n
- IF %dependencies%==current composer install --no-progress
- IF %dependencies%==highest composer update --no-progress -n
- composer show -i
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\projects\php-project-workspace
- IF %dependencies%==lowest appveyor-retry composer update --prefer-lowest --no-progress --profile -n
- IF %dependencies%==current appveyor-retry composer install --no-progress --profile
- IF %dependencies%==highest appveyor-retry composer update --no-progress --profile -n
- composer show

## Run the actual test
test_script:
- cd c:\projects\php-api-client
- composer qa-ci-windows
- cd c:\projects\php-project-workspace
- vendor/bin/phpunit -c phpunit.xml.dist
14 changes: 9 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "api-clients/test-utilities",
"description": "Test utilities for api-clients packages",
"license": "MIT",
"authors": [
{
Expand Down Expand Up @@ -29,17 +30,20 @@
"require-dev": {
},
"config": {
"sort-packages": true
"sort-packages": true,
"platform": {
"php": "7.0"
}
},
"scripts": {
"ensure-installed": "composer install --ansi -n -q",
"cs": [
"@ensure-installed",
"php-cs-fixer fix --config=.php_cs --path-mode=intersection --dry-run --verbose --allow-risky=yes --show-progress=estimating"
"php-cs-fixer fix --config=.php_cs --ansi --dry-run --diff --verbose --allow-risky=yes --show-progress=estimating"
],
"cs-fix": [
"@ensure-installed",
"php-cs-fixer fix --config=.php_cs --verbose --diff --allow-risky=yes --show-progress=estimating"
"php-cs-fixer fix --config=.php_cs --ansi --verbose --allow-risky=yes --show-progress=estimating"
],
"unit": [
"@ensure-installed",
Expand Down Expand Up @@ -69,9 +73,9 @@
"@unit"
],
"qa-ci": [
"@qa-all"
"@unit"
],
"qa-ci-coverage": [
"qa-ci-extended": [
"@qa-all-coverage"
],
"qa-ci-windows": [
Expand Down

0 comments on commit 45dfddc

Please sign in to comment.