Backend/e-suite.Messaging.Common/azure-pipelinse.yml
2026-01-20 21:50:10 +00:00

81 lines
2.7 KiB
YAML

# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
#name: $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)$(prerelease) # NOTE: rev resets when the default retention period expires
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)$(prerelease) # NOTE: rev resets when the default retention period expires
trigger:
branches:
include:
- '*'
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
nugetProject: 'e-suite.Messaging.Common/e-suite.Messaging.Common.csproj'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
prerelease: ''
${{ elseif eq(variables['Build.SourceBranchName'], 'develop') }}:
prerelease: '-beta'
${{ else }}:
prerelease: '-alpha'
steps:
- task: NuGetToolInstaller@1
displayName: 'Install Nuget'
- task: NuGetCommand@2
displayName: 'Nuget Restore'
inputs:
restoreSolution: '$(solution)'
feedsToUse: config
includeNuGetOrg: true
- task: VSBuild@1
displayName: 'Build Solution'
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
displayName: 'Run Tests'
inputs:
testAssemblyVer2: |
**\*Tests.dll
!**\obj\**
runOnlyImpactedTests: false
runInParallel: true
codeCoverageEnabled: true
runSettingsFile: .runsettings
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: "Package Nuget Artifact"
inputs:
command: 'pack'
arguments: '--configuration $(buildConfiguration)'
packagesToPack: '$(nugetProject)'
nobuild: true
versionEnvVar: 'build.BuildNumber'
versioningScheme: 'byEnvVar'
#versioningScheme: byBuildNumber # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#yaml-snippet
- task: NuGetCommand@2
displayName: 'Publish Nuget Artifact'
inputs:
command: 'push'
feedsToUse: 'select'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'e-suite/e-suite'
versioningScheme: 'off'
allowPackageConflicts: true