Skip to content

Commit

Permalink
Add a check whether to run vr tests based on affected packages check (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
sunilsurana authored and Hotell committed Feb 9, 2023
1 parent 24930ce commit 6d74c91
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .devops/templates/runpublishvrscreenshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
10 changes: 10 additions & 0 deletions azure-pipelines.vrt-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
workspace:
clean: all
steps:
- checkout: self
fetchDepth: 0

- template: .devops/templates/tools.yml

- bash: |
Expand Down Expand Up @@ -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'
Expand All @@ -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:
Expand All @@ -95,6 +100,9 @@ jobs:
workspace:
clean: all
steps:
- checkout: self
fetchDepth: 0

- template: .devops/templates/tools.yml

- bash: |
Expand Down Expand Up @@ -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'
Expand All @@ -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')

0 comments on commit 6d74c91

Please sign in to comment.