DEV Community

Discussion on: Do you use caching in your CI/CD pipelines?

vsaw profile image
Valentin Sawadski (he/him) Author

As mentioned, I still would use CI as a final check after PR review is complete, but not on each change in a PR.

For me it's the other way around, I want automatic tests to pass before I review the PR, because developer time is more valuable then CI time.

You can also encourage this with scripts to clean local environment state.

Sure you can clean the git state and and build directory, however this could still mean that developers run different compiler versions, or different HW architecture (Intel vs Apple Silicon), which essentially makes very hard, if not impossible to have reproducible builds and tests. Which is why I prefer having a fast CI setup as gatekeeper and never release anything that has not been built by the CI server.

Thread Thread
codewander profile image

having a fast CI setup as a gatekeeper

I just vote for fast local tests (I would probably wrap git push with an alias that ran unit tests && git push instead and ask everyone to use the alias), along with a final check before merging. If you keep thinking through all the scenarios that make CI tests slower than local dev, you will ultimately notice that there are multiple scenarios where CI will always become the bottleneck in your code workflow. One scenario is when you modify the version of one of your external dependencies. The tests will run quickly locally, but CI will have a busted cache and need to fetch all the dependencies again and possibly upload the new set to a cache. This will happen on a regular basis. Developers will complain that CI can become slow sometimes.