From ea836f656428b1e10ab44c1f1b1813ec500750ba Mon Sep 17 00:00:00 2001 From: Artem Nikitin Date: Tue, 9 Jul 2019 10:50:43 +0200 Subject: [PATCH] Don't run tests if only docs are changed (#1216) * Update Jenkinsfile * Simplify notOnlyDocs() * Update Jenkinsfile --- build/ci/pr/Jenkinsfile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/build/ci/pr/Jenkinsfile b/build/ci/pr/Jenkinsfile index d9ec2593e9..a3b580987e 100644 --- a/build/ci/pr/Jenkinsfile +++ b/build/ci/pr/Jenkinsfile @@ -23,11 +23,16 @@ pipeline { stage('Run tests in parallel') { parallel { stage("Run unit and integration tests") { + when { + expression { + checkout scm + notOnlyDocs() + } + } agent { label 'linux' } steps { - checkout scm sh 'make -C build/ci ci-pr' } } @@ -38,11 +43,16 @@ pipeline { } } stage("Run smoke E2E tests") { + when { + expression { + checkout scm + notOnlyDocs() + } + } agent { label 'linux' } steps { - checkout scm sh 'make -C build/ci ci-e2e' } } @@ -58,3 +68,11 @@ pipeline { } } + +def notOnlyDocs() { + // grep succeeds if there is at least one line without docs/ + return sh ( + script: "git diff --name-status HEAD~1 HEAD | grep -v docs/", + returnStatus: true + ) == 0 +}