diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f10e7f5642731c494990fc5e3cb0a7f2c59d6b65..9eec19adef3452e5e2054dbb3c77deeb72c52308 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,5 +2,5 @@ job:
   script:
     - python3 setup.py build
     - python3 setup.py build_ext -i
-    - make -C doc html
+    - make -C doc clean && make -C doc html
     - nosetests3 --with-coverage --cover-package kwant