mirror of
https://github.com/opdavies/build-configs.git
synced 2025-03-20 04:00:54 +00:00
feat(drupal): allow for disabling quality checks
For Commerce Kickstart, there are no custom modules so these checks will fail in the CI pipeline.
This commit is contained in:
parent
f58846ef20
commit
696aa5d617
|
@ -73,7 +73,6 @@ final class CreateListOfFilesToGenerate
|
||||||
new TemplateFile(data: 'drupal/.hadolint.yaml', name: '.hadolint.yaml'),
|
new TemplateFile(data: 'drupal/.hadolint.yaml', name: '.hadolint.yaml'),
|
||||||
new TemplateFile(data: 'drupal/Dockerfile', name: 'Dockerfile'),
|
new TemplateFile(data: 'drupal/Dockerfile', name: 'Dockerfile'),
|
||||||
new TemplateFile(data: 'drupal/docker-compose.yaml', name: 'docker-compose.yaml'),
|
new TemplateFile(data: 'drupal/docker-compose.yaml', name: 'docker-compose.yaml'),
|
||||||
new TemplateFile(data: 'drupal/phpstan.neon.dist', name: 'phpstan.neon.dist'),
|
|
||||||
new TemplateFile(data: 'drupal/run', name: 'run'),
|
new TemplateFile(data: 'drupal/run', name: 'run'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -86,8 +85,18 @@ final class CreateListOfFilesToGenerate
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$filesToGenerate->push(new TemplateFile(data: 'drupal/phpcs.xml.dist', name: 'phpcs.xml.dist'));
|
if ($configurationDataDto->php['phpcs'] !== false) {
|
||||||
$filesToGenerate->push(new TemplateFile(data: 'drupal/phpunit.xml.dist', name: 'phpunit.xml.dist'));
|
$filesToGenerate->push(new TemplateFile(data: 'drupal/phpcs.xml.dist', name: 'phpcs.xml.dist'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($configurationDataDto->php['phpstan'] !== false) {
|
||||||
|
$filesToGenerate->push(new TemplateFile(data: 'drupal/phpstan.neon.dist', name: 'phpstan.neon.dist'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($configurationDataDto->php['phpunit'] !== false) {
|
||||||
|
$filesToGenerate->push(new TemplateFile(data: 'drupal/phpunit.xml.dist', name: 'phpunit.xml.dist'));
|
||||||
|
}
|
||||||
|
|
||||||
$filesToGenerate->push(new TemplateFile(
|
$filesToGenerate->push(new TemplateFile(
|
||||||
data: 'drupal/docker-entrypoint-php',
|
data: 'drupal/docker-entrypoint-php',
|
||||||
name: 'docker-entrypoint-php',
|
name: 'docker-entrypoint-php',
|
||||||
|
|
|
@ -59,4 +59,6 @@ final class Config
|
||||||
|
|
||||||
#[Assert\NotBlank]
|
#[Assert\NotBlank]
|
||||||
public ?string $projectRoot;
|
public ?string $projectRoot;
|
||||||
|
|
||||||
|
public array $php;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,13 @@ function ci:test {
|
||||||
|
|
||||||
composer install --quiet --no-progress
|
composer install --quiet --no-progress
|
||||||
|
|
||||||
|
{% if not php.phpcs is same as false %}
|
||||||
test --testdox
|
test --testdox
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if not php.phpcs is same as false and not php.phpstan is same as false %}
|
||||||
quality
|
quality
|
||||||
|
{% endif %}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run a command within the php container.
|
# Run a command within the php container.
|
||||||
|
@ -31,9 +35,11 @@ function cmd {
|
||||||
docker compose exec php "${@}"
|
docker compose exec php "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% if not php.phpcs is same as false %}
|
||||||
function coding-standards {
|
function coding-standards {
|
||||||
cmd phpcs "${@}"
|
cmd phpcs "${@}"
|
||||||
}
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
function composer {
|
function composer {
|
||||||
_exec php composer "${@}"
|
_exec php composer "${@}"
|
||||||
|
@ -65,10 +71,16 @@ function lint:dockerfile {
|
||||||
hadolint/hadolint hadolint --ignore DL3008 --ignore DL3059 -t style "${@}" - < Dockerfile
|
hadolint/hadolint hadolint --ignore DL3008 --ignore DL3059 -t style "${@}" - < Dockerfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% if not php.phpcs is same as false and not php.phpstan is same as false %}
|
||||||
function quality {
|
function quality {
|
||||||
|
{% if not php.phpcs is same as false %}
|
||||||
coding-standards
|
coding-standards
|
||||||
|
{% endif %}
|
||||||
|
{% if not php.phpstan is same as false %}
|
||||||
static-analysis
|
static-analysis
|
||||||
|
{% endif %}
|
||||||
}
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
function start {
|
function start {
|
||||||
cp -v --no-clobber .env.example .env
|
cp -v --no-clobber .env.example .env
|
||||||
|
@ -76,22 +88,28 @@ function start {
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% if not php.phpstan is same as false %}
|
||||||
function static-analysis {
|
function static-analysis {
|
||||||
cmd phpstan --memory-limit=-1 --no-progress "${@}"
|
cmd phpstan --memory-limit=-1 --no-progress "${@}"
|
||||||
}
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
function stop {
|
function stop {
|
||||||
docker compose down
|
docker compose down
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{% if not php.phpunit is same as false %}
|
||||||
function test {
|
function test {
|
||||||
_exec php phpunit --colors=always "${@}"
|
_exec php phpunit --colors=always "${@}"
|
||||||
}
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
function test:commit {
|
function test:commit {
|
||||||
|
{% if not php.phpunit is same as false %}
|
||||||
test --testdox --testsuite functional
|
test --testdox --testsuite functional
|
||||||
test --testdox --testsuite kernel
|
test --testdox --testsuite kernel
|
||||||
test --testdox --testsuite unit
|
test --testdox --testsuite unit
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
quality
|
quality
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue