forked from dnnsoftware/Dnn.Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
129 lines (113 loc) · 3.27 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
pool:
vmImage: 'windows-latest'
variables:
- name: "Build.ArtifactStagingDirectory"
value: "Artifacts/"
- name: "YARN_CACHE_FOLDER"
value: "$(Pipeline.Workspace)/.yarn/cache"
parameters:
- name: "CakeTarget"
type: string
default: "BuildAll"
- name: "CakeVerbosity"
type: string
default: "Normal"
values:
- "Quiet"
- "Minimal"
- "Normal"
- "Verbose"
- "Diagnostic"
- name: "ReleaseMode"
type: string
default: "Beta"
values:
- "Alpha"
- "Beta"
- "RC"
- "Stable"
- name: "RunTests"
type: boolean
default: true
trigger:
batch: true
branches:
include:
- '*'
pr:
autoCancel: true
branches:
include:
- '*'
steps:
- task: PowerShell@2
displayName: 'Create Yarn Cache Folder'
inputs:
targetType: 'inline'
script: |
$yarnCacheFolder = "$(YARN_CACHE_FOLDER)"
if (-not (Test-Path $yarnCacheFolder)) {
Write-Host "Creating Yarn cache folder at $yarnCacheFolder"
New-Item -ItemType Directory -Path $yarnCacheFolder -Force
} else {
Write-Host "Yarn cache folder already exists."
}
- task: Cache@2
displayName: Cache Yarn packages
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: 'yarn | "$(Agent.OS)"'
path: $(YARN_CACHE_FOLDER)
- task: UseDotNet@2
displayName: 'Use .NET 8.x SDK'
inputs:
version: 8.x
- task: PowerShell@2
displayName: 'Run DNN Update Versions'
inputs:
targetType: filePath
filePath: ./build.ps1
arguments: '--target=BuildServerSetVersion --verbosity=${{ parameters.CakeVerbosity }}'
- ${{ if eq(parameters.RunTests, true) }}:
- script: 'sqllocaldb start mssqllocaldb'
displayName: 'Start Sql LocalDb Service'
- powershell: 'npm config set registry https://www.myget.org/F/dnn-software-public/npm/'
displayName: 'npm config set registry'
enabled: false
- powershell: |
$path = '.\DNN Platform\Library\Properties\AssemblyInfo.cs'
$pattern3 = '\[assembly: AssemblyStatus'
(Get-Content $path) | ForEach-Object{
if($_ -match $pattern3){
# We have found the matching line
'[assembly: AssemblyStatus(ReleaseMode.{0})]' -f '${{ parameters.ReleaseMode }}'
} else {
$_
}
} | Set-Content $path
displayName: 'Update Alpha/Beta/Stable flag'
- task: PowerShell@2
displayName: 'Run DNN Build via Cake'
inputs:
targetType: filePath
filePath: ./build.ps1
arguments: '--target=${{ parameters.CakeTarget }} --verbosity=${{ parameters.CakeVerbosity }}'
- ${{ if eq(parameters.RunTests, true) }}:
- task: PowerShell@2
displayName: 'Run Unit Tests via Cake'
inputs:
targetType: filePath
filePath: ./build.ps1
arguments: '--target=UnitTests --verbosity=${{ parameters.CakeVerbosity }}'
continueOnError: true
- task: PublishTestResults@2
displayName: 'Publish Test Results **/TestResults/*.xml'
inputs:
testResultsFormat: VSTest
testResultsFiles: '**/TestResults/*.trx'
mergeTestResults: true
failTaskOnFailedTests: true
condition: always()
- publish: 'Artifacts'
artifact: 'Artifacts$(System.JobAttempt)'
condition: always()