1
1
parameters :
2
- - name : poolName
3
- displayName : Pool Name
4
- type : string
5
- default : pool-windows-2019
6
2
- name : dotnet_sdk_3_1
7
3
displayName : .NET Core 3.1
8
4
default : 3.1.x
@@ -18,6 +14,14 @@ parameters:
18
14
displayName : Test Framework
19
15
type : string
20
16
default : netcoreapp3.1
17
+ - name : testPoolName
18
+ displayName : Test Pool Name
19
+ type : string
20
+ default : pool-windows-2019
21
+ - name : testPoolVMImage
22
+ displayName : Test Pool VM Image
23
+ type : string
24
+ default : ' '
21
25
22
26
variables :
23
27
EnableTestCoverage : true
@@ -27,10 +31,36 @@ pr: none
27
31
trigger : none
28
32
29
33
jobs :
34
+ - job : Build
35
+ displayName : Build
36
+ pool : pool-windows-2019
37
+
38
+ steps :
39
+ - task : UseDotNet@2
40
+ displayName : ' Install .NET 6 SDK'
41
+ inputs :
42
+ packageType : sdk
43
+ version : ${{ parameters.dotnet_sdk_6 }}
44
+
45
+ - task : DotNetCoreCLI@2
46
+ displayName : Build Azure PowerShell Modules
47
+ inputs :
48
+ command : custom
49
+ custom : msbuild
50
+ arguments : ' build.proj -t:"Clean;Build" -p:"Configuration=Debug"'
51
+
52
+ - task : PublishPipelineArtifact@1
53
+ displayName : Publish Build Artifacts
54
+ inputs :
55
+ targetPath : artifacts
56
+ artifact : BuildArtifacts
57
+
30
58
- job : TestCoverage
59
+ dependsOn : Build
31
60
timeoutInMinutes : 600
32
61
pool :
33
- name : ${{ parameters.poolName }}
62
+ name : ${{ parameters.testPoolName }}
63
+ vmImage : ${{ parameters.testPoolVMImage }}
34
64
35
65
steps :
36
66
- task : UseDotNet@2
@@ -46,12 +76,11 @@ jobs:
46
76
targetType : filePath
47
77
filePath : ./tools/TestFx/Utilities/CommonUtility.ps1
48
78
49
- - task : DotNetCoreCLI @2
50
- displayName : Build Azure PowerShell Solution
79
+ - task : DownloadPipelineArtifact @2
80
+ displayName : Download pipeline artifacts
51
81
inputs :
52
- command : custom
53
- custom : msbuild
54
- arguments : ' build.proj -t:"Clean;Build" -p:"Configuration=Debug"'
82
+ targetPath : artifacts
83
+ artifactName : BuildArtifacts
55
84
56
85
- task : DotNetCoreCLI@2
57
86
displayName : Test SDK-Based Cmdlets
@@ -66,25 +95,18 @@ jobs:
66
95
condition : succeeded()
67
96
inputs :
68
97
pwsh : true
69
- workingDirectory : ' artifacts/Debug'
70
98
targetType : inline
71
99
script : |
72
100
Install-Module -Name Pester -RequiredVersion 4.10.1 -Force
73
- Import-Module (Join-Path -Path . -ChildPath Az.Accounts | Join-Path -ChildPath Az.Accounts.psd1) -Force
74
-
75
- $PreErrorActionPreference = $ErrorActionPreference
76
- $ErrorActionPreference = "SilentlyContinue"
77
-
78
- Get-ChildItem -Path . -Filter test-module.ps1 -File -Recurse | ForEach-Object {
79
- try {
80
- . $_ -Isolated
81
- }
82
- catch {
83
- Write-Host $_.Exception
84
- }
85
- }
86
101
87
- $ErrorActionPreference = $PreErrorActionPreference
102
+ if ($IsWindows) { $delimiter = ";" } else { $delimiter = ":" }
103
+ $rootDir = (Get-Location).Path
104
+ $debugDir = Join-Path -Path $rootDir -ChildPath "artifacts" | Join-Path -ChildPath "Debug"
105
+ $env:PSModulePath += $delimiter + $debugDir
106
+ Get-ChildItem -Path $debugDir -Filter test-module.ps1 -File -Recurse | Select-Object -ExpandProperty FullName | ForEach-Object {
107
+ Write-Host "##[section]Testing $_"
108
+ & $_
109
+ }
88
110
89
111
- task : PowerShell@2
90
112
displayName : Analyze Test Coverage
0 commit comments