-
Notifications
You must be signed in to change notification settings - Fork 0
311 lines (283 loc) · 13.6 KB
/
_BuildALGoProject.yaml
File metadata and controls
311 lines (283 loc) · 13.6 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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
name: '_Build AL-Go project'
run-name: 'Build ${{ inputs.project }}'
on:
workflow_call:
inputs:
shell:
description: Shell in which you want to run the action (powershell or pwsh)
required: false
default: powershell
type: string
runsOn:
description: JSON-formatted string of the types of machine to run the build job on
required: true
type: string
checkoutRef:
description: Ref to checkout
required: false
default: ${{ github.sha }}
type: string
project:
description: Name of the built project
required: true
type: string
projectName:
description: Friendly name of the built project
required: true
type: string
skippedProjectsJson:
description: An array of AL-Go projects to skip in compressed JSON format
required: false
default: '[]'
type: string
projectDependenciesJson:
description: Dependencies of the built project in compressed Json format
required: false
default: '{}'
type: string
buildMode:
description: Build mode used when building the artifacts
required: true
type: string
baselineWorkflowRunId:
description: ID of the baseline workflow run, from where to download the current project dependencies, in case they are not built in the current workflow run
required: false
default: '0'
type: string
baselineWorkflowSHA:
description: SHA of the baseline workflow run
required: false
default: ''
type: string
secrets:
description: A comma-separated string with the names of the secrets, required for the workflow.
required: false
default: ''
type: string
artifactsRetentionDays:
description: Number of days to keep the artifacts
type: number
default: 0
artifactsNameSuffix:
description: Suffix to add to the artifacts names
required: false
default: ''
type: string
signArtifacts:
description: Flag indicating whether the apps should be signed
type: boolean
default: false
useArtifactCache:
description: Flag determining whether to use the Artifacts Cache
type: boolean
default: false
needsContext:
description: JSON formatted needs context
type: string
default: '{}'
permissions:
actions: read
contents: read
id-token: write
env:
ALGoOrgSettings: ${{ vars.ALGoOrgSettings }}
ALGoRepoSettings: ${{ vars.ALGoRepoSettings }}
jobs:
BuildALGoProject:
needs: [ ]
runs-on: ${{ fromJson(inputs.runsOn) }}
defaults:
run:
shell: ${{ inputs.shell }}
name: ${{ inputs.projectName }} (${{ inputs.buildMode }})
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ inputs.checkoutRef }}
lfs: true
- name: Read settings
uses: microsoft/AL-Go/Actions/ReadSettings@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
buildMode: ${{ inputs.buildMode }}
get: useCompilerFolder,keyVaultCodesignCertificateName,doNotSignApps,doNotRunTests,doNotRunBcptTests,doNotRunpageScriptingTests,artifact,generateDependencyArtifact,trustedSigning,useGitSubmodules
- name: Determine whether to build project
id: DetermineBuildProject
uses: microsoft/AL-Go/Actions/DetermineBuildProject@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
skippedProjectsJson: ${{ inputs.skippedProjectsJson }}
project: ${{ inputs.project }}
baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }}
- name: Read secrets
id: ReadSecrets
if: steps.DetermineBuildProject.outputs.BuildIt == 'True' && github.event_name != 'pull_request'
uses: microsoft/AL-Go/Actions/ReadSecrets@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: '${{ inputs.secrets }},appDependencySecrets,AZURE_CREDENTIALS,-gitSubmodulesToken'
- name: Checkout Submodules
if: env.useGitSubmodules != 'false' && env.useGitSubmodules != ''
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ inputs.checkoutRef }}
lfs: true
submodules: ${{ env.useGitSubmodules }}
token: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).gitSubmodulesToken }}'
- name: Determine ArtifactUrl
id: determineArtifactUrl
if: steps.DetermineBuildProject.outputs.BuildIt == 'True'
uses: microsoft/AL-Go/Actions/DetermineArtifactUrl@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
- name: Cache Business Central Artifacts
if: steps.DetermineBuildProject.outputs.BuildIt == 'True' && env.useCompilerFolder == 'True' && inputs.useArtifactCache && env.artifactCacheKey
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ${{ runner.temp }}/.artifactcache
key: ${{ env.artifactCacheKey }}
- name: Download Project Dependencies
id: DownloadProjectDependencies
if: steps.DetermineBuildProject.outputs.BuildIt == 'True'
uses: microsoft/AL-Go/Actions/DownloadProjectDependencies@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
buildMode: ${{ inputs.buildMode }}
projectDependenciesJson: ${{ inputs.projectDependenciesJson }}
baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }}
- name: Build
uses: microsoft/AL-Go/Actions/RunPipeline@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
if: steps.DetermineBuildProject.outputs.BuildIt == 'True'
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
BuildMode: ${{ inputs.buildMode }}
NeedsContext: ${{ inputs.needsContext }}
with:
shell: ${{ inputs.shell }}
artifact: ${{ env.artifact }}
project: ${{ inputs.project }}
buildMode: ${{ inputs.buildMode }}
installAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedApps }}
installTestAppsJson: ${{ steps.DownloadProjectDependencies.outputs.DownloadedTestApps }}
baselineWorkflowRunId: ${{ inputs.baselineWorkflowRunId }}
baselineWorkflowSHA: ${{ inputs.baselineWorkflowSHA }}
- name: Sign
id: sign
if: steps.DetermineBuildProject.outputs.BuildIt == 'True' && inputs.signArtifacts && env.doNotSignApps == 'False' && (env.keyVaultCodesignCertificateName != '' || (fromJson(env.trustedSigning).Endpoint != '' && fromJson(env.trustedSigning).Account != '' && fromJson(env.trustedSigning).CertificateProfile != ''))
uses: microsoft/AL-Go/Actions/Sign@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
azureCredentialsJson: '${{ fromJson(steps.ReadSecrets.outputs.Secrets).AZURE_CREDENTIALS }}'
pathToFiles: '${{ inputs.project }}/.buildartifacts/Apps/*.app'
- name: Calculate Artifact names
id: calculateArtifactsNames
uses: microsoft/AL-Go/Actions/CalculateArtifactNames@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
if: success() || failure()
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
buildMode: ${{ inputs.buildMode }}
suffix: ${{ inputs.artifactsNameSuffix }}
- name: Publish artifacts - apps
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: inputs.artifactsRetentionDays >= 0 && (hashFiles(format('{0}/.buildartifacts/Apps/*',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.AppsArtifactsName }}
path: '${{ inputs.project }}/.buildartifacts/Apps/'
if-no-files-found: ignore
retention-days: ${{ inputs.artifactsRetentionDays }}
- name: Publish artifacts - dependencies
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: inputs.artifactsRetentionDays >= 0 && env.generateDependencyArtifact == 'True' && (hashFiles(format('{0}/.buildartifacts/Dependencies/*',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.DependenciesArtifactsName }}
path: '${{ inputs.project }}/.buildartifacts/Dependencies/'
if-no-files-found: ignore
retention-days: ${{ inputs.artifactsRetentionDays }}
- name: Publish artifacts - test apps
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: inputs.artifactsRetentionDays >= 0 && (hashFiles(format('{0}/.buildartifacts/TestApps/*',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.TestAppsArtifactsName }}
path: '${{ inputs.project }}/.buildartifacts/TestApps/'
if-no-files-found: ignore
retention-days: ${{ inputs.artifactsRetentionDays }}
- name: Publish artifacts - build output
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: (success() || failure()) && (hashFiles(format('{0}/BuildOutput.txt',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.BuildOutputArtifactsName }}
path: '${{ inputs.project }}/BuildOutput.txt'
if-no-files-found: ignore
- name: Publish artifacts - container event log
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: (failure()) && (hashFiles(format('{0}/ContainerEventLog.evtx',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.ContainerEventLogArtifactsName }}
path: '${{ inputs.project }}/ContainerEventLog.evtx'
if-no-files-found: ignore
- name: Publish artifacts - test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: (success() || failure()) && (hashFiles(format('{0}/.buildartifacts/TestResults.xml',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.TestResultsArtifactsName }}
path: '${{ inputs.project }}/.buildartifacts/TestResults.xml'
if-no-files-found: ignore
- name: Publish artifacts - bcpt test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: (success() || failure()) && (hashFiles(format('{0}/.buildartifacts/bcptTestResults.json',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.BcptTestResultsArtifactsName }}
path: '${{ inputs.project }}/.buildartifacts/bcptTestResults.json'
if-no-files-found: ignore
- name: Publish artifacts - page scripting test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: (success() || failure()) && (hashFiles(format('{0}/.buildartifacts/PageScriptingTestResults.xml',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.PageScriptingTestResultsArtifactsName }}
path: '${{ inputs.project }}/.buildartifacts/PageScriptingTestResults.xml'
if-no-files-found: ignore
- name: Publish artifacts - page scripting test result details
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: (success() || failure()) && (hashFiles(format('{0}/.buildartifacts/PageScriptingTestResultDetails/*',inputs.project)) != '')
with:
name: ${{ steps.calculateArtifactsNames.outputs.PageScriptingTestResultDetailsArtifactsName }}
path: '${{ inputs.project }}/.buildartifacts/PageScriptingTestResultDetails/'
if-no-files-found: ignore
- name: Analyze Test Results
id: analyzeTestResults
if: (success() || failure()) && env.doNotRunTests == 'False'
uses: microsoft/AL-Go/Actions/AnalyzeTests@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
testType: "normal"
- name: Analyze BCPT Test Results
id: analyzeTestResultsBCPT
if: (success() || failure()) && env.doNotRunBcptTests == 'False'
uses: microsoft/AL-Go/Actions/AnalyzeTests@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
testType: "bcpt"
- name: Analyze Page Scripting Test Results
id: analyzeTestResultsPageScripting
if: (success() || failure()) && env.doNotRunpageScriptingTests == 'False'
uses: microsoft/AL-Go/Actions/AnalyzeTests@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}
testType: "pageScripting"
- name: Cleanup
if: always() && steps.DetermineBuildProject.outputs.BuildIt == 'True'
uses: microsoft/AL-Go/Actions/PipelineCleanup@ab2f5319ed073c542e03914f8ae6c0fda029ee1e
with:
shell: ${{ inputs.shell }}
project: ${{ inputs.project }}