simplify caching in gitlab-ci

This commit is contained in:
Johannes Loher 2020-12-23 20:23:44 +01:00
parent b0ddd983c3
commit 7489fe8e5d

View file

@ -1,39 +1,24 @@
image: node:latest image: node:latest
stages: stages:
- Preparation
- Build - Build
- Test - Test
Install Dependencies: cache:
stage: Preparation key: ${CI_COMMIT_REF_SLUG}
cache: paths:
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR - .npm/
paths:
- node_modules/ before_script:
script: - npm ci --cache .npm --prefer-offline
- npm ci
# only:
# changes:
# - package-lock.json
Build: Build:
stage: Build stage: Build
cache:
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
policy: pull
script: script:
- npm run build - npm run build
Lint: Lint:
stage: Test stage: Test
cache:
key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
paths:
- node_modules/
policy: pull
script: script:
- npm run lint - npm run lint
# Test: # Test: