Skip to content

fix conditional execution of tests in gitlab-ci and coverage report

Matias Guijarro requested to merge fix_conditional_tests_execution into master

git diff --name-only $(git merge-base HEAD origin/master) always returns nothing

In fact the command above works (btw. it seems it is the same as git diff origin/master... --name-only -yes, with three dots!) BUT sometimes it returns nothing... Indeed the tests were not executed when merging !1140 (merged) (scan numbering)

We need to execute tests when merging (even if tests were passing before in the branch).

I am not sure where the problem comes from. Indeed I managed to get an empty output with the command above during my tests but I could not figure out why.

Second problem: coverage report needs to be exported in public/htmlcov to be reported properly on the project page, but if tests are not executed the coverage is not calculated, htmlcov is not present

In order to solve both problems I finally propose the following:

  • to have tests with the conditional execution for branches except master (same as you wrote)
  • to have tests with no condition + coverage when branch is master (like before but only for master)
Edited by Matias Guijarro

Merge request reports