diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 71e5bd23ed6ef9a682a1a458512d66adb334633b..4441873da0bff24a5b8bcb183b5573d3d99c0755 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,7 @@ checks:
   before_script:
     - python3 -m venv .venv
     - source .venv/bin/activate
+    - python3 -m pip install --upgrade pip
   script:
     - export PATH=/home/gitlab-runner/.local/bin:$PATH
     #  We'd like to run the pre-commit hooks only on files that are being
@@ -39,7 +40,7 @@ pytest:
     - echo $GIT_SSH_COMMAND
     - python3 -m venv .venv
     - source .venv/bin/activate
-  script:
     - python3 -m pip install --upgrade pip
+  script:
     - python3 -m pip install ".[test]"
     - python3 -m pytest --cov=cal_tools --cov=xfel_calibrate  --ignore=tests/legacy