Optimize Your Drupal Project with Continuous Integration and Delivery | Attico International

Optimize Your Drupal Project with Continuous Integration and Delivery

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

5 min read
Optimize Your Drupal Project with Continuous Integration and Delivery

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)

CI

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)

CD

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

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:

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

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?

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

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

Automated visual regression checks compare application states across releases to detect unexpected UI changes. Differences are highlighted automatically, allowing teams to identify layout shifts, styling issues, or missing elements before deployment.

Cypress test runs have been integrated into the Azure Pipeline. The developer can see which tests run and which tests fail.

Business benefits of continuous integration and continuous delivery

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:

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.

Article Authors

Alexandra Khvoynitskaya
Alexandra Khvoynitskaya Content Team Lead

Content writer and editor with over a decade of experience in digital marketing. Tech‑addicted. Coffee‑inspired.

Related insights

Let's start with a complimentary consultation

Whether you have a small urgent task, or a large ambitious project, we can help