[ci] Support to skip vstest using include/exclude config file. (#11086)
example: ├── folderA │ ├── fileA (skip vstest) │ ├── fileB │ └── fileC If we want to skip vstest when changing /folderA/fileA, and not skip vstest when changing fileB or fileC. vstest-include: ^folderA/fileA vstest-exclude: ^folderA
This commit is contained in:
parent
83f23e26ff
commit
2851884c8b
@ -98,6 +98,7 @@ jobs:
|
|||||||
platform_rpc: nephos
|
platform_rpc: nephos
|
||||||
|
|
||||||
buildSteps:
|
buildSteps:
|
||||||
|
- template: template-skipvstest.yml
|
||||||
- bash: |
|
- bash: |
|
||||||
set -ex
|
set -ex
|
||||||
if [ $(GROUP_NAME) == vs ]; then
|
if [ $(GROUP_NAME) == vs ]; then
|
||||||
|
12
.azure-pipelines/template-skipvstest.yml
Normal file
12
.azure-pipelines/template-skipvstest.yml
Normal file
@ -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."
|
3
.azure-pipelines/vstest-exclude
Normal file
3
.azure-pipelines/vstest-exclude
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
^platform
|
||||||
|
^.azure-pipelines
|
||||||
|
^files/build/versions
|
2
.azure-pipelines/vstest-include
Normal file
2
.azure-pipelines/vstest-include
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
^platform/vs
|
||||||
|
^.azure-pipelines/run-test-template.yml
|
@ -77,6 +77,7 @@ stages:
|
|||||||
|
|
||||||
- stage: Test
|
- stage: Test
|
||||||
dependsOn: BuildVS
|
dependsOn: BuildVS
|
||||||
|
condition: and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), succeeded())
|
||||||
variables:
|
variables:
|
||||||
- name: inventory
|
- name: inventory
|
||||||
value: veos_vtb
|
value: veos_vtb
|
||||||
|
Loading…
Reference in New Issue
Block a user