-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.yaml
147 lines (128 loc) · 4.21 KB
/
build.yaml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: $(BuildDefinitionName)_$(SourceBranchName)_$(Build.Reason)_1.$(Year:yy)$(DayOfYear).$(Hours)$(Minutes)
resources:
repositories:
- repository: self
pool:
vmImage: 'windows-latest'
trigger:
branches:
include:
- /*
paths:
exclude:
- README.md
pr:
paths:
exclude:
- README.md
variables:
- name : BuildPlatform
value: 'any cpu'
- name : BuildConfiguration
value: 'release'
- name : Solution
value: '**\*.sln'
stages:
- stage: Build
displayName: Build Stage
jobs:
- job: buildjob
displayName: Build Job
steps:
- checkout: self
submodules: true
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 5.5.1'
inputs:
versionSpec: 5.5.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Solution)'
- task: Npm@1
displayName: NPM Install pnpm
inputs:
command: custom
customCommand: install -g pnpm
- task: Npm@1
displayName: 'Cache NPM Modules'
inputs:
command: custom
customCommand: run prep
- task: PowerShell@2
displayName: Prep PackageDeployer
inputs:
targetType: 'inline'
script: |
New-Item -ItemType Directory -Path .\PackageDeployer\bin\Release\ -Force
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: VSBuild@1
displayName: Build Solution
inputs:
solution: $(Solution)
vsVersion: latest
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
maximumCpuCount: true
- task: PublishPipelineArtifact@1
displayName: Publish Pipeline Artifacts
inputs:
path: $(System.DefaultWorkingDirectory)
artifact: drop
- job: testjob
displayName: Test Job
dependsOn: buildjob
steps:
- download: current
- task: VSTest@2
displayName: Run Unit Tests
inputs:
testSelector: testAssemblies
testAssemblyVer2: |
**\Plugins*\**\*test*.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: $(Pipeline.Workspace)
codeCoverageEnabled: true
runInParallel: true
runOnlyImpactedTests: true
- stage: Deployment_Staging
displayName: Deployment Staging
dependsOn: 'Build'
condition: succeeded()
jobs:
- deployment: DeployJob
displayName: Deployment Staging
environment: 'Deployment Staging'
variables:
- group: replaceRepo.D365CDEnvironment
strategy:
runOnce:
deploy:
steps:
- task: PowerShell@2
displayName: 'Deploy Solution'
inputs:
targetType: filePath
filePath: '$(Pipeline.Workspace)/drop/Solutions/bin/Release/Scripts/SolutionDeploy.ps1'
arguments: '-DeployServerUrl $(d365url) -UserName $(d365username) -Password $(d365password) -PipelinePath $(Pipeline.Workspace)'
# - stage: Test
# displayName: Test
# dependsOn: 'Deployment_Staging'
# condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'),notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI','PullRequest'))
# jobs:
# - deployment: DeployJob
# displayName: Test
# environment: 'Test'
# variables:
# - group: replaceRepo.D365TestEnvironment
# strategy:
# runOnce:
# deploy:
# steps:
# - task: PowerShell@2
# displayName: 'Deploy Solution'
# inputs:
# targetType: filePath
# filePath: '$(Pipeline.Workspace)/drop/Solutions/bin/Release/Scripts/SolutionDeploy.ps1'
# arguments: '-DeployServerUrl $(d365url) -UserName $(d365username) -Password $(d365password) -PipelinePath $(Pipeline.Workspace)'