This is part 1 of a series on having CI pipelines for your Drupal site, and building Drupal Deploy Confidence.

You might find it strange that the first part is about composer install. Or maybe you find it weird to mention at all, since all steps will inherently need to do this at some point. Well in that case I will point out that the goal here is to make sure no one has an excuse to not have a CI pipeline. And guess what? Having a pipeline that runs composer install is infinitely better than having no CI pipeline. You can imagine the feeling going from no checks to this for the first time?

1 checks passed on a github PR

We will get back to having composer install as parts of running tests and linting, but for now let's dwell a bit about what we have here and why. You see, composer as a dependency manager is a tool, and the tool will gladly do what you tell it to do. So if you (or a developer on your team) told it to upgrade all dependencies it would. In many cases that could be totally fine. But this could in fact also bump other requirements like PHP versions or PHP extensions. Awkwardly, a worst case outcome could in fact be that a deployment to the production environment went wrong, for example with a message like:

Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.3.0”.

There are several variations of that, plus other things that could go wrong.

So if you ever experienced that error, there is in fact a very simple solution: Add a pipeline to your project that mirrors your production PHP version, and simply have a test for composer install! Just like this article suggests.

Direct link to pipeline for Bitbucket: https://bitbucket.org/eirikmorland/drupal-confidence/src/part-1/bitbucket-pipelines.yml
Direct link to pipeline for GitLab: https://gitlab.com/eiriksm/drupal-confidence/-/blob/part-1/.gitlab-ci.yml?ref_type=heads
Direct link to pipeline for GitHub: https://github.com/eiriksm/drupal-confidence/blob/part-1/.github/workflows/test.yml

If this article means you went from no pipelines or tests to exactly one: Congratulations! Let's celebrate this with a gif from the times long before the times of composer.