diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2018d40604e743bba780509b9cbee80a12938c86..8058ef0d81edf46d1e8e600b15b9f57cbd68e809 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,20 +13,28 @@ variables:
   GIT_SUBMODULE_DEPTH: 1
 
 .snippets:
-  apt-install-libgl:
+  apt-install-libs:
       # apt install libgl1-mesa-glx for grad-cam
       - |
         if [[ ${CI_RUNNER_TAGS} =~ '"docker"' ]]; then \
           apt update; \
-          apt install -y libgl1-mesa-glx > /dev/null; \
+          apt install -y libegl1 libgl1-mesa-glx > /dev/null; \
         fi
 
 tests:
   before_script:
     - !reference [.snippets, setup-pixi]
-    - !reference [.snippets, apt-install-libgl]
+    - !reference [.snippets, apt-install-libs]
+  cache:
+    key: test-cache-${TAG}-${PYTHON}
+    paths:
+      - _cache/torch
 
 documentation:
   before_script:
     - !reference [.snippets, setup-pixi]
-    - !reference [.snippets, apt-install-libgl]
+    - !reference [.snippets, apt-install-libs]
+  cache:
+    key: doc-cache
+    paths:
+      - _cache/torch