forked from ameyer505/D365FOAdminToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (170 loc) · 6.48 KB
/
build.yml
File metadata and controls
200 lines (170 loc) · 6.48 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
on:
pull_request:
# every day at half past 3 am
schedule:
- cron: '30 3 * * *'
push:
branches:
- dev
workflow_dispatch:
inputs:
version:
description: 'Select FSCM Version. Use wildcard * to let settings .json files decide.'
required: false
default: '10.0.40'
includeTestModels:
type: boolean
default: false
description: Include test models
permissions:
contents: read
defaults:
run:
shell: pwsh
env:
FORCE_COLOR: 3
jobs:
Initialization:
runs-on: [ windows-latest ]
outputs:
type: ${{ steps.ReadSettings.outputs.type }}
source_branch: ${{ steps.ReadSettings.outputs.source_branch }}
versions: ${{ steps.ReadSettings.outputs.VersionsJson }}
environments: ${{ steps.ReadSettings.outputs.EnvironmentsJson }}
githubRunner: ${{ steps.ReadSettings.outputs.GitHubRunnerJson }}
steps:
- name: Support longpaths
run: git config --system core.longpaths true
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Initialize the workflow
uses: fscpscollaborative/fscps.gh/WorkflowInitialize@v2.1
id: init
env:
secrets: ${{ toJson(secrets) }}
- name: Read settings
id: ReadSettings
uses: fscpscollaborative/fscps.gh/ReadSettings@v2.1
with:
version: ${{ inputs.version }}
BuildDotNet:
needs: [ Initialization ]
runs-on: ${{ fromJson(needs.Initialization.outputs.githubRunner) }}
strategy:
matrix:
version: ${{ fromJson(needs.Initialization.outputs.versions) }}
fail-fast: false
name: Build .NET ${{ matrix.version }}
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: nuget/setup-nuget@v2
- name: Restore FSC Nugets
uses: fscpscollaborative/fscps.gh/RestoreFSCNuget@v2.1
with:
version: ${{ matrix.version }}
packagesDirectory: '${{ github.workspace }}/Project/D365FOAdminToolkit/packages'
- name: List FSC packages (debug)
if: runner.debug == '1'
run: ls -R Project/D365FOAdminToolkit/packages
- name: Find and show packages.config (debug)
if: runner.debug == '1'
run: |
Get-ChildItem -Path / -Filter 'packages.config' -Recurse | ForEach-Object {
Write-Host "***Showing content of: $($_.FullName)***";
Get-Content $_.FullName
}
- name: Find and show NuGet.config files (debug)
if: runner.debug == '1'
run: |
Get-ChildItem -Path / -Filter 'nuget.config' -Recurse | ForEach-Object {
Write-Host "***Showing content of: $($_.FullName)***";
Get-Content $_.FullName
}
- name: Restore NuGet packages
run: nuget restore Project/D365FOAdminToolkit/D365FOAdminToolkitNET/D365FOAdminToolkitNET.csproj -PackagesDirectory Project/D365FOAdminToolkit/packages
- name: List packages (debug)
if: runner.debug == '1'
run: ls -R Project/D365FOAdminToolkit/packages
- name: Build
run: msbuild Project/D365FOAdminToolkit/D365FOAdminToolkitNET/D365FOAdminToolkitNET.csproj /p:VersionSuffix=pr /p:Configuration=Release /p:Version=0.0.0.${{ github.event.pull_request.number }} /p:InformationalVersion=0.0.0.${{ github.event.pull_request.number }}-pr -fileLogger
- name: Upload D365FOAdminToolkitNET
uses: actions/upload-artifact@v4
with:
name: D365FOAdminToolkitNET
path: Project/D365FOAdminToolkit/D365FOAdminToolkitNET/bin/Release
Build:
needs: [ Initialization, BuildDotNet ]
runs-on: ${{ fromJson(needs.Initialization.outputs.githubRunner) }}
strategy:
matrix:
version: ${{ fromJson(needs.Initialization.outputs.versions) }}
fail-fast: false
name: Build ${{ matrix.version }}
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Download D365FOAdminToolkitNET
uses: actions/download-artifact@v4
with:
name: D365FOAdminToolkitNET
path: Metadata/D365FOAdminToolkit/bin
- name: Read settings
uses: fscpscollaborative/fscps.gh/ReadSettings@v2.1
with:
version: ${{ matrix.version }}
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: nuget/setup-nuget@v2
with:
nuget-version: 5.10.x
- name: Run pipeline
uses: fscpscollaborative/fscps.gh/RunPipeline@v2.1
id: runpipeline
with:
type: ${{ needs.Initialization.outputs.type}}
version: ${{ matrix.version }}
settingsJson: ${{ env.Settings }}
secretsJson: ${{ env.RepoSecrets }}
- name: Unzip package
run: Expand-Archive -Path ${{ env.ARTIFACTS_PATH }}/*.zip -Destination ${{ env.ARTIFACTS_PATH }}/${{ env.PACKAGE_NAME }}
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.ARTIFACTS_PATH }}/${{ env.PACKAGE_NAME }}
- name: Add logs to job summary
run: |
$logFiles = Get-ChildItem -Path "${{ env.ARTIFACTS_PATH }}\Logs" -Recurse -Filter *.log
$summary = "# Logs `n`n"
if ($logFiles) {
foreach ($logFile in $logFiles) {
$content = Get-Content -Path $logFile
$summary += "## $logFile `n"
foreach ($line in $content) {
# if the line consists only of = or - characters
# (which would be interpreted as a setext heading
# (https://github.github.com/gfm/#setext-headings)),
# add a new line before it
if ($line -match "^[=-]+$") {
$summary += "`n$line`n"
} else {
$summary += $line + "`n"
}
}
}
}
$summary >> $env:GITHUB_STEP_SUMMARY
PostProcess:
if: ${{ !cancelled() }}
runs-on: ${{ fromJson(needs.Initialization.outputs.githubRunner) }}
needs: [ Initialization, Build ]
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Read settings
uses: fscpscollaborative/fscps.gh/ReadSettings@v2.1