Add Codecov
What I did Add code coverage
Related issue
(not mandatory) A picture of a cute animal, if possible in relation with what you did
@glours Hmmm... In the end, what happens is that e2e tests need to connect to the docker socket and I get an error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
The thing is that we cannot mount it during the build. The other target can use it because it only runs unit tests.
I even tried a RUN --mount=target=/var/run/docker.sock,rw but it doesn't work.
There is the solution of baking an e2e image and running it with -v /var/run/docker.sock:/var/run/docker.sock to be able to access it. But I think that would go around all the idea of having buildx set up.
@crazy-max any idea ☝️ Do you have the same kind of e2e tests on the buildx side and if yes how did you address this issue?
test-coverage in Dockerfile is just for unit test but yeah sandboxed unit test makes sense so this step could output coverage like we do in buildx: https://github.com/docker/buildx/blob/294421db9c3087561f44ff5a8dcdefde758e3c22/Dockerfile#L41-L45. See also bake target: https://github.com/docker/buildx/blob/294421db9c3087561f44ff5a8dcdefde758e3c22/docker-bake.hcl#L97-L101.
e2e tests need a runnable container so can't do this during build. Also mounting sockets is not supported atm on BuildKit afaik.
@glours I think that in this case we can stay the way it is. WDYT?
We can either keep it as is, or change the test-coverage Dockerfile target to run some other step without the e2e, it doesn't make sense to run the end-to-end tests just for test coverage.
@laurazard Actually test-coverage doesn't run e2e tests, only unit tests.
What we need to decide here is to what are we interested in mesuring.
- Only unit tests
- Only e2e tests
- Both tests (Codecov can Merge coverage reports)