diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3a541275b64b88973e2709ddb7cae7626e6868cf..9d77f0ab5b4a5e5301b037cca19929b351478532 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -47,9 +47,13 @@ workflow:
 # of the build, by using the 'standalone' job only
 .ubuntu-template-job-default: &ubuntu-job
   image: gitlab-registry.cern.ch/geomodeldev/ubuntu-geant4-image:main-base
+  variables:
+    CHANGEDIR: '[!d]*'
   rules:
-    - when: always
-
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      changes:
+      - $CHANGEDIR/**/*
+      - CMakeLists.txt
 
 # TEMPLATES FOR BUILDING PACKAGES
 .geomodel-build-template: &geomodel-job
@@ -364,6 +368,7 @@ ubu-geomodelatlas:
     - git clone https://${EOS_ACCOUNT_USERNAME}:${GEOMODEL_READ_ACCESS}@gitlab.cern.ch/atlas/geomodelatlas/GeoModelATLAS.git
     - ls -lh
     - CI/compile_GeoModel.sh
+
 #####################
 ### Documentation ###
 #####################
@@ -371,7 +376,7 @@ ubu-geomodelatlas:
 docs-build:
     stage: step-A
     rules:
-      - if: '$CI_COMMIT_BRANCH == "main"' # Build documentation only if changes are pushed to main.
+      - if: $CI_COMMIT_BRANCH == "main" || $CI_PIPELINE_SOURCE == "merge_request_event"
         changes:
         - documentation/**/*
     allow_failure: true
@@ -506,16 +511,16 @@ persist-tag-artifacts:
       - install
     expire_in: never
 
-
 tests-ubuntu:
   <<: *ubuntu-job
-  stage: step-test
-  needs: ["ubu-gm-all"]
   stage: test
+  needs: ["ubu-gm-all"]
+  variables:
+      DUMMY: dummy # Work around weird configuration problems
   script:
     - mv build ../
     - cd ../build
-    - ctest #--output-on-failure
+    - ctest
   
 include:
   - athena_ci/ci.yml
diff --git a/athena_ci/ci.yml b/athena_ci/ci.yml
index 0018dd39359da82511bc07854cb942de47e2f0ef..52f2cdda06b11238298d3b17d785186fc9d38439 100644
--- a/athena_ci/ci.yml
+++ b/athena_ci/ci.yml
@@ -4,6 +4,11 @@ build_geomodel_athena:
   stage: step-A
   rules:
     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      changes:
+      - GeoModelCore/**/*
+      - GeoModelIO/**/*
+      - cmake/**/*
+      - CMakeLists.txt
 
   variables:
     CCACHE_KEY_SUFFIX: r2
@@ -52,6 +57,11 @@ build_geomodel_athena:
 
   rules:
     - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      changes:
+      - GeoModelCore/**/*
+      - GeoModelIO/**/*
+      - cmake/**/*
+      - CMakeLists.txt
 
   # This image sould work, but it seems it doesn't. Using my derivative until 
   # I figure out what the difference is.