From 7a16cf477dbec6fb0a040857de1be03c37621410 Mon Sep 17 00:00:00 2001 From: Daniel Rainer <daniel.m.rainer@student.uibk.ac.at> Date: Fri, 4 Mar 2022 16:41:43 +0100 Subject: [PATCH] Cache node_modules, run npm install only once --- .gitlab-ci.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 91d186aae..bae7ac646 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,17 @@ image: jhipster/jhipster:v7.6.0 cache: - key: '$CI_COMMIT_REF_NAME' - paths: - - .maven/ + - key: '$CI_COMMIT_REF_NAME' + paths: + - .maven/ + - key: + files: + - package-lock.json + paths: + - node_modules/ + stages: + - setup - lint - build - test @@ -12,10 +19,16 @@ stages: - package - release - deploy + before_script: - export NG_CLI_ANALYTICS="false" - export MAVEN_USER_HOME=`pwd`/.maven +npm-install: + stage: setup + script: + - npm install + checkstyle: stage: lint script: @@ -25,20 +38,18 @@ checkstyle: prettier: stage: lint script: - - npm install - npm run prettier:check allow_failure: true - needs: [] + needs: [npm-install] eslint: stage: lint script: - - npm install # eslint exits 0 on warnings, this is a workaround to exit 1 when warnings are present. - 'npm run lint | tee lint.log' - "! grep -qE '✖ [0-9]+ problem' lint.log" allow_failure: true - needs: [] + needs: [npm-install] maven-compile: stage: build @@ -80,7 +91,6 @@ maven-test: frontend-test: stage: test script: - - npm install - npm test artifacts: reports: @@ -91,7 +101,7 @@ frontend-test: when: always expire_in: 1 day allow_failure: true - needs: [] + needs: [npm-install] sonar-analyze: stage: analyze -- GitLab