-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (199 loc) · 8.71 KB
/
Current.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: ' Test Current'
on:
workflow_dispatch:
permissions:
contents: read
defaults:
run:
shell: PowerShell
env:
workflowDepth: 1
jobs:
Initialization:
runs-on: [ windows-latest ]
outputs:
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
settings: ${{ steps.ReadSettings.outputs.SettingsJson }}
projects: ${{ steps.ReadSettings.outputs.ProjectsJson }}
projectCount: ${{ steps.ReadSettings.outputs.ProjectCount }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
projectDependenciesJson: ${{ steps.ReadSettings.outputs.ProjectDependenciesJson }}
buildOrderJson: ${{ steps.ReadSettings.outputs.BuildOrderJson }}
buildOrderDepth: ${{ steps.ReadSettings.outputs.BuildOrderDepth }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialize the workflow
id: init
uses: microsoft/AL-Go-Actions/[email protected]
with:
eventId: "DO0101"
- name: Read settings
id: ReadSettings
uses: microsoft/AL-Go-Actions/[email protected]
with:
parentTelemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}
getProjects: 'Y'
- name: Determine Build Order
if: env.WorkflowDepth > 1
id: BuildOrder
run: |
$ErrorActionPreference = "STOP"
$projects = '${{ steps.ReadSettings.outputs.ProjectsJson }}' | ConvertFrom-Json
$buildOrder = '${{ steps.ReadSettings.outputs.BuildOrderJson }}' | ConvertFrom-Json
$depth = ${{ steps.ReadSettings.outputs.BuildOrderDepth }}
$workflowDepth = ${{ steps.ReadSettings.outputs.WorkflowDepth }}
if ($depth -lt $workflowDepth) {
Write-Host "::Error::Project Dependencies depth is $depth. Workflow is only setup for $workflowDepth. You need to Run Update AL-Go System Files to update the workflows"
$host.SetShouldExit(1)
}
$step = $depth
$depth..1 | ForEach-Object {
$ps = @($buildOrder."$_" | Where-Object { $projects -contains $_ })
if ($ps.Count -eq 1) {
$projectsJSon = "[$($ps | ConvertTo-Json -compress)]"
}
else {
$projectsJSon = $ps | ConvertTo-Json -compress
}
if ($ps.Count -gt 0) {
Add-Content -Path $env:GITHUB_OUTPUT -Value "Projects$($step)Json=$projectsJson"
Add-Content -Path $env:GITHUB_OUTPUT -Value "Projects$($step)Count=$($ps.count)"
Write-Host "Projects$($step)Json=$projectsJson"
Write-Host "Projects$($step)Count=$($ps.count)"
$step--
}
}
while ($step -ge 1) {
Add-Content -Path $env:GITHUB_OUTPUT -Value "Projects$($step)Json="
Add-Content -Path $env:GITHUB_OUTPUT -Value "Projects$($step)Count=0"
Write-Host "Projects$($step)Json="
Write-Host "Projects$($step)Count=0"
$step--
}
Build:
needs: [ Initialization ]
if: ${{ needs.Initialization.outputs.projectCount > 0 }}
runs-on: ${{ fromJson(needs.Initialization.outputs.githubRunner) }}
strategy:
matrix:
project: ${{ fromJson(needs.Initialization.outputs.projects) }}
fail-fast: false
name: Build ${{ matrix.project }}
outputs:
TestResultsArtifactsName: ${{ steps.calculateArtifactNames.outputs.TestResultsArtifactsName }}
BcptTestResultsArtifactsName: ${{ steps.calculateArtifactNames.outputs.BcptTestResultsArtifactsName }}
BuildOutputArtifactsName: ${{ steps.calculateArtifactNames.outputs.BuildOutputArtifactsName }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download thisbuild artifacts
if: env.WorkflowDepth > 1
uses: actions/download-artifact@v3
with:
path: '${{ github.workspace }}\.dependencies'
- name: Read settings
uses: microsoft/AL-Go-Actions/[email protected]
with:
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
project: ${{ matrix.project }}
- name: Read secrets
uses: microsoft/AL-Go-Actions/[email protected]
env:
secrets: ${{ toJson(secrets) }}
with:
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
settingsJson: ${{ env.Settings }}
secrets: 'licenseFileUrl,insiderSasToken,CodeSignCertificateUrl,CodeSignCertificatePassword,KeyVaultCertificateUrl,KeyVaultCertificatePassword,KeyVaultClientId,GitHubPackagesContext'
- name: Run pipeline
uses: microsoft/AL-Go-Actions/[email protected]
with:
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Project: ${{ matrix.project }}
ProjectDependenciesJson: ${{ needs.Initialization.outputs.projectDependenciesJson }}
settingsJson: ${{ env.Settings }}
SecretsJson: ${{ env.RepoSecrets }}
- name: Upload thisbuild artifacts - apps
if: env.WorkflowDepth > 1
uses: actions/upload-artifact@v3
with:
name: 'thisbuild-${{ matrix.project }}-Apps'
path: '${{ matrix.project }}/.buildartifacts/Apps/'
if-no-files-found: ignore
retention-days: 1
- name: Upload thisbuild artifacts - test apps
if: env.WorkflowDepth > 1
uses: actions/upload-artifact@v3
with:
name: 'thisbuild-${{ matrix.project }}-TestApps'
path: '${{ matrix.project }}/.buildartifacts/TestApps/'
if-no-files-found: ignore
retention-days: 1
- name: Calculate Artifact names
id: calculateArtifactNames
if: success() || failure()
run: |
$ErrorActionPreference = "STOP"
$settings = '${{ env.Settings }}' | ConvertFrom-Json
$project = '${{ matrix.project }}'
if ($project -eq ".") { $project = $settings.RepoName }
'TestResults','BcptTestResults','BuildOutput','ContainerEventLog' | ForEach-Object {
$name = "$($_)ArtifactsName"
$value = "$($project.Replace('\','_'))-$_-Current-$([DateTime]::UtcNow.ToString('yyyyMMdd'))"
Add-Content -Path $env:GITHUB_OUTPUT -Value "$name=$value"
Add-Content -Path $env:GITHUB_ENV -Value "$name=$value"
}
- name: Publish artifacts - build output
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',matrix.project)) != '')
with:
name: ${{ env.buildOutputArtifactsName }}
path: '${{ matrix.project }}/BuildOutput.txt'
if-no-files-found: ignore
- name: Publish artifacts - container event log
uses: actions/upload-artifact@v3
if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',matrix.project)) != '')
with:
name: ${{ env.ContainerEventLogArtifactsName }}
path: '${{ matrix.project }}/ContainerEventLog.evtx'
if-no-files-found: ignore
- name: Publish artifacts - test results
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/TestResults.xml',matrix.project)) != '')
with:
name: ${{ env.testResultsArtifactsName }}
path: '${{ matrix.project }}/TestResults.xml'
if-no-files-found: ignore
- name: Publish artifacts - bcpt test results
uses: actions/upload-artifact@v3
if: (success() || failure()) && (hashFiles(format('{0}/bcptTestResults.json',matrix.project)) != '')
with:
name: ${{ env.bcptTestResultsArtifactsName }}
path: '${{ matrix.project }}/bcptTestResults.json'
if-no-files-found: ignore
- name: Analyze Test Results
id: analyzeTestResults
if: success() || failure()
uses: microsoft/AL-Go-Actions/[email protected]
with:
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Project: ${{ matrix.project }}
- name: Cleanup
if: always()
uses: microsoft/AL-Go-Actions/[email protected]
with:
parentTelemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}
Project: ${{ matrix.project }}
PostProcess:
if: always()
runs-on: [ windows-latest ]
needs: [ Initialization, Build ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Finalize the workflow
id: PostProcess
uses: microsoft/AL-Go-Actions/[email protected]
with:
eventId: "DO0101"
telemetryScopeJson: ${{ needs.Initialization.outputs.telemetryScopeJson }}