Skip to content

Commit 45d9932

Browse files
authored
Update OB tests to use OB CI template (#5002)
* Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-Tests-libsandsamples.yaml * Update template-OneBranch-Tests-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-pack-and-sign-packages.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml * Update template-OneBranch-CI-libsandsamples.yaml
1 parent dc93a54 commit 45d9932

File tree

3 files changed

+62
-27
lines changed

3 files changed

+62
-27
lines changed

build/template-OneBranch-CI-libsandsamples.yaml

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ parameters:
66
BuildConfiguration: 'release'
77
MsalClientSemVer: '4.60.0-devopsbuild'
88
MsalSourceDir: 'microsoft-authentication-library-for-dotnet\' #Default MSAL Location
9+
Mode: 'build' # Default to 'build'
910

1011
steps:
1112

@@ -21,49 +22,82 @@ steps:
2122
inputs:
2223
version: 6.x
2324

24-
- task: DotNetCoreCLI@2
25-
displayName: 'dotnet workload restore for Desktop project'
25+
# Compute the source directory based on the parameter MsalSourceDir
26+
- task: PowerShell@2
27+
displayName: 'Compute Source Directory'
2628
inputs:
27-
command: 'custom'
28-
custom: 'workload'
29-
arguments: 'restore microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client.Desktop\Microsoft.Identity.Client.Desktop.csproj'
29+
targetType: 'inline'
30+
script: |
31+
# Compute base directory
32+
$MsalBaseDir = "$(Build.SourcesDirectory)/$(MsalSourceDir)"
33+
34+
# Check if both projects exist under MsalSourceDir
35+
$BrokerExists = Test-Path "$MsalBaseDir/src/client/Microsoft.Identity.Client.Broker"
36+
$ClientExists = Test-Path "$MsalBaseDir/src/client/Microsoft.Identity.Client"
37+
38+
# Check if both projects exist directly under Build.SourcesDirectory
39+
$AltBrokerExists = Test-Path "$(Build.SourcesDirectory)/src/client/Microsoft.Identity.Client.Broker"
40+
$AltClientExists = Test-Path "$(Build.SourcesDirectory)/src/client/Microsoft.Identity.Client"
41+
42+
if ($BrokerExists -and $ClientExists) {
43+
Write-Host "##vso[task.setvariable variable=SourceDir]$MsalBaseDir"
44+
} elseif ($AltBrokerExists -and $AltClientExists) {
45+
Write-Host "##vso[task.setvariable variable=SourceDir]$(Build.SourcesDirectory)/"
46+
} else {
47+
Write-Error "Unable to determine the correct source directory structure."
48+
exit 1
49+
}
3050
3151
- task: DotNetCoreCLI@2
32-
displayName: 'dotnet workload restore for Identity.Client'
52+
displayName: 'Restore required workloads for projects'
3353
inputs:
3454
command: 'custom'
3555
custom: 'workload'
36-
arguments: 'restore microsoft-authentication-library-for-dotnet\src\client\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj'
56+
arguments: >
57+
restore $(SourceDir)src/client/Microsoft.Identity.Client/Microsoft.Identity.Client.csproj
58+
restore $(SourceDir)src/client/Microsoft.Identity.Client.Broker/Microsoft.Identity.Client.Broker.csproj
59+
--configfile $(SourceDir)NuGet.config
3760
3861
- task: PowerShell@2
3962
displayName: Install MAUI
4063
inputs:
4164
targetType: 'inline'
4265
script: |
43-
dotnet workload install maui --source https://api.nuget.org/v3/index.json
44-
dotnet workload install android --source https://api.nuget.org/v3/index.json
66+
dotnet workload install maui --source "https://pkgs.dev.azure.com/IdentityDivision/_packaging/IDDP_PublicPackages/nuget/v3/index.json"
67+
dotnet workload install android --source "https://pkgs.dev.azure.com/IdentityDivision/_packaging/IDDP_PublicPackages/nuget/v3/index.json"
4568
46-
- task: PowerShell@2
47-
displayName: Install Chocolatey
48-
inputs:
49-
targetType: 'inline'
50-
script: |
51-
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
69+
- ${{ if eq(parameters.Mode, 'build') }}:
70+
- task: PowerShell@2
71+
displayName: Install Chocolatey
72+
inputs:
73+
targetType: 'inline'
74+
script: |
75+
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
5276
53-
- task: PowerShell@2
54-
displayName: Install Java 11
55-
inputs:
56-
targetType: 'inline'
57-
script: |
58-
choco install openjdk --version=11.0.2.01 -y
77+
- ${{ if eq(parameters.Mode, 'build') }}:
78+
- task: PowerShell@2
79+
displayName: 'Install Java 11 for Build'
80+
inputs:
81+
targetType: 'inline'
82+
script: |
83+
choco install openjdk --version=11.0.2.01 -y
84+
85+
- ${{ if eq(parameters.Mode, 'test') }}:
86+
- task: JavaToolInstaller@0
87+
displayName: 'Use Java 11 for Test'
88+
inputs:
89+
versionSpec: 11
90+
jdkArchitectureOption: x64
91+
jdkSourceOption: PreInstalled
5992

6093
- task: CmdLine@2
6194
displayName: 'Clear local NuGet cache'
6295
inputs:
6396
script: 'nuget locals all -clear'
6497

65-
- powershell: 'powershell.exe -File "$(MsalSourceDir)build\InstallAndroid.ps1" -ExecutionPolicy Bypass'
66-
displayName: 'Install Android'
98+
- ${{ if eq(parameters.Mode, 'build') }}:
99+
- powershell: 'powershell.exe -File "$(MsalSourceDir)build\InstallAndroid.ps1" -ExecutionPolicy Bypass'
100+
displayName: 'Install Android'
67101

68102
- task: VSBuild@1
69103
displayName: 'NuGet restore ${{ parameters.Solution }}'

build/template-OneBranch-Tests-libsandsamples.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ steps:
1414
inputs:
1515
version: 6.x
1616

17-
- template: template-restore-build-libsandsamples.yaml
17+
- template: template-OneBranch-CI-libsandsamples.yaml
1818
parameters:
19-
Solution: 'LibsAndSamples.sln'
19+
Solution: 'LibsAndSamples.sln'
20+
Mode: 'test'
2021

2122
# Run All Desktop Tests
2223
- template: template-run-all-tests.yaml
@@ -33,4 +34,4 @@ steps:
3334
codeCoverageEnabled: true
3435
failOnMinTestsNotRun: true
3536
minimumExpectedTests: '1'
36-
runInParallel: true
37+
runInParallel: true

build/template-pack-and-sign-packages.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ steps:
2828
targetType: 'inline'
2929
script: |
3030
dotnet nuget locals all --clear
31-
dotnet workload install android ios macos maui --source https://api.nuget.org/v3/index.json
31+
dotnet workload install android ios macos maui --source "https://pkgs.dev.azure.com/IdentityDivision/_packaging/IDDP_PublicPackages/nuget/v3/index.json"
3232
3333
- task: JavaToolInstaller@0
3434
displayName: 'Use Java 11'

0 commit comments

Comments
 (0)