diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2ca82010708849b20697a2e51c782adee042da3a..c891a3387846802d478678673aa4773e74e6cedd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -25,10 +25,24 @@ build_debug:
 run_unit_tests:
   stage: run_unit_tests
   script:
-    - cd ${DEBUG_DIR}
+    - cd "${DEBUG_DIR}"
     - make test
-    - cd ..; gcovr -e '.*tests.*|.*lib.*|build' -r .
-  coverage: /^TOTAL.*\s+(\d+\%)$/
+    # Return to the repo root so --root . aligns with actual paths:
+    - cd "${CI_PROJECT_DIR}"
+
+    # Run gcovr in a more permissive way:
+    - |
+      gcovr \
+        --root . \
+        --object-directory build/debug \
+        --exclude '.*CompilerIdCXX.*' \
+        --exclude '.*build\/debug\/CMakeFiles\/3.*' \
+        --exclude '.*CMakeFiles.*' \
+        --exclude 'tests' \
+        --exclude 'build' \
+        --exclude 'external' \
+        --gcov-ignore-errors=no_working_dir_found \
+  coverage: "/^TOTAL.*\\s+(\\d+\\%)$/"
 
 build_release_shared:
   stage: build_release