uno/.azure-devops-wasm-uitests.yml

209 строки
6.0 KiB
YAML

parameters:
pool: ''
jobs:
- job: Wasm_UITests_Build
container: nv-bionic-wasm
pool:
vmImage: 'ubuntu-16.04'
variables:
NUGET_PACKAGES: $(build.sourcesdirectory)/.nuget
steps:
- checkout: self
clean: true
- task: CacheBeta@0
condition: eq(variables['enable_package_cache'], 'true')
inputs:
key: nuget | $(Agent.OS) | $(Agent.JobName) | $(build.sourcesdirectory)/**/*.csproj | $(build.sourcesdirectory)/**/Directory.Build.targets | $(build.sourcesdirectory)/**/Directory.Build.props
path: $(NUGET_PACKAGES)
displayName: Cache NuGet packages
- bash: |
source /emsdk/emsdk_env.sh
msbuild /r /p:Configuration=Release src/SamplesApp/SamplesApp.Wasm/SamplesApp.Wasm.csproj /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false
displayName: 'Build sample app'
- bash: |
msbuild /r /p:Configuration=Release src/SamplesApp/SamplesApp.UITests/SamplesApp.UITests.csproj
displayName: 'Build Tests'
- task: CopyFiles@2
displayName: 'Publish Wasm Site'
inputs:
SourceFolder: $(build.sourcesdirectory)/src/SamplesApp/SamplesApp.Wasm/bin/Release/netstandard2.0/dist
Contents: '**/*.*'
TargetFolder: $(build.artifactstagingdirectory)/site
CleanTargetFolder: false
OverWrite: false
flattenFolders: false
- task: CopyFiles@2
displayName: 'Publish Wasm UITest binaries'
inputs:
SourceFolder: $(build.sourcesdirectory)/src/SamplesApp/SamplesApp.UITests/bin/Release/net47
Contents: '**/*.*'
TargetFolder: $(build.artifactstagingdirectory)/test-bin
CleanTargetFolder: false
OverWrite: false
flattenFolders: false
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: wasm-uitest-binaries
ArtifactType: Container
- job: Wasm_UITests_Snap
dependsOn: Wasm_UITests_Build
container: nv-bionic-wasm
pool:
vmImage: 'ubuntu-16.04'
variables:
NUGET_PACKAGES: $(build.sourcesdirectory)/.nuget
steps:
- checkout: self
clean: true
- task: DownloadBuildArtifacts@0
inputs:
artifactName: wasm-uitest-binaries
downloadPath: '$(build.sourcesdirectory)/build'
- bash: |
set -euo pipefail
IFS=$'\n\t'
cd $(build.sourcesdirectory)/build/wasm-uitest-binaries/site
python server.py &
cd $(build.sourcesdirectory)/src/SamplesApp/SamplesApp.Wasm.UITests
npm install
node app
displayName: 'Running UI Tests'
- task: CopyFiles@2
displayName: 'Publish Wasm Tests results'
inputs:
SourceFolder: $(build.sourcesdirectory)/src/SamplesApp/SamplesApp.Wasm.UITests/out
Contents: '**/*.*'
TargetFolder: $(build.artifactstagingdirectory)/screenshots/wasm
CleanTargetFolder: false
OverWrite: false
flattenFolders: false
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: uitests-results
ArtifactType: Container
- job: Wasm_UITests_Automated
dependsOn: Wasm_UITests_Build
container: nv-bionic-wasm
pool:
vmImage: 'ubuntu-16.04'
variables:
NUGET_PACKAGES: $(build.sourcesdirectory)/.nuget
steps:
- checkout: self
clean: true
- task: DownloadBuildArtifacts@0
inputs:
artifactName: wasm-uitest-binaries
downloadPath: '$(build.sourcesdirectory)/build'
- bash: |
chmod +x $(build.sourcesdirectory)/build/run-automated-uitests.sh
$(build.sourcesdirectory)/build/run-automated-uitests.sh
env:
BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)"
BUILD_ARTIFACTSTAGINGDIRECTORY: "$(build.artifactstagingdirectory)"
displayName: 'Running UI Tests'
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFiles: '$(build.sourcesdirectory)/build/wasm-uitest-binaries/TestResult.xml'
testRunTitle: 'WebAssembly Test Run'
testResultsFormat: 'NUnit'
failTaskOnFailedTests: true
- task: PublishBuildArtifacts@1
condition: always()
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: uitests-results
ArtifactType: Container
- job: Wasm_UITests_Compare
dependsOn:
- Wasm_UITests_Snap
- Android_Tests
- iOS_Tests
- Wasm_UITests_Automated
pool:
vmImage: 'vs2017-win2016'
steps:
- checkout: self
clean: true
- task: NuGetToolInstaller@0
inputs:
versionSpec: 4.9.1
checkLatest: false
- task: MSBuild@1
inputs:
solution: src/Uno.UI.TestComparer/Uno.UI.TestComparer.csproj
msbuildLocationMethod: version
msbuildVersion: latest
msbuildArchitecture: x86
msbuildArguments: /r "/p:Configuration=Release"
clean: false
maximumCpuCount: true
restoreNugetPackages: false
logProjectEvents: false
createLogFile: false
- script: |
src\Uno.UI.TestComparer\bin\Release\net461\Uno.UI.TestComparer.exe "azdo" --pat="$(UITestsCompare_PAT)" --base-path="$(build.artifactstagingdirectory)" --source-branch="%GIT_SOURCEBRANCH%" --target-branch="%GIT_TARGETBRANCH%" --artifact-name="uitests-results" --artifact-inner-path="uitests-results\screenshots" --definition-name="$(Build.DefinitionName)" --project-name="$(System.TeamProject)" --server-uri="$(System.TeamFoundationCollectionUri)" --current-build="$(Build.BuildId)" --run-limit="3"
env:
GIT_TARGETBRANCH: "$(System.PullRequest.TargetBranch)"
GIT_SOURCEBRANCH: "$(Build.SourceBranch)"
displayName: 'Compare UI Tests screenshots'
condition: eq(variables['Build.Repository.Provider'], 'GitHub')
- task: PublishTestResults@2
condition: always()
inputs:
testResultsFiles: '$(build.artifactstagingdirectory)\*.xml'
testRunTitle: 'Screenshots Compare Test Run'
testResultsFormat: 'NUnit'
failTaskOnFailedTests: false
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: wasm-uitests-compare-results
ArtifactType: Container