Optimize Your Drupal Project with Continuous Integration and Delivery

How CI/CD Can Speed Up Your Development Cycle, Reduce Risks and Improve Product Quality

letters-role-agile-abstract-abbreviation

Key takeaways


In the fast-paced world of software development, quality at speed is a must to keep up with market and customer demands. Continuous Integration(CI) and Continuous Delivery(CD) methodology can provide the solution for this. CI and CD can help ensure that software components work together and it reduces time to market by enabling builds to be deployed to production environments when needed.

In this article, Attico International will discuss the benefits of CI and CD, their workflow pipeline, and how to implement automated end-to-end testing for Drupal projects. We will also explore the business benefits of CI/CD, such as the reduction of risks, faster release of software and improvement in product quality.

Continuous Integration (CI)

evidence

Continuous integration (CI) helps ensure that software components work together. Integration should be completed frequently; if possible, on an hourly or daily basis.

In a CI practice, developers build, run, and test code on their own workstations before committing code to the version control repository. After changes are made to the repository, new source code quality analysis starts, and if it is successful a chain of events is put into motion. A typical first step in this chain is to build the latest version of the source code. If the build is successful, unit tests are executed. If unit testing succeeds, the build is deployed to test environments where system tests are performed (usually using automated tests, but manual testing is also possible). The team is notified about the status of this process, and a report is delivered via email or chat system to provide details, such as build number, defects, and the number of tests.
If one of the steps above fails, the team fixes defects and commits again.

Continuous Delivery (CD)

Enthusiastic

Continuous delivery (CD) starts when continuous integration ends. CD deploys all code changes in a build to the testing or staging environment. CD makes it possible to release builds to the production environment when needed. Allowing the team to deploy at will, CD effectively reduces time to market.

Before deploying software to production, depending on policies and processes defined by a team of developers and customers the CD process may include performing automated system testing, unit testing (including API testing and load testing), and integration testing. The steps from CI to CD are usually completed automatically, including automated testing. As tests can fail at any level and environment, CI/CD includes a feedback channel to quickly report failures to developers.

CI/CD Workflow Pipeline

evidence

A CI/CD pipeline is a path for delivering a piece of code change from the developer's own workstations to the production site.

This path consists of the following steps:

  • Commit. Developers complete a change, they commit the change to the repository.
  • Build. Source code from the repository is integrated into a build.
  • Test. Automated tests are run against the build.
  • Deploy. The built version is delivered to production.
CI CD workflow pipeline

As more “conventional” software development paradigms have been introduced into Drupal itself (primarily due to Drupal 8’s adoption of Symfony, Composer, and the advancement of the configuration management system) CI/CD is more simple now for Drupal sites and projects than ever.

Real project example

enthusiastic

Test automation is a crucial component of any CI/CD pipeline. The benefits of applying CI/CD cannot be realized if there is a lack of automated testing. There are different types of tests: Unit tests, Integration tests, Functional tests, End-to-End tests.

Below is an example of how we implement automated End-to-End tests to the CI/CD pipeline on the Drupal 9 project. We used the Pantheon WebOps platform as hosting for the Drupal site, Bitbucket as a Git repository, Azure Pipelines as a continuous integration server, and Cypress.io as a testing framework.

Cypress.io is a JavaScript end-to-end testing framework. It is very simple to set up in Drupal and all it needs is the URL of the environment to run tests like a human would, starting at a defined page, navigating and using the site, then confirming all is correct based upon configured success criteria.

End-to-end testing is a type of testing in which a computer emulates user behavior as close to reality as possible.  That is, your web application loads in the browser, then buttons are pressed, links are clicked, the page scrolls, and so on.

What did we get as a result?

evidence

Built-in visual test runner. Cypress runs tests in a unique interactive runner that allows you to see commands as they execute while also viewing the application under test.

test runner
time travel

Time Travel. Cypress takes snapshots as tests run. Hover over commands in the Command Log to see exactly what happened at each step.

Visual regression testing. The first image shows a screenshot created on a test run before deployment.

first

The second image shows a screenshot taken after deployment.

second

The third image shows diff (marked as red) between screenshots.

third

Running tests in CI/CD pipeline. Cypress test runs have been integrated into the Azure Pipeline. The developer can see which tests run and which tests fail.

running cypress tests

Screenshots and Videos when run from the CI/CD pipelinе. It’s possible to view screenshots and videos of failing tests.

article test

Business Benefits of Continuous Integration and Continuous Delivery

enthusiastic

Continuous Integration and Continuous Delivery pipeline is a separate product and costs additional money.  But CI/CD is totally worth it.

The business benefits of continuous delivery include:

Reduction of risks

The major benefit of CI/CD is the ability to identify and resolve issues/problems before being 
moved on to production.

CI/CD lowers the risk to your software, as it is regularly tested and modified. Most errors are discovered prior to production deployment.

Faster release of software

With the help of Continuous Delivery automated deployment cycles, you can track the project’s progress and obtain real-time feedback. Therefore, you will be able to fix any shortcomings as soon as possible. As a result, your product will be deployed much faster to the market to the joy of your customers.

Improvement in product quality

As developers spend less time fixing bugs, they are able to concentrate on research and product improvement. Due to frequent user feedback, a development team can concentrate on the essential features to work on.

Increase in operating flexibility

Continuous small changes can be easily reprioritized, and teams don’t have to wait until the following release cycle.


Continuous Integration and Continuous Delivery are essential tools for any Drupal project. Implementing these practices can reduce risk, speed up deployment and improve product quality. With the help of automated end-to-end testing developers can identify and resolve issues before deploying software to production, ensuring a smoother experience for both the developers and end users.

Interested in implementing CI/CD for your project? Contact us today to learn more about our services and how we can help boost your project’s success.

Contact Us

Contact Attico International today to optimize your website's functionalities and improve user experience.