From 37b08731ce457b405cc2832798e4332c82b35915 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Mon, 13 Sep 2021 13:47:46 +0300 Subject: [PATCH 01/10] [CI] Prevent complete pipeline to run when only docs/ change --- .github/ISSUE_TEMPLATE/documentation.md | 1 - Jenkinsfile | 15 +++++++++++++++ .../ubuntu_install_vitis_ai_packages_ci.sh | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md index a1c1facb7e1b..0ad9424c1b5d 100644 --- a/.github/ISSUE_TEMPLATE/documentation.md +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -19,4 +19,3 @@ Include the title of the document (e.g. "Getting Started with TVM"), and the typ If an RFC/discuss post exists, link it here. Otherwise, specify what actions should be taken to provide additional clarity/readability/reproducibility to the document. Include code snippets from the previous documentation if applicable. - diff --git a/Jenkinsfile b/Jenkinsfile index fa1629205080..db42e50f721a 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -201,6 +201,11 @@ def unpack_lib(name, libs) { } stage('Build') { + when { + not { + changeset "docs/**" + } + } parallel 'BUILD: GPU': { node('GPUBUILD') { ws(per_exec_ws("tvm/build-gpu")) { @@ -285,6 +290,11 @@ stage('Build') { } stage('Unit Test') { + when { + not { + changeset "docs/**" + } + } parallel 'python3: GPU': { node('TensorCore') { ws(per_exec_ws("tvm/ut-python-gpu")) { @@ -345,6 +355,11 @@ stage('Unit Test') { } stage('Integration Test') { + when { + not { + changeset "docs/**" + } + } parallel 'topi: GPU': { node('GPU') { ws(per_exec_ws("tvm/topi-python-gpu")) { diff --git a/docker/install/ubuntu_install_vitis_ai_packages_ci.sh b/docker/install/ubuntu_install_vitis_ai_packages_ci.sh index 25c214068cd0..f6f270a07a83 100644 --- a/docker/install/ubuntu_install_vitis_ai_packages_ci.sh +++ b/docker/install/ubuntu_install_vitis_ai_packages_ci.sh @@ -6,9 +6,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY From 428710f157d006dbafae680491817d2b245694e5 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Tue, 14 Sep 2021 18:10:38 +0300 Subject: [PATCH 02/10] [CI] Trigger on docs --- Jenkinsfile | 167 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 64 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index db42e50f721a..7424d43b0b7f 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -201,11 +201,6 @@ def unpack_lib(name, libs) { } stage('Build') { - when { - not { - changeset "docs/**" - } - } parallel 'BUILD: GPU': { node('GPUBUILD') { ws(per_exec_ws("tvm/build-gpu")) { @@ -223,19 +218,25 @@ stage('Build') { node('CPU') { ws(per_exec_ws("tvm/build-cpu")) { init_git() - sh "${docker_run} ${ci_cpu} ./tests/scripts/task_config_build_cpu.sh" - make(ci_cpu, 'build', '-j2') - pack_lib('cpu', tvm_multilib_tsim) - timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} ${ci_cpu} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_unittest.sh" - sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_integration.sh" - sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_vta_fsim.sh" - sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_vta_tsim.sh" - // sh "${docker_run} ${ci_cpu} ./tests/scripts/task_golang.sh" - // TODO(@jroesch): need to resolve CI issue will turn back on in follow up patch - sh "${docker_run} ${ci_cpu} ./tests/scripts/task_rust.sh" - junit "build/pytest-results/*.xml" + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { + sh "${docker_run} ${ci_cpu} ./tests/scripts/task_config_build_cpu.sh" + make(ci_cpu, 'build', '-j2') + pack_lib('cpu', tvm_multilib_tsim) + timeout(time: max_time, unit: 'MINUTES') { + sh "${docker_run} ${ci_cpu} ./tests/scripts/task_ci_setup.sh" + sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_unittest.sh" + sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_integration.sh" + sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_vta_fsim.sh" + sh "${docker_run} ${ci_cpu} ./tests/scripts/task_python_vta_tsim.sh" + // sh "${docker_run} ${ci_cpu} ./tests/scripts/task_golang.sh" + // TODO(@jroesch): need to resolve CI issue will turn back on in follow up patch + sh "${docker_run} ${ci_cpu} ./tests/scripts/task_rust.sh" + junit "build/pytest-results/*.xml" + } } } } @@ -244,11 +245,17 @@ stage('Build') { node('CPU') { ws(per_exec_ws("tvm/build-wasm")) { init_git() - sh "${docker_run} ${ci_wasm} ./tests/scripts/task_config_build_wasm.sh" - make(ci_wasm, 'build', '-j2') - timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} ${ci_wasm} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_wasm} ./tests/scripts/task_web_wasm.sh" + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { + sh "${docker_run} ${ci_wasm} ./tests/scripts/task_config_build_wasm.sh" + make(ci_wasm, 'build', '-j2') + timeout(time: max_time, unit: 'MINUTES') { + sh "${docker_run} ${ci_wasm} ./tests/scripts/task_ci_setup.sh" + sh "${docker_run} ${ci_wasm} ./tests/scripts/task_web_wasm.sh" + } } } } @@ -257,9 +264,15 @@ stage('Build') { node('CPU') { ws(per_exec_ws("tvm/build-i386")) { init_git() - sh "${docker_run} ${ci_i386} ./tests/scripts/task_config_build_i386.sh" - make(ci_i386, 'build', '-j2') - pack_lib('i386', tvm_multilib_tsim) + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { + sh "${docker_run} ${ci_i386} ./tests/scripts/task_config_build_i386.sh" + make(ci_i386, 'build', '-j2') + pack_lib('i386', tvm_multilib_tsim) + } } } }, @@ -267,9 +280,15 @@ stage('Build') { node('ARM') { ws(per_exec_ws("tvm/build-arm")) { init_git() - sh "${docker_run} ${ci_arm} ./tests/scripts/task_config_build_arm.sh" - make(ci_arm, 'build', '-j4') - pack_lib('arm', tvm_multilib) + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { + sh "${docker_run} ${ci_arm} ./tests/scripts/task_config_build_arm.sh" + make(ci_arm, 'build', '-j4') + pack_lib('arm', tvm_multilib) + } } } }, @@ -277,12 +296,18 @@ stage('Build') { node('CPU') { ws(per_exec_ws("tvm/build-qemu")) { init_git() - sh "${docker_run} ${ci_qemu} ./tests/scripts/task_config_build_qemu.sh" - make(ci_qemu, 'build', '-j2') - timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} ${ci_qemu} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_qemu} ./tests/scripts/task_python_microtvm.sh" - junit "build/pytest-results/*.xml" + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { + sh "${docker_run} ${ci_qemu} ./tests/scripts/task_config_build_qemu.sh" + make(ci_qemu, 'build', '-j2') + timeout(time: max_time, unit: 'MINUTES') { + sh "${docker_run} ${ci_qemu} ./tests/scripts/task_ci_setup.sh" + sh "${docker_run} ${ci_qemu} ./tests/scripts/task_python_microtvm.sh" + junit "build/pytest-results/*.xml" + } } } } @@ -290,22 +315,23 @@ stage('Build') { } stage('Unit Test') { - when { - not { - changeset "docs/**" - } - } parallel 'python3: GPU': { node('TensorCore') { ws(per_exec_ws("tvm/ut-python-gpu")) { init_git() - unpack_lib('gpu', tvm_multilib) - timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_sphinx_precheck.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest_gpuonly.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_integration_gpuonly.sh" - junit "build/pytest-results/*.xml" + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { + unpack_lib('gpu', tvm_multilib) + timeout(time: max_time, unit: 'MINUTES') { + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_ci_setup.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_sphinx_precheck.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest_gpuonly.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_python_integration_gpuonly.sh" + junit "build/pytest-results/*.xml" + } } } } @@ -314,13 +340,19 @@ stage('Unit Test') { node('CPU') { ws(per_exec_ws("tvm/ut-python-i386")) { init_git() - unpack_lib('i386', tvm_multilib) - timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} ${ci_i386} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_unittest.sh" - sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_integration.sh" - sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_vta_fsim.sh" - junit "build/pytest-results/*.xml" + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { + unpack_lib('i386', tvm_multilib) + timeout(time: max_time, unit: 'MINUTES') { + sh "${docker_run} ${ci_i386} ./tests/scripts/task_ci_setup.sh" + sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_unittest.sh" + sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_integration.sh" + sh "${docker_run} ${ci_i386} ./tests/scripts/task_python_vta_fsim.sh" + junit "build/pytest-results/*.xml" + } } } } @@ -329,13 +361,19 @@ stage('Unit Test') { node('ARM') { ws(per_exec_ws("tvm/ut-python-arm")) { init_git() + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { unpack_lib('arm', tvm_multilib) timeout(time: max_time, unit: 'MINUTES') { sh "${docker_run} ${ci_arm} ./tests/scripts/task_ci_setup.sh" sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_unittest.sh" sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_arm_compute_library.sh" junit "build/pytest-results/*.xml" - // sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_integration.sh" + // sh "${docker_run} ${ci_arm} ./tests/scripts/task_python_integration.sh" + } } } } @@ -344,10 +382,16 @@ stage('Unit Test') { node('GPU') { ws(per_exec_ws("tvm/ut-java")) { init_git() - unpack_lib('gpu', tvm_multilib) - timeout(time: max_time, unit: 'MINUTES') { - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_ci_setup.sh" - sh "${docker_run} ${ci_gpu} ./tests/scripts/task_java_unittest.sh" + def docs = sh (returnStatus: true, script: ''' + git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) + if (docs == 0 ) { + unpack_lib('gpu', tvm_multilib) + timeout(time: max_time, unit: 'MINUTES') { + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_ci_setup.sh" + sh "${docker_run} ${ci_gpu} ./tests/scripts/task_java_unittest.sh" + } } } } @@ -355,11 +399,6 @@ stage('Unit Test') { } stage('Integration Test') { - when { - not { - changeset "docs/**" - } - } parallel 'topi: GPU': { node('GPU') { ws(per_exec_ws("tvm/topi-python-gpu")) { From 2ca6b06e585b7c7e22211a4e714c7f674fe06cd7 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Wed, 15 Sep 2021 20:23:31 +0300 Subject: [PATCH 03/10] Cleanup --- Jenkinsfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6cf18dd0c452..ea2cfe7fcba0 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -153,6 +153,10 @@ stage("Sanity Check") { node('CPU') { ws(per_exec_ws("tvm/sanity")) { init_git() + def docs = sh (returnStatus: true, script: ''' + git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ + ''' + ) sh "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh" } } @@ -218,10 +222,6 @@ stage('Build') { node('CPU') { ws(per_exec_ws("tvm/build-cpu")) { init_git() - def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ - ''' - ) if (docs == 0 ) { sh "${docker_run} ${ci_cpu} ./tests/scripts/task_config_build_cpu.sh" make(ci_cpu, 'build', '-j2') @@ -265,7 +265,7 @@ stage('Build') { ws(per_exec_ws("tvm/build-i386")) { init_git() def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ ''' ) if (docs == 0 ) { @@ -281,7 +281,7 @@ stage('Build') { ws(per_exec_ws("tvm/build-arm")) { init_git() def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ ''' ) if (docs == 0 ) { @@ -297,7 +297,7 @@ stage('Build') { ws(per_exec_ws("tvm/build-qemu")) { init_git() def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ ''' ) if (docs == 0 ) { @@ -320,7 +320,7 @@ stage('Unit Test') { ws(per_exec_ws("tvm/ut-python-gpu")) { init_git() def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ ''' ) if (docs == 0 ) { @@ -341,7 +341,7 @@ stage('Unit Test') { ws(per_exec_ws("tvm/ut-python-i386")) { init_git() def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ ''' ) if (docs == 0 ) { @@ -362,7 +362,7 @@ stage('Unit Test') { ws(per_exec_ws("tvm/ut-python-arm")) { init_git() def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ ''' ) if (docs == 0 ) { @@ -383,7 +383,7 @@ stage('Unit Test') { ws(per_exec_ws("tvm/ut-java")) { init_git() def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ + git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ ''' ) if (docs == 0 ) { From f9b235e1bf0f9f81eb809da1d26c36e8f385c0c7 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 16 Sep 2021 11:53:49 +0300 Subject: [PATCH 04/10] Test --- Jenkinsfile | 13 +++++++++---- docs/tsf.txt | 0 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 docs/tsf.txt diff --git a/Jenkinsfile b/Jenkinsfile index ea2cfe7fcba0..7dae02708290 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -148,15 +148,20 @@ stage('Prepare') { } } +def getPRChangelog() { + return sh( + script: "git diff-tree --no-commit-id --name-only -r origin/main", + returnStdout: true + ).split('\n') +} + stage("Sanity Check") { timeout(time: max_time, unit: 'MINUTES') { node('CPU') { ws(per_exec_ws("tvm/sanity")) { init_git() - def docs = sh (returnStatus: true, script: ''' - git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ - ''' - ) + def docs=1 + println getPRChangelog() sh "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh" } } diff --git a/docs/tsf.txt b/docs/tsf.txt new file mode 100644 index 000000000000..e69de29bb2d1 From e1dfdb8b8092d42298509c18030cd80db5e87dac Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 16 Sep 2021 12:05:53 +0300 Subject: [PATCH 05/10] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7dae02708290..2e5734f5fd61 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -161,7 +161,7 @@ stage("Sanity Check") { ws(per_exec_ws("tvm/sanity")) { init_git() def docs=1 - println getPRChangelog() + echo ${getPRChangelog()} sh "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh" } } From ce36b93d402dce2e493cfefa5cbb5aa77b2c65db Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 16 Sep 2021 12:11:40 +0300 Subject: [PATCH 06/10] Test --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2e5734f5fd61..e3b941dadb59 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -148,12 +148,12 @@ stage('Prepare') { } } -def getPRChangelog() { - return sh( +def GIT_DIFF = + sh( script: "git diff-tree --no-commit-id --name-only -r origin/main", returnStdout: true ).split('\n') -} + stage("Sanity Check") { timeout(time: max_time, unit: 'MINUTES') { @@ -161,7 +161,7 @@ stage("Sanity Check") { ws(per_exec_ws("tvm/sanity")) { init_git() def docs=1 - echo ${getPRChangelog()} + echo "Git committer email: ${GIT_DIFF}" sh "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh" } } From d036dd6866b8724cbe72359bdac1a7e8fc9eecb0 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 16 Sep 2021 12:16:56 +0300 Subject: [PATCH 07/10] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e3b941dadb59..8b2405de8456 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -151,7 +151,7 @@ stage('Prepare') { def GIT_DIFF = sh( script: "git diff-tree --no-commit-id --name-only -r origin/main", - returnStdout: true + returnStatus: true ).split('\n') From 606723190da2a27daec630c61fc7541d8456479a Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 16 Sep 2021 12:20:01 +0300 Subject: [PATCH 08/10] Test --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b2405de8456..9c294bb811ff 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -148,12 +148,12 @@ stage('Prepare') { } } -def GIT_DIFF = - sh( +def GIT_DIFF { + return sh( script: "git diff-tree --no-commit-id --name-only -r origin/main", returnStatus: true ).split('\n') - +} stage("Sanity Check") { timeout(time: max_time, unit: 'MINUTES') { From ef111768a2592d3d55f653ebe2f707dd6a1dd9f2 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 16 Sep 2021 12:54:58 +0300 Subject: [PATCH 09/10] test --- docs/ts.s | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/ts.s diff --git a/docs/ts.s b/docs/ts.s new file mode 100644 index 000000000000..e69de29bb2d1 From 92aa5867b59a9fd4874e3904798b0d4559d018e4 Mon Sep 17 00:00:00 2001 From: Michalis Papadimitriou Date: Thu, 16 Sep 2021 13:43:59 +0300 Subject: [PATCH 10/10] Test --- Jenkinsfile | 21 +++++---------------- git_changed_status.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 16 deletions(-) create mode 100755 git_changed_status.sh diff --git a/Jenkinsfile b/Jenkinsfile index 9c294bb811ff..62f5f3ac554f 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -148,20 +148,17 @@ stage('Prepare') { } } -def GIT_DIFF { - return sh( - script: "git diff-tree --no-commit-id --name-only -r origin/main", - returnStatus: true - ).split('\n') -} stage("Sanity Check") { timeout(time: max_time, unit: 'MINUTES') { node('CPU') { ws(per_exec_ws("tvm/sanity")) { init_git() - def docs=1 - echo "Git committer email: ${GIT_DIFF}" + def docs = sh (returnStatus: true, script: ''' + ./git_changed_status.sh + ''' + ) + echo "Git committer email: ${docs}" sh "${docker_run} ${ci_lint} ./tests/scripts/task_lint.sh" } } @@ -250,10 +247,6 @@ stage('Build') { node('CPU') { ws(per_exec_ws("tvm/build-wasm")) { init_git() - def docs = sh (returnStatus: true, script: ''' - git diff-tree --no-commit-id --name-only -r HEAD | grep -v -q docs/ - ''' - ) if (docs == 0 ) { sh "${docker_run} ${ci_wasm} ./tests/scripts/task_config_build_wasm.sh" make(ci_wasm, 'build', '-j2') @@ -285,10 +278,6 @@ stage('Build') { node('ARM') { ws(per_exec_ws("tvm/build-arm")) { init_git() - def docs = sh (returnStatus: true, script: ''' - git diff-tree origin/main --no-commit-id --name-only -r HEAD | grep -v -q docs/ - ''' - ) if (docs == 0 ) { sh "${docker_run} ${ci_arm} ./tests/scripts/task_config_build_arm.sh" make(ci_arm, 'build', '-j4') diff --git a/git_changed_status.sh b/git_changed_status.sh new file mode 100755 index 000000000000..df0b529c6d22 --- /dev/null +++ b/git_changed_status.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +DOCS_DIR=0 +OTHER_DIR=0 +DOC_DIR="\docs" + +changed_files=`git diff --no-commit-id --name-only -r origin/main` + +for file in $changed_files; do + if grep -q "$DOC_DIR" <<< "$file"; then + DOCS_DIR=1 + else + OTHER_DIR=1 + fi +done + +if [[ ($DOCS_DIR -eq !$OTHER_DIR) || ($OTHER_DIR -eq 1) ]]; then + exit 1 +else + exit 0 +fi