What if there was a Continuous Integration Server that checked branch integration as well? A Continuous Branch Integration Server (CBIS) perhaps?! I’ll use an example to explain, instead of just blabbing about it 😀
Martin, Alice, Bob and Charles are working on project Xavier. Martin works on the main branch, while Alice works on the branch for feature A, Bob on branch B and Charles on branch C.
The main idea is to merge all branches and run the tests on the merged result, checking that nothing went wrong (both in terms of the merge and the running and results of the test).
Therefore, if Martin commits on the main branch, the CBIS:
- Runs tests on the main branch, halting on any errors
- Merges branch M with branch A (MA), halting on any merge conflicts it cannot resolve on its own.
- Runs tests on the MA merge, halting on any errors
- Merges M with branch B… and running tests
- Merges M with branch C… and running tests
- Merges MAB, MAC, MBC, MABC.. and running tests on each merge
Yes, it’s exponential ((2^n) – 1 to be exact, unless I’m mistaken). However the idea is that all this work can be used as forwarning for later, more disastrous and conflicting merges and test failures. The only slight variation is that if a commit is on a feature branch (i.e. not on main), then you go straight to the merge with the main branch (and subsequent merges) skipping the initial merges with the other feature branches. I.E: If there is a commit on branch A, you merge AM, AMB, AMC… and skip AB, AC.. This makes it (2^(n-1)) – 1 instead of (2^n) – 1.
Additionally I was thinking, if someone had to deprecate a method, for instance deprecate find() because search() is so much better, perhaps he does it on a feature branch (branch R, for refactor), while other people (oblivious to this change) work on their own feature branch (branch A, for generic feature A) and keep using find(). If and when branch R gets merged to main, then people on their own branch could start to migrate their code to using the new method search, instead of find. Therefore, perhaps the CBIS could collect the various warnings gathered from the job (merging, compiling (if necessary) and running tests) and show them, allowing the maintainer(s) of the feature branch time to change their code according.
It might be a very extravagant idea, but maybe it could be used. I was considering trying to code up a plugin/something for the Jenkins CI system, but perhaps it goes against Jenkins’ very simple job configuration. Perhaps there are better CI servers in which a configuration such as this one is possible.
Let me know what you think… 😀