Skip to content
This repository has been archived by the owner on Dec 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #26 from shochdoerfer/feature/rework_dev_tooling
Browse files Browse the repository at this point in the history
Replace Phing with Composer scripts
  • Loading branch information
shochdoerfer authored Jan 30, 2021
2 parents fb9207d + 4790fea commit 19cdd14
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 179 deletions.
29 changes: 13 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,34 @@ jobs:
- name: Install Composer dependencies
run: composer install

- name: Linting code
run: ./vendor/bin/phing lint

- name: Codesniffer
run: ./vendor/bin/phing sniff

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

- name: Magerun
- name: Install Magerun
if: matrix.coveralls == false
run: |
wget https://files.magerun.net/n98-magerun2-latest.phar
mkdir -p ~/.n98-magerun2/modules
ln -s $(pwd) ~/.n98-magerun2/modules/magerun2-list-api-endpoints
php n98-magerun2-latest.phar help api:list:endpoints
- name: Codesniffer
run: composer cs-check

- name: Static code analysis
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 @@ -29,14 +29,14 @@
"n98/magerun2": "^4.0.0",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.5",
"phing/phing": "^2.16",
"phpstan/phpstan": "^0.12.68",
"captainhook/captainhook": "^5.4",
"captainhook/plugin-composer": "^5.2",
"bitexpert/phpstan-magento": "^0.6.0",
"phpstan/extension-installer": "^1.1",
"roave/security-advisories": "dev-latest",
"infection/infection": "^0.21.0"
"infection/infection": "^0.21.0",
"bitexpert/captainhook-infection": "^0.1.0"
},
"repositories": [
{
Expand All @@ -59,8 +59,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"
}
}
Loading

0 comments on commit 19cdd14

Please sign in to comment.