Using a pip cache on GitLab CI

Date Modified Tags gitlab / python

Using a pip cache on GitLab CI can speed up your builds considerably (my build time went down from 8 minutes to 3 minutes). Here is how to do it:

# .gitlab-ci.yml
image: python:2

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"

cache:
  paths:
    - "$CI_PROJECT_DIR/pip-cache"
  key: "$CI_PROJECT_ID"

test:
  script:
    # Make sure you ...
more ...