Skip to content
Snippets Groups Projects
Verified Commit 62cc6ad3 authored by Duncan Macleod's avatar Duncan Macleod
Browse files

ci: added apt caching

parent ab878415
No related branches found
No related tags found
1 merge request!17Added unit test configuration in gitlab-ci
Pipeline #62237 passed with warnings
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment