From ab24bcab9ea2f54da9b78accf139b0f360c31d03 Mon Sep 17 00:00:00 2001 From: Alexander Harkness <me@bearbin.net> Date: Fri, 11 Oct 2019 15:47:55 +0100 Subject: [PATCH] Optimise npm execution in pipeline to reduce deploy time --- .gitlab-ci.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c43c2e..7733c96 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,23 +1,31 @@ default: image: node:12 -before_script: - - npm ci - stages: - - source_check + - deps + - check - build - test - deploy +node_install: + stage: deps + script: + - npm ci --only=prod + artifacts: + paths: + - node_modules + check_format: - stage: source_check + stage: check script: + - npm ci - npx prettier --ignore-path .gitignore --check "**/*.{html,js,json,md}" lint: - stage: source_check + stage: check script: + - npm ci - npx eslint --ignore-path .gitignore "**/*.js" backend_build: @@ -26,11 +34,12 @@ backend_build: - npm run build artifacts: paths: - - . + - public/ backend_test: stage: test script: + - npm ci - npm test deploy: -- GitLab