diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index c84c914418..f7eeb8c95d 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -98,6 +98,7 @@ jobs: platform_rpc: nephos buildSteps: + - template: template-skipvstest.yml - bash: | set -ex if [ $(GROUP_NAME) == vs ]; then diff --git a/.azure-pipelines/template-skipvstest.yml b/.azure-pipelines/template-skipvstest.yml new file mode 100644 index 0000000000..b47f17ce6e --- /dev/null +++ b/.azure-pipelines/template-skipvstest.yml @@ -0,0 +1,12 @@ +steps: +- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - script: | + set -ex + tar_branch=origin/$(System.PullRequest.TargetBranch) + git diff $tar_branch..HEAD --name-only | grep -v -f .azure-pipelines/vstest-exclude && exit 0 + git diff $tar_branch..HEAD --name-only | grep -f .azure-pipelines/vstest-include && exit 0 + set +x + echo "Skip vstest jobs" + echo "##vso[task.setvariable variable=SKIP_VSTEST;isOutput=true]YES" + name: SetVar + displayName: "Check if vstest is needed." diff --git a/.azure-pipelines/vstest-exclude b/.azure-pipelines/vstest-exclude new file mode 100644 index 0000000000..7161670470 --- /dev/null +++ b/.azure-pipelines/vstest-exclude @@ -0,0 +1,3 @@ +^platform +^.azure-pipelines +^files/build/versions diff --git a/.azure-pipelines/vstest-include b/.azure-pipelines/vstest-include new file mode 100644 index 0000000000..86fb3a9d88 --- /dev/null +++ b/.azure-pipelines/vstest-include @@ -0,0 +1,2 @@ +^platform/vs +^.azure-pipelines/run-test-template.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a0b1cf5425..345fb9b57a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,6 +77,7 @@ stages: - stage: Test dependsOn: BuildVS + condition: and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), succeeded()) variables: - name: inventory value: veos_vtb