-
-
Notifications
You must be signed in to change notification settings - Fork 19
345 lines (304 loc) · 11.4 KB
/
ci-cd.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
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
name: FlexBridge CI/CD
on:
push:
branches: ["develop", "master"]
pull_request:
branches: ["develop", "master"]
workflow_dispatch:
inputs:
releaseType:
description: 'Alpha, Beta, Stable used to stamp release artifacts'
required: true
default: 'Alpha'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
FILESTOSIGNLATER: "${{ github.workspace }}\\filesToSign"
teamcity_build_checkoutDir: ${{ github.workspace }}
name: Build Debug / Test / Build Msi
runs-on: windows-latest
steps:
- name: Checkout Files
uses: actions/checkout@v4
id: checkout
with:
fetch-depth: 0
submodules: true
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
# We need the dotnet runtime to execute overcrowdin
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version:
8.0.x
if: github.event_name != 'pull_request'
- name: Downgrade Wix Toolset - remove when runner has 3.14.2
run: |
choco uninstall wixtoolset
choco install wixtoolset --version 3.11.2 --allow-downgrade --force
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
if: github.event_name != 'pull_request'
# If we are just doing a CI build we don't need real localizations, but the location must exist
- name: Add Fake Localizations for CI
shell: bash
run: echo > DistFiles/localizations/empty.xlf
if: github.event_name == 'pull_request'
- name: Install Latest Overcrowdin
shell: cmd
run: dotnet tool install -g overcrowdin
if: github.event_name != 'pull_request'
- name: Restore L10n Packages
shell: cmd
run: |
cd l10n
msbuild l10n.proj /t:restore
if: github.event_name != 'pull_request'
- name: Get Latest L10ns
shell: cmd
run: |
cd l10n
msbuild l10n.proj /t:GetLatestL10ns;CopyL10nsToDistFiles
if: github.event_name != 'pull_request'
- name: Restore Build Tasks & Packages
id: package_restore
shell: cmd
run: msbuild build\FLExBridge.proj /t:RestoreBuildTasks;RestorePackages
- name: Build & Test
id: build_and_test_step
shell: cmd
run: msbuild build\FLExBridge.proj /t:Test /p:Configuration=Release
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
with:
files: '**/TestResults.xml'
- name: Create NuGet packages
shell: cmd
run: msbuild build\FLExBridge.proj /t:Pack /p:Configuration=Release
- name: Upload NuGet packages to build artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: output/*nupkg
if-no-files-found: warn
# --skip-duplicate allows retrying a workflow that failed with a partial push, skipping already published packages and publishing the rest.
- name: Publish NuGet packages to nuget.org
run: |
foreach ($pkg in (Get-ChildItem -Path output -Name -Filter *nupkg)) {
dotnet nuget push output/$pkg --skip-duplicate --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json
}
env:
NUGET_API_KEY: ${{ secrets.SILLSDEV_PUBLISH_NUGET_ORG }}
if: github.event_name != 'pull_request'
continue-on-error: true
# All the following are used only when building an installer after a merge
- name: Build Msi
id: build_msi
shell: cmd
run: |
msbuild build/FLExBridge.proj /t:CleanMasterOutputDir;PreparePublishingArtifactsInternal;BuildProductBaseMsi /p:UploadFolder=${{ inputs.environment || 'Alpha' }}
if: github.event_name != 'pull_request'
# REVIEW: The .msi file is named with the version, there is probably a cleaner way to generate the correct filename
# and after completing the work to do signing of the bundles it became clear that capturing the files in the signtool wasn't necessary
- name: Prepare for msi signing
shell: bash
run: |
echo "FILES_TO_SIGN=$(cat $FILESTOSIGNLATER)" >> $GITHUB_OUTPUT
id: gathered_files
if: github.event_name != 'pull_request'
- name: upload-msi
id: upload
uses: actions/upload-artifact@v4
with:
name: FlexBridge.msi
path: ${{ steps.gathered_files.outputs.FILES_TO_SIGN }}
if-no-files-found: error
overwrite: true
if: github.event_name != 'pull_request'
sign-msi:
name: Sign FlexBridge Installer
needs: build_and_test
if: github.event_name != 'pull_request'
uses: sillsdev/codesign/.github/workflows/[email protected]
with:
artifact: FlexBridge.msi
description: 'FLEx Bridge Installer'
secrets:
certificate: ${{ secrets.CODESIGN_LSDEVSECTIGOEV }}
build-bundles:
name: Build Installer Bundles
needs: sign-msi
if: github.event_name != 'pull_request'
runs-on: windows-latest
env:
FILESTOSIGNLATER: "${{ github.workspace }}\\filesToSign"
steps:
- name: Checkout Files
uses: actions/checkout@v4
id: checkout
with:
fetch-depth: 0
submodules: true
- name: Downgrade Wix Toolset - remove when runner has 3.14.2
# See: https://github.com/actions/runner-images/issues/9667
run: |
choco uninstall wixtoolset
choco install wixtoolset --version 3.11.2 --allow-downgrade --force
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Download FlexBridge artifact
uses: actions/download-artifact@v4
with:
name: FlexBridge.msi
path: src/WiXInstaller/BaseInstallerBuild # Target directory for the downloaded artifact
- name: Build Bundles
id: build_bundles
working-directory: build
shell: cmd
run: |
msbuild FLExBridge.proj /t:RestoreBuildTasks;RestorePackages;GetDotNetFiles;CopyWixOverrides
msbuild FLExBridge.proj /t:BuildProductBaseBundles /p:Configuration=Release /p:Platform="Any CPU"
- name: Extract burn engines
id: extract_engines
working-directory: BuildDir
shell: cmd
run: |
insignia -ib FlexBridge_Offline.exe -o offline-engine.exe
insignia -ib FlexBridge_Online.exe -o online-engine.exe
- name: Upload Offline Engine
id: upload-offline-engine
uses: actions/upload-artifact@v4
with:
name: offline-engine
path: BuildDir/offline-engine.exe
if-no-files-found: error
overwrite: true
if: github.event_name != 'pull_request'
- name: Upload Offline Bundle(detatched)
id: upload-offline-bundle
uses: actions/upload-artifact@v4
with:
name: FlexBridge_Offline.exe
path: BuildDir/FlexBridge_Offline.exe
if-no-files-found: error
overwrite: true
if: github.event_name != 'pull_request'
- name: Upload Online Engine
id: upload-online-engine
uses: actions/upload-artifact@v4
with:
name: online-engine
path: BuildDir/online-engine.exe
if-no-files-found: error
overwrite: true
if: github.event_name != 'pull_request'
- name: Upload Online Bundle(detached)
id: upload-online-bundle
uses: actions/upload-artifact@v4
with:
name: FlexBridge_Online.exe
path: BuildDir/FlexBridge_Online.exe
if-no-files-found: error
overwrite: true
if: github.event_name != 'pull_request'
sign-offline-engine:
name: Sign Offline Engine
needs: build-bundles
if: github.event_name != 'pull_request'
uses: sillsdev/codesign/.github/workflows/[email protected]
with:
artifact: offline-engine
description: 'FLEx Bridge Installer'
secrets:
certificate: ${{ secrets.CODESIGN_LSDEVSECTIGOEV }}
sign-online-engine:
name: Sign Online Engine
needs: build-bundles
if: github.event_name != 'pull_request'
uses: sillsdev/codesign/.github/workflows/[email protected]
with:
artifact: online-engine
description: 'FLEx Bridge Installer'
secrets:
certificate: ${{ secrets.CODESIGN_LSDEVSECTIGOEV }}
reattach-engines:
runs-on: windows-latest
needs: [sign-offline-engine, sign-online-engine]
steps:
- name: Downgrade Wix Toolset - remove when runner has 3.14.2
run: |
choco uninstall wixtoolset
choco install wixtoolset --version 3.11.2 --allow-downgrade --force
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Download signed online engine
uses: actions/download-artifact@v4
with:
name: online-engine
- name: Download signed offline engine
uses: actions/download-artifact@v4
with:
name: offline-engine
- name: Download Online Bundle
uses: actions/download-artifact@v4
with:
name: FlexBridge_Online.exe
- name: Download Offline Bundle
uses: actions/download-artifact@v4
with:
name: FlexBridge_Offline.exe
- name: Reattach Engines
shell: cmd
run: |
insignia -ab online-engine.exe FlexBridge_Online.exe -o FlexBridge_Online.exe
insignia -ab offline-engine.exe FlexBridge_Offline.exe -o FlexBridge_Offline.exe
- name: Upload Online Bundle(attached)
id: upload-online-bundle
uses: actions/upload-artifact@v4
with:
name: FlexBridge_Online.exe
path: FlexBridge_Online.exe
if-no-files-found: error
overwrite: true
if: github.event_name != 'pull_request'
- name: Upload Offline Bundle(attached)
id: upload-offline-bundle
uses: actions/upload-artifact@v4
with:
name: FlexBridge_Offline.exe
path: FlexBridge_Offline.exe
if-no-files-found: error
overwrite: true
if: github.event_name != 'pull_request'
- name: Cleanup Offline Engine
uses: geekyeggo/delete-artifact@v5
with:
name: offline-engine
- name: Cleanup Online Engine
uses: geekyeggo/delete-artifact@v5
with:
name: online-engine
sign-offline-bundle:
name: Sign Offline Bundle
needs: reattach-engines
if: github.event_name != 'pull_request'
uses: sillsdev/codesign/.github/workflows/[email protected]
with:
artifact: FlexBridge_Offline.exe
description: 'FLEx Bridge Installer'
secrets:
certificate: ${{ secrets.CODESIGN_LSDEVSECTIGOEV }}
sign-online-bundle:
name: Sign Online Bundle
needs: reattach-engines
if: github.event_name != 'pull_request'
uses: sillsdev/codesign/.github/workflows/[email protected]
with:
artifact: FlexBridge_Online.exe
description: 'FLEx Bridge Installer'
secrets:
certificate: ${{ secrets.CODESIGN_LSDEVSECTIGOEV }}