improve node_modules caching in gitlab-ci
This commit is contained in:
parent
174c37f3b4
commit
b48a03db8b
1 changed files with 23 additions and 8 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue