From 7489fe8e5d616f7dd3bea9778767efee3820beef Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Wed, 23 Dec 2020 20:23:44 +0100 Subject: [PATCH] simplify caching in gitlab-ci --- .gitlab-ci.yml | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 042ad669..dc8f4066 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,39 +1,24 @@ image: node:latest stages: - - Preparation - Build - Test -Install Dependencies: - stage: Preparation - cache: - key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR - paths: - - node_modules/ - script: - - npm ci - # only: - # changes: - # - package-lock.json +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - .npm/ + +before_script: + - npm ci --cache .npm --prefer-offline Build: stage: Build - cache: - key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR - paths: - - node_modules/ - policy: pull script: - npm run build Lint: stage: Test - cache: - key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR - paths: - - node_modules/ - policy: pull script: - npm run lint # Test: