Web News

Lullabot: Continuous Integration for Drupal 8 with CircleCI

Web - Wed, 01/17/2018 - 9:57am

This article is the first in a series about different Continuous Integration implementations for Drupal 8 projects. Each installment will pick a CI technology and go over its pros and cons for implementing the following set of jobs when someone creates a pull request:

  • Run unit and kernel tests.
  • Generate a PHPUnit coverage report.
  • Check Drupal's coding standards.
  • Update the database and run Behat tests.

In this article, we will start with CircleCI, a SaaS platform. Thanks to work initiated by Andrew Berry at drupal_tests—if you maintain a Drupal 8 module, check it out—I can present you a single-command installer to get your Drupal 8 project started with Continuous Integration using CircleCI.

There is a repository that contains the installer script where we are working on the different CI implementations, plus a demo Drupal project to see them in action.


Here is a clip where I take a vanilla Drupal 8 project created with composer-project, I run the installer and commit the files, and when I allow CircleCI to watch the repository I see the jobs running:

Videos require iframe browser support.

For details on how to run the installation script and connect your repository with CircleCI, have a look at the repository's README.

Killer features

Once you have the setup in place, your project will benefit right away from the following features:

Less infrastructure to maintain

When code is pushed to a GitHub repository, CircleCI takes care of spinning up and tearing down containers for each of the jobs that you have defined in the CircleCI configuration file. CircleCI provides a set of pre-built images for you to use on your project but you can use a custom Docker image if you need it. For example, here is the Dockerfile that the installer script uses:

# This is the parent image, located at https://hub.docker.com/_/drupal FROM drupal:8.4-apache # Install libraries and extensions. RUN apt-get update && apt-get install -y \ imagemagick \ libmagickwand-dev \ mariadb-client \ sudo \ vim \ wget \ && docker-php-ext-install mysqli \ && docker-php-ext-install pdo \ && docker-php-ext-install pdo_mysql # Remove the vanilla Drupal project that comes with the parent image. RUN rm -rf /var/www/html/* # Change docroot since we use Composer's drupal-project. RUN sed -ri -e 's!/var/www/html!/var/www/html/web!g' /etc/apache2/sites-available/*.conf RUN sed -ri -e 's!/var/www!/var/www/html/web!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf # Install composer. RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/f3333f3bc20ab8334f7f3dada808b8dfbfc46088/web/installer -O - -q | php -- --quiet RUN mv composer.phar /usr/local/bin/composer # Put a turbo on composer. RUN composer global require hirak/prestissimo # Install XDebug. RUN pecl install xdebug-2.5.5 \ && docker-php-ext-enable xdebug # Install Robo CI. # @TODO replace the following URL by http://robo.li/robo.phar when the Robo team fixes it. RUN wget https://github.com/consolidation/Robo/releases/download/1.1.5/robo.phar RUN chmod +x robo.phar && mv robo.phar /usr/local/bin/robo # Install Dockerize. ENV DOCKERIZE_VERSION v0.6.0 RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ && tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz # Install ImageMagic to take screenshots. RUN pecl install imagick \ && docker-php-ext-enable imagick Status badges

By adding a CircleCI status badge to your project’s README file, you can check whether the main branch is stable or not:


This is useful when creating a new release. If the badge is red, then you need to investigate what’s going on. Beware, there is an open bug in CircleCI that may display the green PASSED badge even when one of the jobs in a workflow has failed. Until this gets fixed, click on the badge to double check that everything passes.

Version control

CircleCI’s jobs live within the project repository under the .circleci directory, which makes it easy to track changes in the jobs and make them evolve along with the project.

Intelligent reporting

CircleCI is intelligent at presenting job artifacts. Here are some screenshots:

Failed tests

By storing test results as artifacts, CircleCI can parse them and present them in the browser:

undefined Links to screenshots taken by Behat

By using the Behat Screenshot extension and storing the screenshots as job artifacts, we can see them as a list of links in the browser:


Here is what we see when we click on the highlighted link above:

undefined Coding standard violations

CircleCI can parse the Code Sniffer report and present a summary of Drupal coding standard violations:

undefined Test coverage reports

By generating an HTML PHPUnit report and exposing it as an artifact, we can see a link to the report at the CircleCI web interface:


The highlighted link above shows the following report which describes how much of the code is covered by tests:

undefined Running CircleCI jobs locally

CircleCI offers a command line interface for running jobs locally. This is a big time saver as it gives you a chance to test and debug a job locally before pushing your changes.

undefined Ready to take off!

Do you have a Drupal 8 project and want to try Continuous Integration with CircleCI? If so, follow the instructions at the Drupal8CI repository and start writing tests and getting the jobs to pass. If you find issues or add improvements, please either post a comment here or contribute them to the repository. Happy CI-ing!

  • Andrew Berry, for teaching me so much about Docker and CircleCI.
  • James Sansbury, for his editorial and technical feedback, plus his Bash-fu.
  • The Draco team at Turner, for allowing me to add continuous integration to their development workflow.
Categories: Web

