This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathazure-pipelines.yml
152 lines (135 loc) · 5.59 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
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
150
151
152
pool:
vmImage: 'windows-latest'
steps:
- task: DotNetCoreCLI@2
displayName: 'Run unit tests'
inputs:
command: 'test'
configuration: '$(BuildConfiguration)'
projects: 'Eklee.Azure.Functions.GraphQl.Tests\Eklee.Azure.Functions.GraphQl.Tests.csproj'
arguments: --verbosity normal --filter Category=Unit
- task: AzurePowerShell@4
displayName: 'Reset Azure services for integration tests'
inputs:
azureSubscription: $(Global.ServiceConnectionName)
scriptType: 'FilePath'
scriptPath: 'Reset.ps1'
azurePowerShellVersion: 'latestVersion'
scriptArguments: -ResourceGroupName $(Global.ResourceGroupName) -Name $(Global.Name)
- task: AzurePowerShell@4
displayName: 'Prepare configuration values for integration tests'
name: prep
inputs:
azureSubscription: $(Global.ServiceConnectionName)
scriptType: 'FilePath'
scriptPath: 'ConfigureTestLocalSettings.ps1'
azurePowerShellVersion: 'latestVersion'
scriptArguments: -ResourceGroupName $(Global.ResourceGroupName) -Name $(Global.Name) -SourceRootDir $(Build.Repository.LocalPath)
- task: DotNetCoreCLI@2
displayName: Run integration tests
timeoutInMinutes: 5
inputs:
command: 'test'
configuration: '$(BuildConfiguration)'
projects: 'Eklee.Azure.Functions.GraphQl.Tests\Eklee.Azure.Functions.GraphQl.Tests.csproj'
arguments: --blame --verbosity normal --filter Category=Integration
- task: AzurePowerShell@4
displayName: 'Reset Azure services for functional tests'
inputs:
azureSubscription: $(Global.ServiceConnectionName)
scriptType: 'FilePath'
scriptPath: 'Reset.ps1'
azurePowerShellVersion: 'latestVersion'
scriptArguments: -ResourceGroupName $(Global.ResourceGroupName) -Name $(Global.Name)
- task: PowerShell@2
name: config_version
displayName: Configure release version
inputs:
targetType: filePath
filePath: 'ConfigureVersion.ps1'
arguments: -BuildId $(Build.BuildNumber)
- task: DotNetCoreCLI@2
displayName: Build Example Solution
inputs:
command: publish
projects: 'Examples\Eklee.Azure.Functions.GraphQl.Example\Eklee.Azure.Functions.GraphQl.Example.csproj'
publishWebProjects: false
arguments: --configuration=$(config_version.buildConfig) -p:Version=$(config_version.version)
- task: AzureResourceGroupDeployment@2
displayName: Build Example Environment
inputs:
azureSubscription: $(Global.ServiceConnectionName)
action: 'Create Or Update Resource Group'
resourceGroupName: $(Global.TestResourceGroupName)
location: $(Global.Location)
templateLocation: 'Linked artifact'
csmFile: '$(System.DefaultWorkingDirectory)/Templates/app.json'
overrideParameters: -plan_name $(prep.StackName)
- task: AzureCLI@2
name: test_example
displayName: Run functional tests
inputs:
azureSubscription: $(Global.ServiceConnectionName)
scriptType: ps
scriptLocation: scriptPath
scriptPath: 'TestExample.ps1'
arguments: -Path $(Build.SourcesDirectory) -BuildConfig $(config_version.buildConfig) -ReportDir $(System.DefaultWorkingDirectory) -EnvironmentPath $(Build.Repository.LocalPath) -StackName $(prep.StackName) -Location $(Global.Location) -ResourceGroupName $(Global.TestResourceGroupName)
- task: PublishTestResults@2
displayName: Publish test results
condition: or(succeeded(), failed())
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: $(System.DefaultWorkingDirectory)\*.xml
- task: AzurePowerShell@4
displayName: 'Cleanup after functional tests'
condition: or(succeeded(), failed())
inputs:
azureSubscription: $(Global.ServiceConnectionName)
scriptType: 'FilePath'
scriptPath: 'Reset.ps1'
azurePowerShellVersion: 'latestVersion'
scriptArguments: -ResourceGroupName $(Global.ResourceGroupName) -Name $(Global.Name)
- task: AzureCLI@2
displayName: 'Cleanup stack if functional tests passed'
condition: succeeded()
inputs:
azureSubscription: $(Global.ServiceConnectionName)
scriptType: ps
scriptLocation: scriptPath
scriptPath: 'CleanupExample.ps1'
arguments: -Name $(Global.Name)
- task: DotNetCoreCLI@2
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Global.DebugNuget'], 'true')))
displayName: Build
inputs:
command: build
projects: 'Eklee.Azure.Functions.GraphQl\Eklee.Azure.Functions.GraphQl.csproj'
arguments: --configuration=Release -p:Version=$(config_version.version)
- task: PowerShell@2
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Global.DebugNuget'], 'true')))
name: prep_nuget_pack
displayName: Prepare for nuget package
inputs:
targetType: filePath
filePath: 'PrepNugetPack.ps1'
arguments: -Path $(Build.SourcesDirectory)
- task: NuGetCommand@2
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Global.DebugNuget'], 'true')))
displayName: Create nuget package
inputs:
command: pack
packagesToPack: 'Eklee.Azure.Functions.GraphQl\Eklee.Azure.Functions.GraphQl.csproj'
configuration: Release
includeReferencedProjects: true
packDestination: '$(Build.ArtifactStagingDirectory)'
versioningScheme: byEnvVar
versionEnvVar: config_version.version
- task: AzureFileCopy@4
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Global.DebugNuget'], 'true')))
displayName: Upload nuget package
inputs:
sourcePath: $(Build.ArtifactStagingDirectory)/*.nupkg
azureSubscription: $(Global.ServiceConnectionName)
destination: azureBlob
storage: $(Global.Name)
containerName: packages