Skip to content

mogtofu33/gitlab-ci-drupal

Repository files navigation

Gitlab CI for Drupal 9 / 10

Gitlab CI for a Drupal module / theme or full project.

Include Build, Testing, Code quality, Metrics and more...

For any issue, please use the Gitlab-CI project page

Based on an include behavior, ie you don't have to copy all files from this project.

Prerequisites

Documentation

Quick setup

Quick setup for a Drupal module / theme

Push your module / theme to a Gitlab with CI and runners enabled.

Gitlab.com offer some CI pipeline minutes/month on free accounts.

  • Copy starter.gitlab-ci.yml file as a .gitlab-ci.yml at the root of your Drupal module or theme (same level as my_module_or_theme.info.yml file).
  • If your project is not on Gitlab.com, edit the include section et the beginning.
  • Edit the variables and uncomment the section under Override default variables for a module
  • Create and push your branch, see the pipeline running for basic code standard and lint.

External module demo, real module example Content moderation edit notify

For more option and details see the full documentation.

Quick setup for a full Drupal project

Push your project to a Gitlab with CI and runners enabled.

Gitlab.com offer some CI pipeline minutes/month on free accounts.

Assuming your project include a composer.json file from the Drupal project.

  • Copy starter.gitlab-ci.yml file as a .gitlab-ci.yml in your project
  • If you are using Behat you must add your tests in a behat_tests folders at the root of your Drupal project (same level as composer.json file).
    • As a starting point you can look in the behat_tests folder of this project.
  • Put your custom code in the web/modules/custom and web/themes/custom folders of your project.
  • Create and push your branch, see the pipeline running for basic code standard, lint, tests and metrics.

External project demo.

As an example you can check my project on a Drupal template: Drupal project advanced template

For more option and details see the full documentation.


Want some help implementing this on your project? I provide Drupal expertise as a freelance, just contact me.

If you want to support this project, you can:

  • Hire me as a freelance for any Drupal related work
  • Promote me to any company looking for any Drupal related work
  • Help me with testing / documentation / grammar fixes / use cases