diff --git a/.devops/templates/runpublishvrscreenshot.yml b/.devops/templates/runpublishvrscreenshot.yml index 8c41485626c41..25d4f87e19e40 100644 --- a/.devops/templates/runpublishvrscreenshot.yml +++ b/.devops/templates/runpublishvrscreenshot.yml @@ -18,30 +18,54 @@ steps: filePath: yarn-ci.sh displayName: yarn (install packages) + - script: | + isPR=${{lower(eq(variables['Build.Reason'], 'PullRequest'))}} + echo $isPR + if [[ $isPR == true ]]; then + packageAffected=$(yarn --silent check:affected-package --packages ${{ parameters.vrTestPackageName }} --pr=true) + if [[ $packageAffected == false ]]; then + echo "In PR pipeline but NOT affecting test package. Skipping test run" + echo "##vso[task.setvariable variable=vrTestSkip;]yes" + else + echo "In PR pipeline and affecting test package. NOT Skipping test run" + echo "##vso[task.setvariable variable=vrTestSkip;]no" + fi + else + echo "Not in PR pipeline. NOT Skipping test run" + echo "##vso[task.setvariable variable=vrTestSkip;]no" + fi + displayName: Check if vrTests should be skipped + - script: | yarn workspace ${{ parameters.vrTestPackageName }} convert displayName: Convert screener component to storywright + condition: eq(variables['vrTestSkip'], 'no') - ${{ if eq(parameters.shouldBuildstorybookaddon, 'true') }}: - script: | yarn build --to @fluentui/react-storybook-addon displayName: Build react-storybook-addon + condition: eq(variables['vrTestSkip'], 'no') - script: | yarn workspace ${{ parameters.vrTestPackageName }} screener:build displayName: Build VR tests components package + condition: eq(variables['vrTestSkip'], 'no') - script: | yarn workspace ${{ parameters.vrTestPackageName }} test:component --verbose displayName: 'Run VR tests' + condition: eq(variables['vrTestSkip'], 'no') - script: | mkdir -p screenshots cp -rf ${{ parameters.vrTestPackagePath }}/dist/screenshots/*.png screenshots/ displayName: Collate Artifacts + condition: eq(variables['vrTestSkip'], 'no') - task: PublishBuildArtifacts@1 inputs: PathtoPublish: 'screenshots' ArtifactName: 'vrscreenshot${{ parameters.fluentVersion }}' publishLocation: 'Container' + condition: eq(variables['vrTestSkip'], 'no') diff --git a/azure-pipelines.vrt-pr.yml b/azure-pipelines.vrt-pr.yml index edd86621cbb15..fc69a7ecf24bb 100644 --- a/azure-pipelines.vrt-pr.yml +++ b/azure-pipelines.vrt-pr.yml @@ -23,6 +23,9 @@ jobs: workspace: clean: all steps: + - checkout: self + fetchDepth: 0 + - template: .devops/templates/tools.yml - bash: | @@ -73,6 +76,7 @@ jobs: env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) BASELINE_PIPELINE_ID: $(BASELINE-PIPELINE-ID) + condition: eq(variables['vrTestSkip'], 'no') - bash: node node_modules/vrscreenshotdiff/lib/index.js pr --clientType "fluentuiv9" --buildId $(Build.BuildId) --lkgCIBuild $(LatestBuildId) --pipelineId $(pipelineId) --pipelineName '$(pipelineName)' displayName: 'Run fluentui-screenshotdiff' @@ -87,6 +91,7 @@ jobs: STORAGE_KEY_FLUENTUI: $(STORAGE-KEY-BLOB-FLUENTUI) BLOB_CONNECTION_STRING: $(BLOB-CONNECTION-STRING) VR_APPROVAL_CLIENT_SECRET: $(VR-APPROVAL-CLIENT-SECRET) + condition: eq(variables['vrTestSkip'], 'no') - job: VisualRegressionTest_V8 variables: @@ -95,6 +100,9 @@ jobs: workspace: clean: all steps: + - checkout: self + fetchDepth: 0 + - template: .devops/templates/tools.yml - bash: | @@ -145,6 +153,7 @@ jobs: env: SYSTEM_ACCESSTOKEN: $(System.AccessToken) BASELINE_PIPELINE_ID: $(BASELINE-PIPELINE-ID) + condition: eq(variables['vrTestSkip'], 'no') - bash: node node_modules/vrscreenshotdiff/lib/index.js pr --clientType "fluentuiv8" --buildId $(Build.BuildId) --lkgCIBuild $(LatestBuildId) --pipelineId $(pipelineId) --pipelineName '$(pipelineName)' displayName: 'Run fluentui-screenshotdiff' @@ -159,3 +168,4 @@ jobs: STORAGE_KEY_FLUENTUI: $(STORAGE-KEY-BLOB-FLUENTUI) BLOB_CONNECTION_STRING: $(BLOB-CONNECTION-STRING) VR_APPROVAL_CLIENT_SECRET: $(VR-APPROVAL-CLIENT-SECRET) + condition: eq(variables['vrTestSkip'], 'no')