Commit 62cc6ad3 authored by Duncan Macleod's avatar Duncan Macleod

ci: added apt caching

parent ab878415
Pipeline #62237 passed with stages
in 12 minutes and 9 seconds
......@@ -2,10 +2,11 @@
image: docker:latest
variables:
APT_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/apt"
DOCKER_DRIVER: overlay
DOCKER_BRANCH: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
DOCKER_LATEST: $CI_REGISTRY_IMAGE:latest
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/.cache/pip"
stages:
- test
......@@ -40,13 +41,15 @@ before_script:
MYSQL_DB: "${DJANGO_DB_NAME}"
MYSQL_ROOT_PASSWORD: "${DJANGO_DB_PASSWORD}"
before_script:
# create apt cache directory
- mkdir -pv ${APT_CACHE_DIR}
# set python version
- PYTHON_VERSION="${CI_JOB_NAME##*:}"
- PYTHON_MAJOR="${PYTHON_VERSION:0:1}"
- if [[ "${PYTHON_MAJOR}" -eq 2 ]]; then PYTHON="python"; else PYTHON="python3"; fi
# install build requirements
- apt-get -yqq update
- apt-get install -yqq
- apt-get -o dir::cache::archives="${APT_CACHE_DIR}" install -yqq
git
libmariadbclient-dev
libldap2-dev
......@@ -56,7 +59,7 @@ before_script:
swig
${PYTHON}-pip
# install voeventlib for python2
- if [[ "${PYTHON_MAJOR}" -eq 2 ]]; then apt-get install -yqq python-voeventlib; fi
- if [[ "${PYTHON_MAJOR}" -eq 2 ]]; then apt-get -o dir::cache::archives="${APT_CACHE_DIR}" install -yqq python-voeventlib; fi
# install everything else from pip
- ${PYTHON} -m pip install -r requirements.txt
- ${PYTHON} -m pip install pytest-django pytest-cov
......@@ -75,8 +78,10 @@ before_script:
reports:
junit: junit.xml
cache:
key: "${CI_JOB_NAME}"
paths:
- .cache/pip
- .cache/apt
test:2.7:
<<: *test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment