carrot-kpi / monorepo

A monorepo for Carrot v1.
GNU General Public License v3.0
5 stars 2 forks source link

Speed up e2e tests execution in CI by storing host frontend testable image in GHCR #547

Open luzzif opened 10 months ago

luzzif commented 10 months ago

The current e2e testing setup uses Synpress and a Dockerized setup to run tests in the CI Github workflow. Specifically, the host frontend along with all its dependencies is put in a Docker container that extends from synthetixio/docker-e2e and tests are executed in that context. Additionally, synthetixio/video is bootstrapped together with the tested app through Docker compose to offer the right environment for Synpress to run (it only works in headed mode, and synthetixio/video probably offers an in-memory X server instance through xfvb and that's about it).

In order to make building the dockerized app image faster, its build operation is currently done in a previous step using Docker Buildx and using layer caching through a Github Action cache, and then it's imported in the CI runner's Docker image registry in order to be used by the Docker Compose config that actually runs the tests. The above is used as an alternative to building the image each time directly within Docker Compose, in order to leverage Docker Buildx's caching, that is currently working fine.

The problem is that this approach is actually currently slower compared to the just-in-time non cached build. The slow part is in particular the local Docker image registry import operation that Docker Buildx does. Check out this issue for more details: https://github.com/docker/build-push-action/issues/998.

As an alternative we could investigate pushing the built image to GHCR and then making Docker Compose pull it.