From 203f6fb404b66cede1cd7921487bfb0995e5f6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Fri, 13 Oct 2017 10:40:50 +0200 Subject: [PATCH 1/3] cache node_modules --- Jenkinsfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4fd48e7c3..503eec0d0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -44,7 +44,14 @@ node('lisk-nano') { stage ('Install npm dependencies') { try { - sh 'npm install' + sh ''' + cp -r ~/cache/development/node_modules ./ || true + npm install + # cache nightly builds (development) only to save space + if [ $BRANCH_NAME = "development" ]; then + rsync -axl $WORKSPACE/node_modules/ ~/cache/development/node_modules/ || true + fi + ''' } catch (err) { echo "Error: ${err}" fail('Stopping build: npm install failed') From 12afba2c3e9064527417865e27ff1d180a08f5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Fri, 13 Oct 2017 11:48:13 +0200 Subject: [PATCH 2/3] Call webdriver-manager in install stage. This ensures that the files it downloads will be cached. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 503eec0d0..61ffba284 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,6 +47,7 @@ node('lisk-nano') { sh ''' cp -r ~/cache/development/node_modules ./ || true npm install + ./node_modules/protractor/bin/webdriver-manager update # cache nightly builds (development) only to save space if [ $BRANCH_NAME = "development" ]; then rsync -axl $WORKSPACE/node_modules/ ~/cache/development/node_modules/ || true @@ -117,7 +118,6 @@ node('lisk-nano') { # End to End test configuration export DISPLAY=:1$N Xvfb :1$N -ac -screen 0 1280x1024x24 & - ./node_modules/protractor/bin/webdriver-manager update # Run end-to-end tests npm run --silent e2e-test -- --params.baseURL http://localhost:808$N/ --params.liskCoreURL http://localhost:400$N From 1bb8e056439bf41c08d64f8a4e7acd522e0cab9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chavant?= Date: Fri, 13 Oct 2017 11:57:51 +0200 Subject: [PATCH 3/3] delete extraneous files from cache --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 61ffba284..3dd718173 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,7 +50,7 @@ node('lisk-nano') { ./node_modules/protractor/bin/webdriver-manager update # cache nightly builds (development) only to save space if [ $BRANCH_NAME = "development" ]; then - rsync -axl $WORKSPACE/node_modules/ ~/cache/development/node_modules/ || true + rsync -axl --delete $WORKSPACE/node_modules/ ~/cache/development/node_modules/ || true fi ''' } catch (err) {