Skip to content

Commit aa261b9

Browse files
committed
QA config
1 parent bbe3aa3 commit aa261b9

File tree

9 files changed

+332
-0
lines changed

9 files changed

+332
-0
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.json]
11+
indent_size = 2
12+
13+
[Makefile]
14+
indent_style = tab

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ignoring files for distribution archieves
2+
examples/ export-ignore
3+
tests/ export-ignore
4+
.travis.yml export-ignore
5+
.gitignore export-ignore
6+
.gitattributes export-ignore
7+
.scrutinizer.yml export-ignore
8+
phpunit.xml.dist export-ignore

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

.php_cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php declare(strict_types=1);
2+
3+
use ApiClients\Tools\TestUtilities\PhpCsFixerConfig;
4+
use PhpCsFixer\Config;
5+
6+
return (function (): Config
7+
{
8+
$paths = [
9+
__DIR__ . DIRECTORY_SEPARATOR . 'src',
10+
__DIR__ . DIRECTORY_SEPARATOR . 'tests',
11+
];
12+
13+
return PhpCsFixerConfig::create()
14+
->setFinder(
15+
PhpCsFixer\Finder::create()
16+
->in($paths)
17+
->append($paths)
18+
)
19+
->setUsingCache(false)
20+
;
21+
})();

