Generally, In CI we do all steps like build/test, etc on the branch.
What if the CI actually does this:
- checkout main
- if the target branch is not main:
- fetch the branch from origin
- merge the branch into main (no push to origin)
- perform all other steps on this merge
This will lead to these benefits: 1- If parallel works would lead to build/test failures, there's a much higher chance of knowing this before merging
2- If there are merge conflicts, the author would know earlier. This can be a benefit or drawback depending on how each team works
3- If the build artifacts are used in any other process (like a manual or automatic E2E test), they better reflect what can be expected after the PR is merged.
My questions: a. is this a practice done by some teams? If not, is there any reason?
b. Are there other benefits or drawbacks for this?