Skip to content
This repository was archived by the owner on Jul 28, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ git:

before_script:
- composer install

jobs:
include:
- stage: ParallelLint
script: composer lint
script: composer phing lint
- stage: CodeSniffer
script: composer phpcs
script: composer phing phpcs
- stage: PHPStan
script: composer phpstan
script: composer phing phpstan
- stage: Test
install:
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
script:
- composer test
- composer phing test
- php php-coveralls.phar --verbose --config php/tests/.coveralls.yml
cache:
directories:
Expand Down
114 changes: 114 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<project name="Wavevision Point" default="init">


<property name="src" value="php/WavevisionCodingStandard"/>
<property name="tests" value="php/tests"/>
<property name="phpBin" value="php"/>
<property name="codeSnifferExclude" value="*/data/*"/>
<property name="codeSnifferRuleset" value="codesniffer-ruleset.xml"/>
<property name="bin" value="vendor/bin"/>

<target name="check" description="Run lints and tests. Run before every pull request"
depends="rm-cache, lint, cs, phpstan, test"/>
<target name="cs" description="Check code style and fix it if possible" depends="phpcbf, phpcs"/>
<target name="init" description="Initialize project" depends="composer"/>

<target name="rm-cache" description="Clear cache">
<exec executable="rm -rf temp/cache"/>
</target>

<target name="composer" description="Download php dependencies">
<exec
executable="composer"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="install"/>
</exec>
</target>

<target name="lint" description="Check php syntax">
<exec
executable="${bin}/parallel-lint"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="-e"/>
<arg value="${phpBin}"/>
<arg value="${src}"/>
<arg value="${tests}"/>
</exec>
</target>

<target name="phpcbf" description="Fix fixable code style issues">
<exec
executable="${bin}/phpcbf"
logoutput="true"
passthru="true"
checkreturn="false"
>
<arg value="-spn"/>
<arg value="--standard=${codeSnifferRuleset}"/>
<arg value="--extensions=${phpBin}"/>
<arg value="--ignore=${codeSnifferExclude}"/>
<arg value="${src}"/>
<arg value="${tests}"/>
</exec>
</target>

<target name="phpcs" description="Check code style and don't fix it">
<exec
executable="${bin}/phpcs"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="-sp"/>
<arg value="--standard=${codeSnifferRuleset}"/>
<arg value="--extensions=${phpBin}"/>
<arg value="--ignore=${codeSnifferExclude}"/>
<arg value="${src}"/>
<arg value="${tests}"/>
</exec>
</target>

<target name="phpstan" description="Run static analysis">
<exec
executable="${bin}/phpstan"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="analyze"/>
<arg value="${src}"/>
<arg value="--level"/>
<arg value="max"/>
</exec>
</target>

<target name="test" description="Run tests">
<exec
executable="${bin}/phpunit"
logoutput="true"
passthru="true"
checkreturn="true"
>
</exec>
</target>

<target name="test-no-coverage" description="Run tests without coverage">
<exec
executable="${bin}/phpunit"
logoutput="true"
passthru="true"
checkreturn="true"
>
<arg value="--no-coverage"/>
</exec>
</target>


</project>
19 changes: 6 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
}
],
"homepage": "https://github.com/wavevision/coding-standard",
"config": {
"bin-dir": "vendor/bin"
},
"require": {
"php": ">=7.2",
"slevomat/coding-standard": "^5.0"
Expand All @@ -30,25 +33,15 @@
"require-dev": {
"phpunit/phpunit": "^8.3",
"jakub-onderka/php-parallel-lint": "^1.0",
"phpstan/phpstan": "^0.10"
"phpstan/phpstan": "^0.10",
"phing/phing": "^2.16"
},
"suggest": {
"phpstan/phpstan": "PHP Static Analysis Tool - discover bugs in your code without running it!",
"sebastianbergmann/phpunit": "The PHP Unit Testing framework.",
"jakub-onderka/php-parallel-lint": "This tool check syntax of PHP files faster than serial check with fancier output."
},
"scripts": {
"lint": "vendor/bin/parallel-lint -e php php ",
"phpcs": "vendor/bin/phpcs -sp --standard=codesniffer-ruleset.xml --extensions=php php --ignore=*/data/*",
"phpcbf": "vendor/bin/phpcbf -spn --standard=codesniffer-ruleset.xml --extensions=php php --ignore=*/data/*",
"cs": "composer phpcbf ; composer phpcs",
"phpstan": "vendor/bin/phpstan analyse php --level max",
"test": "./vendor/bin/phpunit",
"fix": [
"@lint",
"@cs",
"@phpstan",
"@test"
]
"phing": "phing"
}
}
Loading