.scrutinizer.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
filter:
2+
paths: [src/*]
3+
excluded_paths: [examples/*, tests/*]
4+
tools:
5+
external_code_coverage: true
6+
php_analyzer: true
7+
php_hhvm: true
8+
php_sim: true
9+
php_pdepend: true
10+
sensiolabs_security_checker: true
11+
php_changetracking: true
12+
php_code_sniffer:
13+
enabled: true
14+
config:
15+
tab_width: 0
16+
encoding: utf8
17+
ruleset: ~
18+
standard: "PSR2"
19+
php_cs_fixer:
20+
enabled: true
21+
config:
22+
level: psr2
23+
php_mess_detector:
24+
enabled: true
25+
config:
26+
ruleset: ~
27+
code_size_rules:
28+
cyclomatic_complexity: true
29+
npath_complexity: true
30+
excessive_method_length: true
31+
excessive_class_length: true
32+
excessive_parameter_list: true
33+
excessive_public_count: true
34+
too_many_fields: true
35+
too_many_methods: true
36+
excessive_class_complexity: true
37+
design_rules:
38+
exit_expression: true
39+
eval_expression: true
40+
goto_statement: true
41+
number_of_class_children: true
42+
depth_of_inheritance: true
43+
coupling_between_objects: true
44+
unused_code_rules:
45+
unused_private_field: true
46+
unused_local_variable: true
47+
unused_private_method: true
48+
unused_formal_parameter: true
49+
naming_rules:
50+
short_variable:
51+
minimum: 3
52+
long_variable:
53+
maximum: 20
54+
short_method:
55+
minimum: 3
56+
constructor_conflict: true
57+
constant_naming: true
58+
boolean_method_name: true
59+
controversial_rules:
60+
superglobals: true
61+
camel_case_class_name: true
62+
camel_case_property_name: true
63+
camel_case_method_name: true
64+
camel_case_parameter_name: true
65+
camel_case_variable_name: true
66+
checks:
67+
php:
68+
code_rating: true

.travis.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
language: php
2+
3+
## Cache composer bits
4+
cache:
5+
directories:
6+
- $HOME/.composer/cache/files
7+
8+
## Build matrix for lowest and highest possible targets
9+
matrix:
10+
include:
11+
- php: 7.1
12+
env:
13+
- qaExtended=true
14+
- php: 7.2
15+
env:
16+
- dropPlatform=false
17+
- php: 7.3snapshot
18+
env:
19+
- dropPlatform=false
20+
dist: xenial
21+
sudo: required
22+
addons:
23+
apt:
24+
packages:
25+
- libzip4
26+
- php: 7.3.0RC1
27+
env:
28+
- dropPlatform=false
29+
dist: xenial
30+
sudo: required
31+
addons:
32+
apt:
33+
packages:
34+
- libzip4
35+
- php: nightly
36+
env:
37+
- dropPlatform=false
38+
- php: 7.1
39+
env:
40+
- dependencies=lowest
41+
- dropPlatform=false
42+
- php: 7.2
43+
env:
44+
- dependencies=lowest
45+
- dropPlatform=false
46+
- php: 7.3snapshot
47+
env:
48+
- dependencies=lowest
49+
- dropPlatform=false
50+
dist: xenial
51+
sudo: required
52+
addons:
53+
apt:
54+
packages:
55+
- libzip4
56+
- php: 7.3.0RC1
57+
env:
58+
- dependencies=lowest
59+
- dropPlatform=false
60+
dist: xenial
61+
sudo: required
62+
addons:
63+
apt:
64+
packages:
65+
- libzip4
66+
- php: nightly
67+
env:
68+
- dependencies=lowest
69+
- dropPlatform=false
70+
- php: 7.1
71+
env:
72+
- dependencies=highest
73+
- dropPlatform=false
74+
- php: 7.2
75+
env:
76+
- dependencies=highest
77+
- dropPlatform=false
78+
- php: 7.3snapshot
79+
env:
80+
- dependencies=highest
81+
- dropPlatform=false
82+
dist: xenial
83+
sudo: required
84+
addons:
85+
apt:
86+
packages:
87+
- libzip4
88+
- php: 7.3.0RC1
89+
env:
90+
- dependencies=highest
91+
- dropPlatform=false
92+
dist: xenial
93+
sudo: required
94+
addons:
95+
apt:
96+
packages:
97+
- libzip4
98+
- php: nightly
99+
env:
100+
- dependencies=highest
101+
- dropPlatform=false
102+
103+
## Install or update dependencies
104+
install:
105+
- composer validate
106+
- if [ -z "$dropPlatform" ]; then composer config --unset platform.php; fi;
107+
- if [ -z "$qaExtended" ]; then phpenv config-rm xdebug.ini || :; fi;
108+
- if [ -z "$dependencies" ]; then composer install --prefer-dist; fi;
109+
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-dist -n; fi;
110+
- if [ "$dependencies" = "highest" ]; then composer update --prefer-dist -n; fi;
111+
- composer show
112+
113+
## Run the actual test
114+
script:
115+
- if [ -z "$qaExtended" ]; then make ci; fi;
116+
- if [ "$qaExtended" = "true" ]; then make ci-extended; fi;
117+
118+
## Gather coverage and set it to coverage servers
119+
after_script: if [ "$qaExtended" = "true" ]; then make ci-coverage; fi;

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
all:
2+
composer run-script qa-all --timeout=0
3+
4+
all-coverage:
5+
composer run-script qa-all-coverage --timeout=0
6+
7+
ci:
8+
composer run-script qa-ci --timeout=0
9+
10+
ci-extended:
11+
composer run-script qa-ci-extended --timeout=0
12+
13+
contrib:
14+
composer run-script qa-contrib --timeout=0
15+
16+
init:
17+
composer ensure-installed
18+
19+
cs:
20+
composer cs
21+
22+
cs-fix:
23+
composer cs-fix
24+
25+
unit:
26+
composer run-script unit --timeout=0
27+
28+
unit-coverage:
29+
composer run-script unit-coverage --timeout=0
30+
31+
ci-coverage: init
32+
composer ci-coverage

appveyor.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
build: false
2+
platform:
3+
- x64
4+
clone_folder: c:\projects\php-project-workspace
5+
6+
## Build matrix for lowest and highest possible targets
7+
environment:
8+
matrix:
9+
- dependencies: lowest
10+
php_ver_target: 7.1
11+
- dependencies: lowest
12+
php_ver_target: 7.2
13+
- dependencies: current
14+
php_ver_target: 7.1
15+
- dependencies: current
16+
php_ver_target: 7.2
17+
- dependencies: highest
18+
php_ver_target: 7.1
19+
- dependencies: highest
20+
php_ver_target: 7.2
21+
22+
## Cache composer file
23+
cache:
24+
- '%LOCALAPPDATA%\Composer\files -> composer.lock'
25+
26+
## Set up environment varriables
27+
init:
28+
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
29+
- SET COMPOSER_NO_INTERACTION=1
30+
- SET PHP=1
31+
- SET ANSICON=121x90 (121x90)
32+
33+
## Install PHP and composer, and run the appropriate composer command
34+
install:
35+
- IF EXIST c:\tools\php (SET PHP=0)
36+
- 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|]','')
37+
- cd c:\tools\php
38+
- IF %PHP%==1 copy php.ini-production php.ini /Y
39+
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
40+
- IF %PHP%==1 echo extension_dir=ext >> php.ini
41+
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
42+
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
43+
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
44+
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
45+
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
46+
- cd c:\projects\php-project-workspace
47+
- composer config --unset platform.php
48+
- IF %dependencies%==lowest appveyor-retry composer update --prefer-lowest --no-progress --profile -n
49+
- IF %dependencies%==current appveyor-retry composer install --no-progress --profile
50+
- IF %dependencies%==highest appveyor-retry composer update --no-progress --profile -n
51+
#- composer show
52+
53+
## Run the actual test
54+
test_script:
55+
- cd c:\projects\php-project-workspace
56+
- vendor/bin/phpunit -c phpunit.xml.dist

phpunit.xml.dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php" colors="true">
3+
<testsuites>
4+
<testsuite name="Test Suite">
5+
<directory>tests/</directory>
6+
</testsuite>
7+
</testsuites>
8+
<filter>
9+
<whitelist>
10+
<directory suffix=".php">src/</directory>
11+
</whitelist>
12+
</filter>
13+
</phpunit>

0 commit comments

Comments
 (0)