Speeding Up Crystal CI/CD: Fast Drafts, Optimized Builds

I have started working on a production web application built with Crystal and Marten. With every new feature I add to the project, the compilation time keeps growing—almost exponentially. I found that waiting 50 minutes to build an image isn't worth it for quick experiments. I realized I don't need full performance for development builds. Here's my view on how I can address the problem: I'd like to introduce a "draft" image that builds in around 3 minutes and is ready for deployment—it even starts deploying to the production clusters. After that, it would trigger a "pristine" build with all optimizations enabled, which might take 60 minutes. If a new build is triggered in the meantime, the pristine build is cancelled and replaced by the most recent one job. With this approach, I can still build and test quickly, while eventually delivering a highly optimized version for better performance.

May 2, 2025 - 21:38
 0
Speeding Up Crystal CI/CD: Fast Drafts, Optimized Builds

I have started working on a production web application built with Crystal and Marten.
With every new feature I add to the project, the compilation time keeps growing—almost exponentially.

I found that waiting 50 minutes to build an image isn't worth it for quick experiments. I realized I don't need full performance for development builds.

Here's my view on how I can address the problem:

I'd like to introduce a "draft" image that builds in around 3 minutes and is ready for deployment—it even starts deploying to the production clusters.

After that, it would trigger a "pristine" build with all optimizations enabled, which might take 60 minutes.

Man in front of north lights

If a new build is triggered in the meantime, the pristine build is cancelled and replaced by the most recent one job.

With this approach, I can still build and test quickly, while eventually delivering a highly optimized version for better performance.