-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.yml
97 lines (86 loc) · 2.93 KB
/
build.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
parameters:
- name: poolName
type: string
- name: isMaster
type: boolean
jobs:
- job: Build
displayName: 'Build Semantica.Lib'
workspace:
clean: true
pool:
vmImage: ${{ parameters.poolName }}
variables:
solution: 'Semantica.Lib.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 8.x'
inputs:
packageType: sdk
version: 8.x
installationPath: '$(Agent.ToolsDirectory)/dotnet'
# - task: NuGetToolInstaller@0
# displayName: 'Use NuGet 6.5.0'
# inputs:
# versionSpec: 6.5.0
# - task: NuGetCommand@2
# displayName: 'NuGet restore'
# inputs:
# restoreSolution: '$(solution)'
- task: DotNetCoreCLI@2
displayName: 'Restore packages'
inputs:
command: 'restore'
projects: '$(solution)'
# ########################################################
# # Build solution with dotnet build
# ##gives: error MSB1008: Only one project can be specified.
# - task: DotNetCoreCLI@2
# displayName: 'Build $(solution)'
# inputs:
# command: 'build'
# projects: '$(solution)'
# arguments: '--configuration $(buildConfiguration) --runtime $(buildPlatform) --no-restore'
# Build solution met VSBuild
- task: VSBuild@1
displayName: '$(solution) VSBuild'
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:AutoParameterizationWebConfigConnectionStrings=False /p:PackageLocation="$(build.artifactStagingDirectory)"'
restoreNugetPackages: false
#clean: false # Optional
#logProjectEvents: true # Optional
#createLogFile: false # Optional
#logFileVerbosity: 'normal' # Optional. Options: quiet, minimal, normal, detailed, diagnostic
# ########################################################
# Run Unit Tests
- task: DotNetCoreCLI@2
displayName: 'Run unit tests'
inputs:
command: 'test'
#platform: '$(buildPlatform)'
#restoreNugetPackages: false
projects: 'tst/**/*.Test.csproj'
testRunTitle: '**/*[tT]est.*'
arguments: '--configuration $(buildConfiguration) --no-build'
# ########################################################
# Package
- task: DotNetCoreCLI@2
displayName: 'Package solution'
condition: ${{ parameters.isMaster }}
inputs:
command: 'pack'
packagesToPack: 'Semantica.Lib.sln'
packDirectory: '$(Build.ArtifactStagingDirectory)/nuget'
nobuild: true
restoreNugetPackages: false
versioningScheme: 'off'
versionEnvVar: 'Build.BuildNumber'
- publish: '$(Build.ArtifactStagingDirectory)/nuget'
displayName: 'Publish NuGet packages for release'
condition: ${{ parameters.isMaster }}
artifact: 'nuget'