Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 33 additions & 104 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,104 +1,33 @@
trigger:
- master

pr:
autoCancel: true
branches:
include:
- master

stages:

# Full multi-TFM build + unit tests. The unit test project targets .NET Framework
# (net462/net472) as well as net8/net9/net10, so it needs the complete multi-TFM
# solution build. E2E and managed-identity tests run in their own stages below.
- stage: Build
displayName: 'Build & Unit Tests'
jobs:
- job: PR_build
variables:
# Load the LabAuth client certificate from the local certificate store
# (installed into LocalMachine/My by template-install-dependencies.yaml)
# instead of the msidlabs KeyVault. Microsoft-hosted agents have no managed
# identity that can read the KeyVault, so DefaultAzureCredential would fail.
# The official OneBranch/Wilson pipeline does not set this and keeps using
# the KeyVault source.
UseLabAuthCertFromStore: true
pool:
vmImage: 'windows-2022'
demands:
- msbuild
- visualstudio
steps:
- template: build/template-install-dependencies.yaml
- template: build/template-build.yaml
- template: build/template-test-unit.yaml

# Integration tests only depend on .NET 8, so build just that project and run them
# in parallel with the full Build stage (dependsOn: [] -> no dependency on Build).
- stage: IntegrationTests
displayName: 'Integration Tests (.NET 8)'
dependsOn: []
jobs:
- job: IntegrationTests
variables:
UseLabAuthCertFromStore: true
pool:
vmImage: 'windows-2022'
demands:
- msbuild
- visualstudio
steps:
- template: build/template-install-dependencies.yaml
- template: build/template-build-test-project.yaml
parameters:
Project: 'tests/Microsoft.Identity.Web.Test.Integration/Microsoft.Identity.Web.Test.Integration.csproj'
TargetFramework: 'net8.0'
- template: build/template-test-integration.yaml

# Browser/host E2E tests (excluding managed identity). The E2E projects target
# net8.0 and pull their sample apps in as project references, so build just those
# projects and run in parallel with Build (dependsOn: []).
- stage: E2ETests
displayName: 'E2E Tests (.NET 8)'
dependsOn: []
jobs:
- job: E2ETests
variables:
UseLabAuthCertFromStore: true
pool:
vmImage: 'windows-2022'
demands:
- msbuild
- visualstudio
steps:
- template: build/template-install-dependencies.yaml
- template: build/template-build-test-project.yaml
parameters:
Project: 'tests/E2E Tests/WebAppUiTests/WebAppUiTests.csproj'
TargetFramework: 'net8.0'
- template: build/template-build-test-project.yaml
parameters:
Project: 'tests/E2E Tests/TokenAcquirerTests/TokenAcquirerTests.csproj'
TargetFramework: 'net8.0'
- template: build/template-test-e2e.yaml
parameters:
# Exclude managed-identity E2E tests: they require an MI assigned to the
# host (IMDS), which Microsoft-hosted agents do not have. They run in the
# ManagedIdentityE2E stage below on the MSALMSIV2 VM pool.
e2eTestFilterCriteria: 'Category!=MI_E2E'

# Managed-identity E2E tests require a VM with an assigned managed identity (IMDS),
# which Microsoft-hosted agents do not have. They run on the MSALMSIV2 VM pool and
# build only the E2E project (.NET 8), independent of the Build stage.
- stage: ManagedIdentityE2E
displayName: 'Managed Identity E2E (MSALMSIV2)'
dependsOn: []
jobs:
- job: ManagedIdentityE2E
pool:
name: 'MSALMSIV2'
steps:
- template: build/template-run-managed-identity-e2e-tests.yaml
parameters:
TargetFramework: 'net8.0'
trigger:
- master

pr:
autoCancel: true
branches:
include:
- master

