How do you setup multi-stage build to run integration tests?

circle.yml

#1

I’d like to run integration tests iff my unit tests pass.
Integration tests will take longer.
In the ideal world, i’d kick off another build after the first one passes.
Barring that, i’d like to maybe treat them as a secondary stage so that I can see one result first, and then another later.

I tried to set that up with deployment step but it’s non-obvious since i want it to be applied to every branch.

Currently, i just have integration tests running after my unit tests in same build, but the time will increase and may become too long
What’s the recommended way to set that up? Is that even possible?


#2

It would be good if there were some sort of flags you can set in circle.yml for each stage that says to skip immediately if previous steps failed.

Besides that, the only thing I can think of is that you could leave some sort of state behind from previous steps. So for example if your unit test fails, it writes a file out called unit_test_failure and then in the integration steps it checks if the unit_test_failure file exists before starting.


#3

If anyone feels like they’ve outgrown Circle because of this exact thing then GO CD lets you have multi-stage builds, but it’s self-hosted. https://www.go.cd

I would like to be able to defer testing some things. Like checking if our vagrant setup still works isn’t something that should increase time to deploy. The current way of doing that would for circle to send a post to itself that starts a separate build. It’s pretty awkward because we’ll just end up with the jenkins saga of blocks of bash instead of first-order ci commands througn yml.


#4