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