-
Notifications
You must be signed in to change notification settings - Fork 773
/
Copy path.azure-devops-unit-tests.yml
92 lines (76 loc) · 3.06 KB
/
.azure-devops-unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
parameters:
poolName: ''
jobs:
- job: Unit_Tests
displayName: 'Unit Tests'
timeoutInMinutes: 90
cancelTimeoutInMinutes: 1
pool: ${{ parameters.poolName }}
strategy:
matrix:
WinUI:
UNO_UWP_BUILD: false
XAML_FLAVOR_BUILD: WinUI
variables:
CombinedConfiguration: Release|Any CPU
CI_Build: true
# Use pre-defined local nuget cache for restore
NUGET_PACKAGES: 'C:\NugetPackages'
steps:
- checkout: self
clean: true
- template: templates/nuget-cache.yml
parameters:
nugetPackages: $(NUGET_PACKAGES)
- template: templates/gitversion.yml
- template: templates/dotnet-install.yml
- template: templates/jdk-setup.yml
# We need just the .NET 8 runtime (not the SDK).
# Building with .NET 9 SDK is fine, but running the app when the TFM is net8.0 requires the .NET 8 runtime
- task: UseDotNet@2
displayName: Install .NET 8 SDK
inputs:
packageType: 'sdk'
version: '8.x'
installationPath: $(DOTNET_INSTALL_DIR)
# This task is required to run in separately to avoid hitting targets file
# caching issues with msbuild 17.3 or later
- task: DotNetCoreCLI@2
inputs:
workingDirectory: Build
arguments: Uno.UI.Build.csproj /nr:false /r /m /t:PrepareBuildAssets "/p:CombinedConfiguration=$(CombinedConfiguration)" /detailedsummary /bl:$(build.artifactstagingdirectory)\build-$(NBGV_SemVer2)-netcoremobile-prepare-$(XAML_FLAVOR_BUILD).binlog
displayName: Preparing assets
- powershell: |
Set-PSDebug -Trace 1
dotnet build build/Uno.UI.Build.csproj /m /t:BuildCIReference "/p:CombinedConfiguration=$(CombinedConfiguration)" /detailedsummary /bl:$(build.artifactstagingdirectory)/build-Reference-$(XAML_FLAVOR_BUILD).binlog
displayName: Building Reference Binaries
- pwsh: |
dotnet build src/Uno.UI-UnitTests-only.slnf -c Release -bl:$(build.artifactstagingdirectory)\unit-tests-build-$(XAML_FLAVOR_BUILD).binlog
displayName: Build unit tests solution filter
- task: PublishBuildArtifacts@1
condition: always()
retryCountOnTaskFailure: 3
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: NugetPackages-Artifacts
ArtifactType: Container
- pwsh: |
dotnet test src/Uno.UI-UnitTests-only.slnf -c Release -bl:$(build.artifactstagingdirectory)\unit-tests-run-$(XAML_FLAVOR_BUILD).binlog --no-build -- --report-trx --results-directory $(Build.SourcesDirectory)/artifacts/TestResults
displayName: Run unit tests
- task: PublishTestResults@2
displayName: Publish TRX Test Results
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '*.trx'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults'
testRunTitle: 'Unit Tests $(XAML_FLAVOR_BUILD)'
mergeTestResults: true
continueOnError: true
condition: always()
- task: PublishBuildArtifacts@1
retryCountOnTaskFailure: 3
condition: always()
inputs:
PathtoPublish: $(build.artifactstagingdirectory)
ArtifactName: unit-tests-binlogs-$(XAML_FLAVOR_BUILD)
ArtifactType: Container