Graph-Controls/azure-pipelines.yml

87 строки
2.6 KiB
YAML

# Control which branches get CI triggers (defaults to all branches if this parameter is not set)
trigger:
- main
- dev/*
- rel/*
# Specify the target branches for pull request builds
pr:
- main
- dev/*
- rel/*
# Microsoft-hosted agent pool for Visual Studio 2022
pool:
vmImage: windows-2022
steps:
# Setup Environment Variables
- task: BatchScript@1
inputs:
filename: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"
arguments: -no_logo
modifyEnvironment: true
displayName: Setup Environment Variables
# Install Nuget Tool Installer
- task: NuGetToolInstaller@0
displayName: Use NuGet 5.11.x
inputs:
versionSpec: 5.11.x
# Install NBGV Tool
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
# Set cloud build variables
- script: nbgv cloud
displayName: Set Version
# Install Windows SDK 18362 (minimum compatible sdk)
- powershell: .\build\Install-WindowsSdkISO.ps1 22621
displayName: Insider SDK
# restore & build solution
- script: msbuild -r -target:Build -p:Configuration=CI -p:GenerateLibraryLayout=true
displayName: Restore & Build solution
# run tests
### Tests require logging in, so aren't achievable in CI with current setup. Should ask MSAL/Graph team how they mock in future.
### Leaving this here as if UnitTests.Uwp area built, this should run them.
#- script: vstest.console.exe ./UnitTests/**/*.appxrecipe /Framework:FrameworkUap10 /logger:"trx;LogFileName=VsTestResultsUwp.trx"
# displayName: Unit Tests
# publish results
#- task: PublishTestResults@2
# inputs:
# testResultsFormat: 'VSTest'
# testResultsFiles: '**/VsTestResults*.trx'
# displayName: Publish Test Results
# condition: always()
# pack solution
- script: msbuild -target:Pack -p:Configuration=CI -p:GenerateLibraryLayout=true -p:PackageOutputPath=..\bin\nupkg
displayName: Pack solution
# Sign Nuget package
- task: PowerShell@2
displayName: Authenticode Sign Packages
inputs:
filePath: build/Sign-Package.ps1
env:
SignClientUser: $(SignClientUser)
SignClientSecret: $(SignClientSecret)
ArtifactDirectory: bin\nupkg
condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], '')))
# Publish nuget package
- task: PublishBuildArtifacts@1
displayName: Publish Package Artifacts
inputs:
pathToPublish: .\bin\nupkg
artifactName: Packages