Hi, I’ve split my tests up so they run in different stages, however, using the config below, ‘npm ci’ and ‘npm run build’ are run before each test. Is it possible to run these scripts only once? My aim is to speed up the pipeline by running our unit and integration tests separately, so if one fails, it can be run independently without running the other. Our cypress integration tests are particularly slow, and can take up to 30 minutes. Any suggestions?
language: node_js
node_js:
- 12
addons:
apt:
packages:
# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves
- libgconf-2-4
before_install:
- npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
cache:
directories:
- ~/.npm
- ~/.cache
override:
- npm ci
- npm run build
defaults: &defaults
script:
- npm run $STAGE_NAME
jobs:
include:
- stage: test
env:
- STAGE_NAME="test"
<<: *defaults
- stage: test
env:
- STAGE_NAME="integration"
<<: *defaults