Drop unneeded steps in CI

This might seem pretty obvious, but it's easy to forget to remove steps from your CI pipeline when they are no longer needed.

Joel Clermont
Joel Clermont

On one of our projects, the CI pipeline had crept up to around 7 - 8 minutes on average. While this isn't terrible (I've definitely heard of much worse), it's less than ideal, so we took some time to see how fast we could get it.

Just as with local development, we use Docker and Docker Compose in our CI pipelines. This helps keep things consistent between the two environments.

But looking at the logs for our Github Actions runner, we could see that the longest-running task was building and starting our containers. There were also two setup tasks to install the necessary tooling to generate a certificate which came in as a close second and third.

We definitely like using certificates in local development, so that we're interacting with the site the same way users will in production, but did we actually need this in CI? Not really. We're not using any Dusk tests on this project, so there was nothing "browser-like" running in CI.

Dropping those two set up tasks to install mkcert and generate a certificate shaved almost 2 minutes off the pipeline!

Next, we looked at the Docker containers defined in our docker-compose.yml file, and realized that by the same logic, we didn't need to build and spin up nginx, horizon, or php-fpm-debug containers either. That saved almost another minute in Docker build time.

Now things are looking pretty good! But we're not done. Stay tuned for a future tip on how we shaved almost one more minute off our pipeline with a fairly minor change.

Here to help,


P.S. Ever wonder if your Laravel app could be more secure? Download our free book for 7 steps to review.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼

Level up your Laravel skills!

Each 2-minute email has real-world advice you can use.