Multi-stage YAML pipeline with build, test and deploy stages
This file contains 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
# ASP.NET | |
# Build and test ASP.NET projects. | |
# Add steps that publish symbols, save build artifacts, deploy, and more: | |
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4 | |
trigger: | |
- main | |
pool: | |
vmImage: 'ubuntu-latest' | |
variables: | |
solution: '**/*.sln' | |
buildPlatform: 'Any CPU' | |
buildConfiguration: 'Release' | |
stages: | |
- stage: build | |
jobs: | |
- job: build | |
steps: | |
- script: dotnet build | |
displayName: 'dotnet build' | |
- script: dotnet publish -o $(build.artifactStagingDirectory) | |
displayName: 'publish artifacts' | |
- task: PublishPipelineArtifact@1 | |
inputs: | |
targetPath: $(build.artifactStagingDirectory) | |
artifact: 'drop' | |
publishLocation: 'pipeline' | |
- stage: test | |
jobs: | |
- job: test | |
steps: | |
- task: DotNetCoreCLI@2 | |
inputs: | |
command: 'test' | |
projects: '**/*[Tt]est*/*.csproj' | |
publishTestResults: true | |
arguments: '--configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura' | |
- task: PublishCodeCoverageResults@1 | |
inputs: | |
codeCoverageTool: 'Cobertura' | |
summaryFileLocation: '**/*coverage.cobertura.xml' | |
- stage: deploy_app | |
jobs: | |
- job: deploy | |
steps: | |
- task: DownloadPipelineArtifact@2 | |
inputs: | |
buildType: 'current' | |
artifactName: 'drop' | |
targetPath: '$(Pipeline.Workspace)/drop' | |
- task: AzureWebApp@1 | |
inputs: | |
azureSubscription: 'Visual Studio Enterprise MVP(97fbe79d-f21c-4cd0-b87f-8bd8df413e0a)' | |
appType: 'webAppLinux' | |
appName: 'TodoistApp' | |
package: '$(Pipeline.Workspace)/drop' | |
runtimeStack: 'DOTNETCORE|6.0' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment