diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4475cef0fdd65454409aa1e1014d049097f54d34..477ac23e52378547edf3a54ef6693c2556d985a4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,7 @@
 stages:
   - update
-  - test
+  - setup
+  - build
   - deploy
 
 update_publications:
@@ -26,13 +27,13 @@ update_publications:
   only:
     - triggers
 
-test:
-  stage: test
+build:
+  stage: build
   image: "ruby:2.4"
   tags:
     - docker
   before_script:
-    - bundle install --without=development
+    - bundle install --deployment --without=development --with=test
     - bundle exec rake init
   script:
     - bundle exec rake -s --suppress-backtrace . test
@@ -47,7 +48,7 @@ deadlinks:
   tags:
     - docker
   before_script:
-    - bundle install --without="build development" --with=test
+    - bundle install --deployment --without=development --with=test
   script:
     - bundle exec rake -s --suppress-backtrace . testlinks
   allow_failure: true
@@ -64,3 +65,8 @@ deploy:
 
 variables:
   NOKOGIRI_USE_SYSTEM_LIBRARIES: "true"
+
+cache:
+  paths:
+    - .bundle/
+    - vendor/bundle/