The example workflow that you give is similar to the one proposed by TeamCity . The idea was as follows:
- code
- Check for "pre-test"
- Server CI tests "pre-commit"
- If (and only if) tests pass, the CI server commits a code change to the main repo
This is a religious war, but I prefer:
- Code - Test - Refactoring (cycle)
- Fix
- CI server also checks your commit
Each responsible programmer must complete all tests before committing.
The main argument for the first method is that it ensures that there is no broken code in SCM. However, I would say that:
- You must trust your developers to verify before committing
- If tests take a lot of time, the problem is your slow tests , not your workflow.
- Developers aim to run tests quickly
- Leaning on a CI server to run tests, you get a false sense of security
source share