-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathazure-pipelines.yml
111 lines (104 loc) · 3.76 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
variables:
major: 0
minor: 5
patch: 2
versionNumber: $(major).$(minor).$(patch)
debugVersionNumber: $(versionNumber)-b$(Build.BuildId)
jobs:
- job: "linting"
pool:
vmImage: 'vs2017-win2016'
steps:
# Lint commits
- script: npm install
- script: ./node_modules/.bin/commitlint-azure-pipelines
# Pre-Release Build
- job: "BuildPreRelease"
dependsOn: "linting"
condition: ne(variables['Build.SourceBranch'], 'refs/heads/master')
pool:
vmImage: 'vs2017-win2016'
displayName: "Build Pre-Release"
steps:
# Restore NuGet Packages
- script: 'dotnet restore "Kraken.WebSockets.sln"'
displayName: "Restore NuGet Packages"
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud M4cX'
organization: 'm4cx-github'
scannerMode: 'MSBuild'
projectKey: 'kraken-wsapi-dotnet'
projectName: 'kraken-wsapi-dotnet'
# Build all projects with specific version number
- script: 'dotnet build "Kraken.WebSockets.sln" -c Release --no-restore -p:Version=$(debugVersionNumber)'
displayName: 'dotnet build'
# Execute defined tests and collect code coverage
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: test/Kraken.WebSockets.Tests/Kraken.WebSockets.Tests.csproj
arguments: '--no-restore --no-build -c Release --collect "Code coverage" --settings:./codecoverage.runsettings'
# Create NuGet Package
- script: dotnet pack "src/Kraken.WebSockets/Kraken.WebSockets.csproj" -c Release --no-build --output "$(Build.ArtifactStagingDirectory)" -p:Version=$(debugVersionNumber)
displayName: "Create NuGet Package"
- task: CopyFiles@2
displayName: 'Copy Files to staging'
inputs:
SourceFolder: "./build"
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
pathtoPublish: "$(Build.ArtifactStagingDirectory)"
artifactName: "drop"
- task: SonarCloudAnalyze@1
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'
# Release Build
- job: "BuildRelease"
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
pool:
vmImage: 'vs2017-win2016'
displayName: "Build Release"
dependsOn: "linting"
steps:
# Restore NuGet Packages
- script: 'dotnet restore "Kraken.WebSockets.sln"'
displayName: "Restore NuGet Packages"
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud M4cX'
organization: 'm4cx-github'
scannerMode: 'MSBuild'
projectKey: 'kraken-wsapi-dotnet'
projectName: 'kraken-wsapi-dotnet'
# Build all projects with specific version number
- script: 'dotnet build "Kraken.WebSockets.sln" -c Release --no-restore -p:Version=$(versionNumber)'
displayName: 'dotnet build'
# Execute defined tests and collect code coverage
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: test/Kraken.WebSockets.Tests/Kraken.WebSockets.Tests.csproj
arguments: '--no-restore --no-build -c Release --collect "Code coverage" --settings:./codecoverage.runsettings'
# Create NuGet Package
- script: dotnet pack "src/Kraken.WebSockets/Kraken.WebSockets.csproj" -c Release --no-build --output "$(Build.ArtifactStagingDirectory)" -p:Version=$(versionNumber)
displayName: "Create NuGet Package"
- task: CopyFiles@2
displayName: 'Copy Files to staging'
inputs:
SourceFolder: "./build"
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
pathtoPublish: "$(Build.ArtifactStagingDirectory)"
artifactName: "drop"
- task: SonarCloudAnalyze@1
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'