improve node_modules caching in gitlab-ci

This commit is contained in:
Johannes Loher 2020-12-27 14:03:14 +01:00
parent 174c37f3b4
commit b48a03db8b

View file

@ -1,36 +1,51 @@
image: node:latest
stages:
- prepare
- test
- build
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
cache: &global_cache
key:
files:
- package-lock.json
policy: pull
untracked: true
paths:
- .npm/
- node_modules/
install-dependencies:
stage: prepare
script:
- npm ci
cache:
<<: *global_cache
policy: pull-push
lint:
stage: test
before_script:
- npm ci --cache .npm --prefer-offline
script:
- npm run lint
cache:
<<: *global_cache
# Test:
# stage: Test
# script:
# - npm test
# cache:
# <<: *global_cache
build:
stage: build
before_script:
- npm ci --cache .npm --prefer-offline
script:
- npm run build
cache:
<<: *global_cache
artifacts:
paths:
- dist
- dist/
expire_in: 1 week
deploy: