Skip to content

GitLab CI for Drupal 11+

Since 2022 Drupal.org provide a great GitLab CI integration, this project was created before and is not related to the official Drupal way of using GitLab CI with a Drupal.org module or theme.
If you are looking for Drupal.org GitLab CI see GitLab Templates.
This project aim to provide a GitLab CI quick setup if you do not host your code on drupal.org.

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

What version to use

Drupal core GitLab CI for Drupal
Drupal ^10+ 4.x-dev
Drupal ^11 11.x-dev

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