Lullabot: Continuous Integration for Drupal Support Service 8 with CircleCI

Published on February 14, 2019

Annertech: Annertech: Web Agency of the Year

Annertech: Web Agency of the Year My fingers are trembling typing this. I can’t believe it. This morning everyone in Annertech land is thinking “did that really just happen?” It appears it did, we are the web agency of the year! Last night, to top off the other three awards we won – best arts […]

Flickr: Registration Desk – Tuesday – DrupalCon Dublin 2016

comprock posted a photo: The Drupal community is one of the largest open source communities in the world. We’re developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together in a European city for […]

Flickr: Sprint Lounge – Tuesday – DrupalCon Dublin 2016

comprock posted a photo: The Drupal community is one of the largest open source communities in the world. We’re developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together in a European city for […]

Flickr: Tuesday – DrupalCon Dublin 2016

comprock posted a photo: The Drupal community is one of the largest open source communities in the world. We’re developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together in a European city for […]

Flickr: David & Paul – Scout masters – Wednesday – DrupalCon Dublin 2016

comprock posted a photo: The Drupal community is one of the largest open source communities in the world. We’re developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together in a European city for […]

Flickr: Jam interview – Wednesday – DrupalCon Dublin 2016

comprock posted a photo: The Drupal community is one of the largest open source communities in the world. We’re developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together in a European city for […]

Flickr: Sprinters wanted – Wednesday – DrupalCon Dublin 2016

comprock posted a photo: The Drupal community is one of the largest open source communities in the world. We’re developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together in a European city for […]

Flickr: Sprint Lounge – Wednesday – DrupalCon Dublin 2016

comprock posted a photo: The Drupal community is one of the largest open source communities in the world. We’re developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together in a European city for […]

Leopathu: Dynamic Block Weight in Drupal 8

In such a time, i want to place blocks in sidebar region with the dynamic weight. It means the blocks should render in different position for each page request. I have searched and tried lots of method but unfortunately i can’t find proper method to do that. So i have decided to do that with […]

Agiledrop.com Blog: AGILEDROP: Drupal‘s path from 4.0 to 8.0

Last time we guided you through early beginnings of Drupal. We explained how all started and how first versions of Drupal were made. This time we will look how this open-source content-management framework evolved from its fourth to its latest, eight version. Drupal 4.0 Drupal’s fourth version was released on 15. 6. 2002. It became […]

Flickr: Wednesday – DrupalCon Dublin 2016

comprock posted a photo: The Drupal community is one of the largest open source communities in the world. We’re developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together in a European city for […]

OStatic: Web Publishing and Development: Free Tools Abound

Are you involved in DevOps and web development, or are you aiming to be? If so, you’re probably very aware of many of the tools from the open standards and open source arenas that can make your work easier. Still, these are always spreading out at a fast clip and there are some applications and […]

This article is the first in a series about different Continuous Integration implementations for Drupal Support Service 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 Support Service‘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 Support Service 8 module, check it out—I can present you a single-command installer to get your Drupal Support Service 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 Support Service project to see them in action.

Setup

Here is a clip where I take a vanilla Drupal Support Service 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 Support Service 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:

undefined

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:

undefined

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 Support Service 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:

undefined

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 Support Service 8 project and want to try Continuous Integration with CircleCI? If so, follow the instructions at the Drupal Support Service8CI 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!

Acknowledgements

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.

Source: New feed

REQUEST FOR PROPOSAL

Need a quick project proposal?

Submit the RFP form below and we will send you a project proposal in 48 hours. If you like what you see, we can schedule a call to discuss the project in greater detail.

Step 1 of 2

  • Contact Information

* Subject to reasonable use. Small fixes and updates must be requested one at a time and take no more than 30 minutes. Only mission-critical tasks are addressed on weekends.

Shopping Cart
There are no products in the cart!
Continue Shopping
0