-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
96 lines (83 loc) · 3.08 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
trigger:
branches:
include:
- main
variables:
solution: '**/*.sln'
projects: |
**/Beacon.WebHost.csproj
**/BeaconUI.WebApp.csproj
buildConfiguration: 'Release'
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
useGlobalJson: true
- task: DotNetCoreCLI@2
displayName: 'Restore dependencies'
inputs:
command: 'restore'
projects: '$(projects)'
- task: DotNetCoreCLI@2
displayName: 'Build'
inputs:
command: build
projects: '$(projects)'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Run tests'
inputs:
command: test
projects: '**/tests/**/*.csproj'
arguments: '--configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByFile="**/Migrations/*.cs" /p:ParallelizeTestCollections=false'
publishTestResults: true
- script: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:$(Agent.WorkFolder)\**\coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)\CodeCoverage -reporttypes:Cobertura
displayName: 'Create code coverage report'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
- task: DotNetCoreCLI@2
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
displayName: 'Install EF Core Tools'
inputs:
command: custom
custom: tool
arguments: install --global dotnet-ef
- task: DotNetCoreCLI@2
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
displayName: 'Generate Db Migrations Script'
inputs:
command: 'custom'
custom: 'ef'
arguments: migrations script --idempotent --output $(Build.ArtifactStagingDirectory)/Migrations.sql --project ./src/Server/Beacon.API/Beacon.API.csproj --startup-project ./src/Server/Beacon.WebHost/Beacon.WebHost.csproj
- task: DotNetCoreCLI@2
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
displayName: 'Publish web app'
inputs:
command: 'publish'
publishWebProjects: false
projects: |
**/Beacon.WebHost.csproj
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
- task: DotNetCoreCLI@2
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
displayName: 'Publish web app'
inputs:
command: 'publish'
publishWebProjects: false
projects: '**/*Tests.csproj'
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: false
- task: PublishBuildArtifacts@1
condition: and(succeeded(), eq(variables['Build.Reason'], 'IndividualCI'))
displayName: 'Publish artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'