• Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    Shell
  • License
    GNU General Publi...
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Command Line Interface for implementing Continuous Integration in Drupal 9

Drupal 9 CI

Test Create release Publish Docker image codecov

This repository provides the foundation to implement Continuous Integration in a Drupal 9 project using any of the following CI providers:

If you want to test an individual module instead of a Drupal project, see Andrew Berry's drupal_tests.

Here is a clip that shows how it works for CircleCI.

Requirements

The scripts assume that you have a Drupal 9 project created using drupal-project, which sets a well known foundation. If your project's directory structure differs from what drupal-project sets up, you will need to adjust the CI scripts.

It's also recommended to adjust your project to add a subset of the settings.php file into version control and rely on settings.local.php for setting the database connection. The CI scripts have their own settings.local.php which is copied at build time into web/sites/default.

DocumentRoot: web vs docroot

By default, Apache and the rest of the code is set up to have the DocumentRoot folder as web. If your project uses docroot instead, the easiest thing to do is to symlink one to the other. This can be done adding a line like this one before running Apache (you will need to adapt paths).

Alternatively you can go through the files and replace as needed. You can see a list of affected files in this comment.

Installation

CircleCI

Demo repository | Deep dive article

Download the drupal9ci binary from https://github.com/Lullabot/drupal9ci/releases into the project root and run the command as ./drupal9ci and select CircleCI. Once complete, continue below to complete the setup.

Sign up at CircleCI and allow access to your project's repository.

CircleCI watch

Happy CI-ing! :-D. From now every time you create a pull request, CircleCI will run the set of jobs and report their result like in the following screenshot:

CircleCI pull request

For an overview of the CircleCI features, have a look at this article from the Lullabot blog.

Using a custom Docker image

The CircleCI configuration file uses a custom Docker image that extends from the official Drupal image. If this image does not fit your project's architecture then consider creating your own image based out of it.

Travis CI

Demo repository | Deep dive article

Download the drupal9ci binary from https://github.com/Lullabot/drupal9ci/releases into the project root and run the command as ./drupal9ci and select Travis CI. Once complete, continue below to complete the setup.

Sign up at Travis CI and allow access to your project's repository:

Travis watch

Happy CI-ing! :-D. From now on every pull request will trigger a build in Travis and its progress will be visible like in the following screenshot:

Travis pull request

For you to see the result of the individual jobs, you need to click at the Details link from the above screenshot:

Travis CI jobs

Setting up code coverage reports

Coveralls.io is a third party tool that can host and present PHPUnit code coverage reports in a neat way within a pull request. Here is how to set it up:

Register at https://coveralls.io using your GitHub account and then add your repository like in the following screenshot:

Coveralls add repository

Then take the chance to adjust a couple settings to get cleaner feedback in pull requests:

Coveralls settings

That's it! Here is a sample report which you can see by clicking at Details at the pull request's status message:

Coveralls report

GitLab CI

Demo repository | Deep dive article

Download the drupal9ci binary from https://github.com/Lullabot/drupal9ci/releases into the project root and run the command as ./drupal9ci and select GitLab CI. Once complete, continue below to complete the setup.

Review, commit, and push the resulting changes. After doing that, navigate to the project's homepage at GitLab and open the CI / CD >> Pipelines section. You should see a running pipeline like the following one:

GitLab pipeline

GitHub Actions

Demo repository

Download the drupal9ci binary from https://github.com/Lullabot/drupal9ci/releases into the project root and run the command as ./drupal9ci and select GitHub Actions. Once complete, continue below to complete the setup.

Review, commit, and push the resulting changes. After doing that, navigate to the repository's homepage at GitHub and open the Actions tab. You should see a running workflow like the following one:

Github actions

Bitbucket

Download the drupal9ci binary from https://github.com/Lullabot/drupal9ci/releases into the project root and run the command as ./drupal9ci and select Bitbucket. Once complete, continue below to complete the setup.

Review, commit, and push the resulting changes. After doing that, navigate to the repository's homepage at Bitbucket and open the Pipelines tab. You should see a running workflow like the following one:

Bitbucket pipelines

Setting up the Behat and Cypress jobs for all platforms

