These workflows are designed to work in a vendor module scope.
Optional repositories entries. This can be removed once the module is in packagist.
"repositories": [
{
"type": "git",
"url": "https://github.com/nswdpc/ci-files.git"
}
]
If you are not using a tagged nswdpc/ci-files, add the following at the root of the module's composer.json:
{
"prefer-stable": true,
"minimum-stability": "dev"
}
Require the module:
composer require --dev nswdpc/ci-files:^1
Result (version may alter):
"require-dev": {
"nswdpc/ci-files": "1.1.0"
}
For Silverstripe refactoring, a silverstripe-vendormodule should also have the following dev requirements in composer.json. These are not installed by default.
"require-dev": {
"cambis/silverstripe-rector": "^0.5.1",
"syntro/silverstripe-phpstan": "^5"
}
By default, the configuration files will set the directories src
and tests
as the directories to find and update files within. These cannot be changed.
See also workflows
(silverstripe.yml)
This workflow does the following on the pull_request
event:
- Preps the environment
- Checks out the project
- Runs a
composer install
- Runs
php-cs-fixer fix
(see silverstripe.yml) - Commits any changes to the PR's branch (see silverstripe.yml)
- Runs
rector process
(see silverstripe.yml) - Commits any changes to the PR's branch (see silverstripe.yml)
- To skip php-cs-fixer actions, ensure the branch name has
no-cs-fix
in it e.gfeat-myfeature-no-cs-fix
- To skip rector actions, ensure the branch name has
no-rector
in it e.gfeat-myfeature-no-rector
name: Automated tasks
on:
pull_request: null
jobs:
Silverstripe:
name: Run automated code quality workflows
uses: nswdpc/ci-files/.github/workflows/silverstripe.yml@main
(php-cs-fixer.yml)
Process php-cs-fixer steps
name: PHP-CS-Fixer
on:
pull_request: null
jobs:
php-cs-fixer:
name: PHP-CS-Fixer (fix)
uses: nswdpc/ci-files/.github/workflows/php-cs-fixer.yml@main
(rector.silverstripe.yml)
Does everything the silverstripe.yml does in prep, but only processes rector steps
name: Rector
on:
pull_request: null
jobs:
rector:
name: Rector (process)
uses: nswdpc/ci-files/.github/workflows/rector.silverstripe.yml@main
(phpstan.silverstripe.yml)
Does everything the silverstripe.yml does in prep, but only processes phpstan analyse
name: Rector
on:
pull_request: null
jobs:
PHPStan:
name: 'PHPStan (analyse)'
uses: nswdpc/ci-files/.github/workflows/phpstan.silverstripe.yml@main
Ensure directories created via a composer install are not added to VCS. For a Silverstripe vendor module the base entries are:
/vendor/
/public/
/composer.lock
Alongside any other ignore rules you have.