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
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: