Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Phing with Composer scripts #11

Merged
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
23 changes: 10 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,31 @@ jobs:
- name: Install lowest CaptainHookPHP version
if: matrix.composer-prefer-lowest == true
run: |
composer remove --dev captainhook/plugin-composer
composer remove --dev captainhook/plugin-composer bitexpert/captainhook-infection
composer remove captainhook/captainhook
composer require --prefer-lowest captainhook/captainhook
composer require --prefer-lowest --dev captainhook/plugin-composer

- name: Linting code
run: ./vendor/bin/phing lint
composer require --prefer-lowest --dev captainhook/plugin-composer bitexpert/captainhook-infection

- name: Codesniffer
run: ./vendor/bin/phing sniff
run: composer cs-check

- name: Static code analysis
run: ./vendor/bin/phing analyse
run: composer analyze

- name: Unittests
if: matrix.coveralls == false
run: ./vendor/bin/phing unit

- name: Unittests with coverage
if: matrix.coveralls == true
run: ./vendor/bin/phing unit-with-coverage
run: composer test

- name: Infection for added files
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
./vendor/bin/infection -j2 --git-diff-filter=A --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered
./vendor/bin/infection -j4 --git-diff-filter=A --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered

- name: Unittests with coverage
if: matrix.coveralls == true
run: composer coverage

- name: Coveralls report
if: matrix.coveralls == true
Expand Down
57 changes: 0 additions & 57 deletions build.xml

This file was deleted.

70 changes: 62 additions & 8 deletions captainhook.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,63 @@
"enabled": true,
"actions": [
{
"action": "./vendor/bin/phing analyse",
"action": "composer analyze",
"options": []
},
{
"action": "./vendor/bin/phing infection",
"action": "composer test",
"options": []
},
{
"action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction",
"options": {
"args": [
"-j4",
"--ignore-msi-with-no-mutations",
" --only-covered"
]
}
}
]
},
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "./vendor/bin/phing lint",
"options": []
"action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting",
"options": [],
"conditions": [
{
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
"args": ["php"]
}
]
},
{
"action": "./vendor/bin/phing sniff",
"options": []
"action": "composer cs-check {$STAGED_FILES|of-type:php|separated-by: }",
"options": [],
"conditions": [
{
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
"args": ["php"]
}
]
},
{
"action": "./vendor/bin/phing unit",
"options": []
"action": "\\bitExpert\\CaptainHook\\Infection\\InfectionAction",
"options": {
"args": [
"-j4",
"--ignore-msi-with-no-mutations",
" --only-covered"
]
},
"conditions": [
{
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
"args": ["php"]
}
]
}
]
},
Expand All @@ -52,5 +86,25 @@
"post-merge": {
"enabled": false,
"actions": []
},
"post-change": {
"enabled": true,
"actions": [
{
"action": "composer install",
"options": [],
"conditions": [
{
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\Any",
"args": [
[
"composer.json",
"composer.lock"
]
]
}
]
}
]
}
}
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"captainhook/plugin-composer": "^5.2",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.5",
"phing/phing": "^2.16",
"phpstan/phpstan": "^0.12",
"roave/security-advisories": "dev-latest",
"infection/infection": "^0.21.0"
"infection/infection": "^0.21.0",
"bitexpert/captainhook-infection": "^0.1.0"
},
"autoload": {
"psr-4": {
Expand All @@ -38,8 +38,11 @@
"@cs-check",
"@test"
],
"cs-check": "vendor/bin/phing sniff",
"cs-check": "vendor/bin/phpcs --standard=PSR2 ./src ./tests",
"cs-fix": "vendor/bin/phpcbf",
"test": "vendor/bin/phing unit"
"analyze": "vendor/bin/phpstan analyze",
"test": "vendor/bin/phpunit",
"infection": "vendor/bin/infection -j4 --ignore-msi-with-no-mutations --only-covered",
"coverage": "vendor/bin/phpunit --coverage-clover clover.xml"
}
}
151 changes: 52 additions & 99 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.