-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
149 lines (130 loc) · 3.83 KB
/
azure-pipelines.yml
File metadata and controls
149 lines (130 loc) · 3.83 KB
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
148
149
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET.
trigger:
- master
pr:
- master
name: 1.1.$(Date:yyMM).$(Build.BuildId)
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
artifactName: 'drop'
publishOutput: '$(Build.ArtifactStagingDirectory)/webapp'
testServiceConnection: 'UC Davis CAES Test'
testWebAppName: 'tacos-test'
testEnvironmentName: 'tacos-test'
prodServiceConnection: 'UC Davis CAES Production'
prodWebAppName: 'tacosucd'
prodEnvironmentName: 'tacos-production'
stages:
- stage: Test
jobs:
- job: Test
steps:
- task: NodeTool@0
displayName: 'Use Node 22'
inputs:
versionSpec: '22.x'
- task: Npm@1
displayName: 'Install Npm Packages'
inputs:
command: 'custom'
customCommand: 'install'
workingDir: './src/tacos.mvc'
- task: UseDotNet@2
displayName: 'Use .NET 10 sdk'
inputs:
packageType: 'sdk'
useGlobalJson: true
- task: DotNetCoreCLI@2
displayName: 'Run Server Tests'
inputs:
command: 'test'
projects: './Test/Test.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: Npm@1
displayName: 'Run Client Lint'
inputs:
command: 'custom'
workingDir: './src/tacos.mvc'
customCommand: 'run lint'
- task: Npm@1
displayName: 'Run Client Tests'
inputs:
command: 'custom'
workingDir: './src/tacos.mvc'
customCommand: 'run test'
- stage: Publish
dependsOn: Test
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- job: Publish
steps:
- task: NodeTool@0
displayName: 'Use Node 22'
inputs:
versionSpec: '22.x'
- task: UseDotNet@2
displayName: 'Use .NET 10 sdk'
inputs:
packageType: 'sdk'
useGlobalJson: true
- task: DotNetCoreCLI@2
displayName: 'Publish tacos.mvc'
inputs:
command: 'publish'
publishWebProjects: false
zipAfterPublish: false
modifyOutputPath: false
projects: './src/tacos.mvc/tacos.mvc.csproj'
arguments: '--configuration $(buildConfiguration) --output $(publishOutput)'
- task: PublishPipelineArtifact@1
displayName: 'Publish web app artifact'
inputs:
targetPath: '$(publishOutput)'
artifact: '$(artifactName)'
- stage: Deploy_Test
displayName: 'Deploy Test'
dependsOn: Publish
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment: Deploy_Test
displayName: 'Deploy to test web app'
environment: '$(testEnvironmentName)'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: '$(artifactName)'
- task: AzureWebApp@1
displayName: 'Deploy tacos-test'
inputs:
azureSubscription: '$(testServiceConnection)'
appType: 'webApp'
appName: '$(testWebAppName)'
package: '$(Pipeline.Workspace)/$(artifactName)'
- stage: Deploy_Prod
displayName: 'Deploy Production'
dependsOn: Deploy_Test
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment: Deploy_Prod
displayName: 'Deploy to production web app'
environment: '$(prodEnvironmentName)'
strategy:
runOnce:
deploy:
steps:
- download: current
artifact: '$(artifactName)'
- task: AzureWebApp@1
displayName: 'Deploy tacosucd'
inputs:
azureSubscription: '$(prodServiceConnection)'
appType: 'webApp'
appName: '$(prodWebAppName)'
package: '$(Pipeline.Workspace)/$(artifactName)'