In the past I've mainly worked with monorepos, specifically a Vue.js app that was served by a rails backend. Setting up E2E/integration tests in the CI was simple, because all the required parts were kept in one place anyway and the testing tools provided by rails did most of the heavy lifting. Now I'm working on a polyrepo project. The main components are a CMS, a backend and a frontend.
I'm struggling to find a satisfactory setup and would like to discuss the topic in general. I want to have the following things:
- when I change the backend, I want to make sure that it still works together with the frontend
- vice versa, when I make changes to the frontend, I want to make sure that it's compatible with the backend
- when changing both, the changes should be tested against one another
In the monorepo scenario, I would have just spun up the backend and ran tests against it from the frontend. But now those components live in separate repositories. I could pull the code from one into the other, but where should that happen?
- in the frontend: then changing the backend wouldn't trigger E2E tests
- in the backend: same thing
- in a separate repo: frontend and backend would have to push their changes to the E2E-test repo where the tests would run. When both repos change, they just have to push to the same branch name and changes in both repos will be tested against one another. I like the idea, but how do we get feedback in the frontend/backend repos without manually checking the E2E-repo? Also, the setup seems quite complicated.
In theory, the components should probably be completely isolated from one another and be able to evolve independently. In practice, this would imply a lot of overhead, especially API versioning and backwards compatibility.
One options would be to move all components into a monorepo. This might be the best choice, but I only have three repositories, so this should be a "simple" problem, compared to a microservice architecture and I'd like to hear the alternatives. How would one approach this in general? Is my mindset all wrong and the E2E tests should better run on a staging or production server while only the unit and API tests run within the CI? There should also be a simple solution to run the E2E suite locally, shouldn't there?
I know that there is no clear-cut answer and that any answer will probably be opinionated but I'd like to gather ideas and approaches to the problem to figure out a good solution.