wunderio / drupal-gitlab-local-pipelines

Use GrumPHP to run the same rules as Drupal Gitlab Pipelines does for faster feedback loop.
0 stars 0 forks source link

Notes on how Gitlab tests could be run locally with GrumPHP #1

Open hkirsman opened 1 week ago

hkirsman commented 1 week ago

== Problem

Gitlab pipelines is great way of getting modules in shape but many modules are out of shape or it's not installed at all. Then after you have everything set up, it's impossible to fix 600+ issues by looking at the log of pipelines. Let's do much of the checks locally by using GrumPHP which would also be ableo to run on the staged code.

== Solution?

  1. Use GrumPHP

  2. Can we make things run in Docker so developers env would not matter? Something like this could be used to install the dev dependencies of the module with our custom image (not yet published) docker run -v "$(pwd)":/app php82-custom composer install

Executing PHP with Docker seems also to work. Based on this information https://project.pages.drupalcode.org/gitlab_templates/jobs/phpcs/ an example grumphp.yml

grumphp:
  git_hook_variables:
    EXEC_GRUMPHP_COMMAND: "docker run -v \"$(pwd)\":/app php82-custom php"
  ascii:
    failed: ~
    succeeded: ~
  tasks:
    phpcs:
      standard: "vendor/drupal/coder/coder_sniffer/Drupal/ruleset.xml"
      triggered_by: [php,inc,module,install,info,test,profile,theme]
  1. Create composer package developers can add as dev requirement for their project?
hkirsman commented 1 week ago

Proof that phpcs works exactly the same as on GitLab: 2024-07-01_12-22