jobs:
- job: "PR_build"
variables:
# Load the LabAuth client certificate from the local certificate store
# (installed into LocalMachine/My by template-install-dependencies.yaml)
# instead of the msidlabs KeyVault. Microsoft-hosted agents have no managed
# identity that can read the KeyVault, so DefaultAzureCredential would fail.
# The official OneBranch/Wilson pipeline does not set this and keeps using
# the KeyVault source.
UseLabAuthCertFromStore: true
pool:
vmImage: 'windows-2022'
demands:
- msbuild
- visualstudio
steps:
- template: build/template-install-dependencies.yaml
- template: build/template-build.yaml
- template: build/template-run-unit-tests.yaml
parameters:
# Exclude managed-identity E2E tests: they require an MI assigned to the
# host (IMDS), which Microsoft-hosted agents do not have. They still run in
# the official OneBranch pipeline on VM-based agents that have the MI.
e2eTestFilterCriteria: 'Category!=MI_E2E'
29 changes: 0 additions & 29 deletions build/template-build-test-project.yaml

This file was deleted.

48 changes: 0 additions & 48 deletions build/template-run-managed-identity-e2e-tests.yaml

This file was deleted.

76 changes: 66 additions & 10 deletions build/template-run-unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# template-run-unit-tests.yaml
# Aggregator that runs every test suite (unit + integration + E2E) in one job.
# Kept for consumers that want the full suite in a single stage (e.g. the release
# build). The PR pipeline composes the granular templates into separate stages
# instead: template-test-unit.yaml, template-test-integration.yaml and
# template-test-e2e.yaml.
# Run all unit tests across the IdWeb project

parameters:
# VSTest filter applied to the E2E test run. Empty by default so every consumer
Expand All @@ -16,10 +12,70 @@ parameters:

steps:

- template: template-test-unit.yaml
- task: VSTest@2
displayName: 'Run unit tests'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: 'tests\Microsoft.Identity.Web.Test\bin\**\Microsoft.Identity.Web.Test.dll'
searchFolder: '$(System.DefaultWorkingDirectory)'
runInParallel: true
codeCoverageEnabled: true
failOnMinTestsNotRun: true
minimumExpectedTests: '1'
runSettingsFile: 'build\CodeCoverage.runsettings'

- template: template-test-integration.yaml
- task: VSTest@2
displayName: 'Run integration tests'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: 'tests\Microsoft.Identity.Web.Test.Integration\bin\**\Microsoft.Identity.Web.Test.Integration.dll'
searchFolder: '$(System.DefaultWorkingDirectory)'
rerunFailedTests: true
rerunMaxAttempts: '3'
runInParallel: false
codeCoverageEnabled: true
failOnMinTestsNotRun: false
minimumExpectedTests: '1'
runSettingsFile: 'build\CodeCoverage.runsettings'

- template: template-test-e2e.yaml
parameters:
e2eTestFilterCriteria: '${{ parameters.e2eTestFilterCriteria }}'
- task: VSTest@2
displayName: 'Run E2E tests'
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
tests\E2E Tests\WebAppUiTests\bin\**\WebAppUiTests.dll
tests\E2E Tests\TokenAcquirerTests\bin\**\TokenAcquirerTests.dll
tests\E2E Tests\NET 7 tests\IntegrationTests\bin\**\IntegrationTests.dll
searchFolder: '$(System.DefaultWorkingDirectory)'
testFiltercriteria: '${{ parameters.e2eTestFilterCriteria }}'
rerunFailedTests: true
rerunMaxAttempts: '3'
runInParallel: false
codeCoverageEnabled: true
failOnMinTestsNotRun: false
minimumExpectedTests: '1'
runSettingsFile: 'build\CodeCoverage.runsettings'

- task: PublishBuildArtifacts@1
displayName: 'Publish traces after test'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/tests/E2E Tests/PlaywrightTraces/'
ArtifactName: 'traces-after-tests-$(Build.BuildNumber)'
condition: failed()

# Copy all packages out to staging
- task: CopyFiles@2
displayName: 'Copy screenshots to staging directory'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/tests/E2E Tests/'
Contents: '**/*screenshotFail.png'
TargetFolder: '$(Build.ArtifactStagingDirectory)\screenshots'
flattenFolders: true
condition: failed()

- task: PublishBuildArtifacts@1
displayName: 'Publish Screenshot after test'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\screenshots'
ArtifactName: 'ScreenshotFail'
condition: failed()
55 changes: 0 additions & 55 deletions build/template-test-e2e.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions build/template-test-integration.yaml

This file was deleted.

Loading
Loading