Last active
January 12, 2024 01:48
-
-
Save Wind010/e01dff594c6ce1b0ed62ea6c81346347 to your computer and use it in GitHub Desktop.
Sample Azure Devops pipeline for .NET8+ (no pack)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#name: $(TeamProject)--$(Build.SourceBranchName)-$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) | |
name: SomeProject | |
trigger: none | |
pr: | |
branches: | |
include: | |
- "*" | |
paths: | |
include: | |
- /SomePath | |
exclude: | |
- /SomePath_TO_EXCLUDE | |
variables: | |
projectName: 'SOME_NAME' | |
solution: '**/*.sln' | |
#buildPlatform: 'Any CPU' | |
architecture: 'win-x64' | |
buildConfiguration: 'Release' | |
stages: | |
- stage: Build | |
displayName: Build | |
jobs: | |
- job: Build | |
displayName: Build | |
pool: | |
vmImage: ubuntu-latest | |
steps: | |
- task: DotNetCoreCLI@2 | |
displayName: "Restore" | |
inputs: | |
command: 'restore' | |
projects: $(solution) | |
feedsToUse: 'select' | |
vstsFeed: 'SOME_ID' | |
- task: DotNetCoreCLI@2 | |
displayName: Build | |
inputs: | |
command: 'build' | |
projects: | | |
**/*.csproj | |
configuration: $(buildConfiguration) | |
arguments: -a $(architecture) | |
- task: DotNetCoreCLI@2 | |
displayName: Test | |
inputs: | |
command: test | |
projects: '**/*.csproj' | |
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"' | |
configuration: $(buildConfiguration) | |
- task: PublishCodeCoverageResults@1 | |
displayName: 'Publish code coverage report' | |
inputs: | |
codeCoverageTool: 'Cobertura' | |
summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml' | |
- task: DotNetCoreCLI@2 | |
displayName: 'Publish Artifiacts' | |
inputs: | |
command: publish | |
projects: 'some_project.csproj' | |
arguments: '--configuration $(buildConfiguration) -a $(architecture) --output $(Build.ArtifactStagingDirectory)/$(projectName)' | |
publishWebProjects: False | |
zipAfterPublish: false | |
- task: ArchiveFiles@2 | |
displayName: "Archive files" | |
inputs: | |
rootFolderOrFile: "$(Build.ArtifactStagingDirectory)/$(projectName)" | |
includeRootFolder: false | |
archiveFile: "$(Build.ArtifactStagingDirectory)/$(projectName)_$(Build.BuildId).zip" | |
- task: PublishBuildArtifacts@1 | |
displayName: 'Upload published zip' | |
inputs: | |
PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(projectName)_$(Build.BuildId).zip' | |
artifactName: '$(projectName)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment