diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43ea29d8717ba468c34b259c1a39429f534aae4b..0c17c77d4a71fb2fb771ddd6f9b6603bea590515 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,14 @@ -#image: localhost:5000/mkdocs-imgw image: python:3.9-buster -# Install all required packages +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +# Cache between jobs in the same branch +cache: + - key: $CI_COMMIT_REF_SLUG + - paths: + - .cache/pip + stages: - build @@ -9,9 +16,12 @@ stages: build: rules: + # only run pipeline when build is in the commit message - if: $CI_COMMIT_MESSAGE =~ /.*build.*/ stage: build + before_script: + # Install all required packages - pip install -r requirements.txt script: # --strict is too strict :) @@ -19,6 +29,10 @@ build: artifacts: paths: - mkdocs.log + cache: + key: build-cache + paths: + - site/ deploy: stage: deploy @@ -28,3 +42,7 @@ deploy: - apt-get update -qq && apt-get install -y -qq sshpass openssh-client script: - sshpass -p "$WOLKE_PASSWORD" scp -oStrictHostKeyChecking=no -r ./site/ $WOLKE_USER@wolke.img.univie.ac.at:/var/www/html/documentation/general/ + cache: + key: build-cache + paths: + - site/