The Behat and Cypress jobs require a running Drupal 9 site. The repository contains the code, but for running tests in a realistic environment you need:

1. A recent copy of the production environment's database

There are several ways to accomplish this:

Using a prepopulated Docker database image

See Achieve Rocketship-Fast Jobs in CircleCI by Preinstalling the Database

Travis

If you have Drush site aliases, and your repository is private, then follow these instructions to add an SSH key. Next, set up a drush site alias. Finally, adjust the Behat job to run drush @my.alias sql-cli.

CircleCI

If you have Drush site aliases, then at the CircleCI dashboard go to the project's permissions and add an SSH key. Next, add drush @my.alias sql-cli to the Behat job at .circleci/config.yml.

Alternative

Alternatively, upload a sanitized database dump somewhere and set up the DB_DUMP_URL environment variable so the job can download it.

For example: Travis CI db env var CircleCI database via environment variable

A sample implementation is to use Dropbox API. See this repository for further details.

2. The production environment's files directory

If you have a site alias, then add drush rsync @my.alias @self to the Behat job. Alternatively, use Stage File Proxy module.

More Repositories

1

amp-library

Convert HTML to AMP HTML and report HTML compliance with the AMP HTML specification
PHP
382
star
2

drupal-boilerplate

Boilerplate project for drupal development
PHP
197
star
3

jenkins_github_drupal

Create a Drupal site from a new Pull Request on Github with Jenkins
Shell
87
star
4

github-pm

Example project for an article about managing your project with GitHub.
72
star
5

lmm

A set of scripts for branching and switching active MySQL databases using LVM.
Shell
61
star
6

copelandia

PHP
56
star
7

casperjs_foundation

Basic foundation to write CasperJS tests within a project
JavaScript
43
star
8

nginx-drupal

Nginx Drupal configuration
41
star
9

storybook-drupal-addon

Storybook addon to facilitate integrating Storybook with Drupal projects.
TypeScript
40
star
10

fivefifteen

πŸ“ AngularJs app to help with my weekly report.
JavaScript
37
star
11

React-Redux-Boilerplate

React Redux Boilerplate
JavaScript
34
star
12

drainpipe

PHP
32
star
13

trusty32-lamp

An Ubuntu 14.04 VM for PHP with built in profiling
Ruby
32
star
14

react_form

React form example
JavaScript
32
star
15

windup

A Drupal starter theme
HTML
26
star
16

olivero-poc

Proof of concept for Olivero theme interactions
CSS
26
star
17

varnish

Lullabot's default Varnish VCL configurations
VCL
26
star
18

drupal_checksheet

PHP
22
star
19

entity-api-demos

Place to house demo code for Drupalize.Me's upcoming Entity API series.
PHP
22
star
20

lullapuppet

This is a public repository of Puppet classes used for setting up servers and VMs.
Ruby
18
star
21

drupal-docker-boilerplate

This is a boilerplate directory structure for new Drupal 8 installs using Docker. It includes a workaround for slow mounted volumes in OSX.
PHP
17
star
22

openldap-schema

16
star
23

custom_layouts

Drupal 8 layouts with configurable classes and titles, code to massage Layout Builder block list categories and titles.
PHP
15
star
24

ddev-playwright

Integrate Playwright tests into your ddev app
Shell
13
star
25

d8_custom_migration

Custom migration code for miscellaneous D8 fields and content
PHP
13
star
26

gatsby-theme-adr

A Gatsby theme to generate a static site for ADRs
TypeScript
12
star
27

rome

A multiple-vm Vagrant environment for LAMP development using Puppet for configuration.
Ruby
10
star
28

awesome-d8

A curated list of amazingly awesome Drupal 8 resources and shiny things.
10
star
29

drupalorg-issues

JavaScript
9
star
30

databasics

Example module showing database manipulation
PHP
8
star
31

drupal_qa_notifier

Drupal.org QA chrome extension
JavaScript
8
star
32

entity_browser_block_layout

Tweaks to make entity browser block easier to use in Layout Builder.
PHP
8
star
33

back-end-tasks-example

Back-end tasks example code repository
7
star
34

robo-acquia

This composer package integrates the Robo task runner with the Acquia Cloud API v2 PHP SDK to facilitate running Acquia CLI tasks either in Robo or Drush.
PHP
7
star
35

copelandia-symfony

Symfony2 client for Copelandia's backend
PHP
6
star
36

mpx-php

A PHP library to access thePlatform's mpx
PHP
6
star
37

navigation

Drupal core new administration navigation
HTML
6
star
38

botwire

A starter kit for HTML wireframes.
CSS
4
star
39

ejectorseat

Ejector Seat module for Drupal
PHP
4
star
40

jenkins-docker-drupal

A demonstration of using Jenkins for Drupal deployments, completely managed with git
PHP
4
star
41

tabled

A plugin designed to enhance the usability and responsiveness of HTML tables on an accessible way.
TypeScript
4
star
42

media_mpx

Integrates lullabot/mpx-php with Drupal 8
PHP
3
star
43

fliparoo

A flipping alternative to carousels
CSS
3
star
44

ddev-node-js-demo

Demo repository for node projects using DDEV
JavaScript
3
star
45

terminus-auth-with-session-cache

A GitHub Action that either logs into Terminus via machine token or securely restores from a previously-authenticated Terminus session
3
star
46

playwright-drupal

Playwright / Drupal integration, supporting fast parallel tests and visual comparisons
JavaScript
3
star
47

block_dashboard

Creates a view that displays an overview of both reusable and nonreusable custom blocks, and where they are used.
PHP
3
star
48

information-security-policy

Github repository for Information Security Policy manual.
CSS
3
star
49

draco_coffee

Demo module to test some Drupal 8 core APIs
PHP
2
star
50

git-series-example

This is a sample repository that will be used for recording the Drupalize.Me Git series.
2
star
51

olivero-tugboat

Repository to allow for visual diffs in Tugboat
PHP
2
star
52

ckeditor_quote

A CKEditor plugin for Drupal 8 to create a quote with text and author
JavaScript
2
star
53

ddev-printenv

A ddev addon to print and obfuscate environment variables
Shell
2
star
54

engineering-values

2
star
55

omgponies

Example jQuery Mobile Phonegap app
Objective-C
2
star
56

drainpipe-dev

PHP
2
star
57

aframe-slideshow

Dave and Jerad's VR Presentation for the 2016 Lullabot Retreat
2
star
58

message_integration

Custom code for Message stack and Swiftmailer to create messages about new/changed nodes and comments and email them to subscribers.
PHP
2
star
59

applenews

A Drupal contrib module to export content to Apple News.
PHP
1
star
60

docker_recipes

Docker Recipes
PHP
1
star
61

lullabot-site-offline

CSS
1
star
62

accessibots

Accessibots website.
PHP
1
star
63

hubot-lb.cm

Hubot plugin for the URL shortener lb.cm
CoffeeScript
1
star
64

drupalize-site-offline

Splash page to display when drupalize.me is offline
CSS
1
star
65

lubot

JavaScript
1
star
66

blue-green-demo

An example of using zfs for blue / green deployments
PHP
1
star
67

github-export

Export issues from Github. Includes saved-search function.
JavaScript
1
star
68

servo

This is a fork of Lullabot Drupal Boilerplate, but with the addition of an installation profile.
PHP
1
star
69

media_manager

** MOVED TO https://www.drupal.org/project/pbs_media_manager on 2020-02-24**
PHP
1
star
70

deploy-example

The repository provides an example for how to push compiled code loclaly to a remote Git repository, such as Pantheon or Acquia.
PHP
1
star
71

namm-wireframes

A repository to show the wireframes only so that we can keep them separate and viewable while working on the styled versions.
CSS
1
star
72

menu-toggle

JS to help build expanding menus
JavaScript
1
star
73

ckeditor_embed_code

A CKEditor plugin and filter for Drupal 8 to safely embed code like an iframe.
JavaScript
1
star
74

okta_login

Okta Login, a module to log in Drupal using an Okta account
PHP
1
star
75

listicle_heading

A CKEditor plugin module for Drupal 8 to create numbered headings
JavaScript
1
star