diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 00e8712d928e595456c226a0f13ab5f54bdc6f2a..5392ceee8282ae9d003bfe5d323bde9a637dbebf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -60,6 +60,16 @@ stages:
       - .caches/eslint-cache
       - .caches/stylelint-cache
 
+.only:
+  php-changes: &php-changes
+    changes:
+      - composer.json
+      - app/controllers/**/*controller.php
+      - db/**/*
+      - lib/**/*
+      - tests/**/*
+      - vendor/**/*
+
 lint-php:
   stage: checks
   needs: []
@@ -122,6 +132,7 @@ lint-css:
 test-unit:
   stage: tests
   needs: [lint-php]
+  only: *php-changes
   cache:
     <<: *composer-cache
     policy: pull
@@ -138,6 +149,7 @@ test-unit:
 test-functional:
   stage: tests
   needs: [lint-php]
+  only: *php-changes
   cache:
     <<: *composer-cache
     policy: pull
@@ -156,6 +168,7 @@ test-functional:
 test-jsonapi:
   stage: tests
   needs: [lint-php]
+  only: *php-changes
   cache:
     <<: *composer-cache
     policy: pull