YouTube star wins damages in landmark 'revenge porn' case - CNET

Webware - Wed, 01/17/2018 - 9:35am
Chrissy Chambers is awarded compensation in a civil case over intimate images posted online without permission.
Categories: Web

YouTube signs NBA's Durant, upping ante with Facebook, Twitter - CNET

Webware - Wed, 01/17/2018 - 9:32am
The Kevin Durant deal is the latest push to attract sports fans eager to watch action on and off the court.
Categories: Web

Leander Lindahl: Acquia Dev Desktop, Drush and Drupal 8.4

Web - Wed, 01/17/2018 - 9:13am
Acquia Dev Desktop, Drush and Drupal 8.4 Leander Lindahl Wed, 01/17/2018 - 15:13
Categories: Web

How weed dispensaries fight for higher awareness through tech - CNET

Webware - Wed, 01/17/2018 - 8:56am
Marijuana businesses need to find creative workarounds to get attention on Google or Facebook, since tech companies still treat them as illegal operations.
Categories: Web

Samsung gives 2018 Winter Olympics athletes a special Note 8 - CNET

Webware - Wed, 01/17/2018 - 8:52am
The company only made around 4,000 of the special-edition phones. Sadly, it looks like you have to be a world-class athlete to get one.
Categories: Web

One of VR's most annoying problems could be solved soon - CNET

Webware - Wed, 01/17/2018 - 8:10am
Trying to navigate a room while wearing a VR headset? A company named Occipital has a self-contained solution to that problem.
Categories: Web

Specbee: Drupal and Google Analytics - How to Create Custom Reports for Drupal Website

Web - Wed, 01/17/2018 - 7:32am
Drupal and Google Analytics - How to Create Custom Reports for Drupal Website
  • By : Ganesh
  • Date :17-01-2018
Categories: Web

OnePlus disables credit card payment after fraud reports - CNET

Webware - Wed, 01/17/2018 - 2:37am
Customers reported suspicious activity on their credit cards after making purchases on OnePlus' website.
Categories: Web

Google photo-matching art app finds twins for CNET staffers - CNET

Webware - Tue, 01/16/2018 - 10:21pm
The latest viral craze matches your photo to works from museums and galleries from 70 countries. We asked CNET staffers to try it out and the results aren't always pretty.
Categories: Web

Agiledrop.com Blog: AGILEDROP: An ever-expanding field of opportunities for Drupal

Web - Tue, 01/16/2018 - 10:15pm
There were five pieces altogether written about ambitious Drupal experiences. Each of them focused on a single subject of what constitutes an ambitious digital experience. In the first part of the series, I did my best to explain what ambitious digital experiences mean. The main conclusion, at least in my opinion, is that experience is much more than just mere content. And ambitious digital experiences should come as natural and intuitive as possible. And be focused on the customers, on the users.    Provide valuable and unique digital experiences I have tried to define the term customer… READ MORE
Categories: Web

MacBook Air. Apple’s best product ever - CNET

Webware - Tue, 01/16/2018 - 8:30pm
The Air is celebrating its 10th anniversary and I'm celebrating the one Apple product that's never let me down.
Categories: Web

Origin PC invites you to gear up and see its etchings - CNET

Webware - Tue, 01/16/2018 - 7:45pm
At CES 2018, the custom system builder showed off new ways to jazz up its systems as well as updates to the hardware.
Categories: Web

Behold Origin PC's flashy laser-etched computers - CNET

Webware - Tue, 01/16/2018 - 7:45pm
Impressive laser-etched or texture-printed panels join the company's Custom Paint options.
Categories: Web

YouTube adds stricter rules for creator ad monetization - CNET

Webware - Tue, 01/16/2018 - 7:43pm
Every video in its elite ad program will be scrutinized by human reviewers, while the bar has been raised for joining the program.
Categories: Web

The first lawsuits to save net neutrality have been filed - CNET

Webware - Tue, 01/16/2018 - 7:10pm
Attorneys general from 22 states are among those suing the FCC, which voted to gut rules protecting the open internet.
Categories: Web

'Solo: A Star Wars Story' synopsis teases Han, Chewie and Lando - CNET

Webware - Tue, 01/16/2018 - 6:21pm
Looks like we'll see the origin of the galactic friendship between Han Solo, Chewbacca and Lando Calrissian.
Categories: Web

'Last Jedi' screenings in Japan let you choose between light, dark sides - CNET

Webware - Tue, 01/16/2018 - 5:43pm
Screenings of the "Star Wars: The Last Jedi" in 4DX offer completely different viewing experiences.
Categories: Web

2018 is the year of the truck at the Detroit Auto Show - Roadshow

Webware - Tue, 01/16/2018 - 5:33pm
A quick spin around some of our favorite four-wheel-drive getabouts.
Categories: Web

The Dodge Demon drag race simulator brings out the competitive beast - Roadshow

Webware - Tue, 01/16/2018 - 5:02pm
We got a simulated taste of a sub-10-second quarter mile at the Detroit Auto Show.
Categories: Web