-
-
Notifications
You must be signed in to change notification settings - Fork 535
813 lines (765 loc) · 44.5 KB
/
CI_windows.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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
name: Windows
on:
push:
branches-ignore:
- 'l10n_**' # Push events to translation service branches (that begin with "l10n_")
pull_request:
# Match all pull requests...
paths-ignore:
# Except some text-only files / documentation
- 'ChangeLog'
# Except those that only include changes to stats
- 'data/base/stats/**'
- 'data/mp/stats/**'
- 'data/mp/multiplay/script/functions/camTechEnabler.js'
# Support running after "Draft Tag Release" workflow completes, as part of automated release process
workflow_run:
workflows: ["Draft Tag Release"]
push:
tags:
- '*'
types:
- completed
jobs:
windows-build:
strategy:
matrix:
include:
- compiler: "MSVC_2022"
architecture: "x86"
artifact_description: "msvc_x86"
deploy_release: false
support_sentry : true
- compiler: "MSVC_2022"
architecture: "x64"
artifact_description: "msvc_x64"
deploy_release: false
support_sentry : true
# - compiler: "MSVC_2022"
# architecture: "arm64"
# artifact_description: "msvc_arm64"
# deploy_release: false
- compiler: "LLVM_MINGW"
architecture: "x86"
deploy_release: true
support_sentry : true
sentry_backend: breakpad
- compiler: "LLVM_MINGW"
architecture: "x64"
deploy_release: true
support_sentry : true
- compiler: "LLVM_MINGW"
architecture: "arm64"
deploy_release: true
support_sentry : true
sentry_backend: breakpad
fail-fast: false
env:
WZ_COMPILER_VER: ${{ matrix.compiler }}
WZ_TARGET_ARCH: ${{ matrix.architecture }}
VSCMD_SKIP_SENDTELEMETRY: 1
# MSVC parallel builds: https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/
UseMultiToolTask: true
EnforceProcessCountAcrossBuilds: true
name: '${{ matrix.architecture }} [${{ matrix.compiler }}]'
permissions:
contents: write # Needed to upload to releases
runs-on: windows-2022
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
path: 'src'
- name: Configure Repo Checkout
id: checkout-config
working-directory: '${{ github.workspace }}\src'
shell: bash
env:
WORKFLOW_RUN_CONCLUSION: ${{ github.event.workflow_run.conclusion }}
WORKFLOW_RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
. .ci/githubactions/checkout_config.sh
- name: Prepare Git Repo for autorevision
working-directory: '${{ github.workspace }}\src'
run: cmake -P .ci/githubactions/prepare_git_repo.cmake
- name: Init Git Submodules
working-directory: '${{ github.workspace }}\src'
run: git submodule update --init --recursive
# Workaround for https://github.com/actions/runner-images/issues/8598:
- name: Remove Strawberry Perl from PATH
run: |
$env:PATH = $env:PATH -replace "C:\\Strawberry\\c\\bin;", ""
"PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append
# - name: Output Runner Environment Information
# run: |
# Write-Host "------------------------------------------------------"
# Write-Host "Environment Variables"
# Write-Host "------------------------------------------------------"
# & gci env:* | sort-object name
- name: Install Asciidoctor
id: asciidoctor-dl
run: |
echo "Installing Asciidoctor"
gem install asciidoctor -v 2.0.16 --no-document | Out-Null
echo "Installing Asciidoctor... finished"
$AsciidoctorBat = (Get-Command asciidoctor.bat).Path
echo "Asciidoctor.bat: ${AsciidoctorBat}"
$AsciidoctorBatPath = Split-Path -Path "${AsciidoctorBat}"
echo "Asciidoctor.bat path: ${AsciidoctorBatPath}"
echo "ASCIIDOCTOR_PATH=${AsciidoctorBatPath}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Install NSIS
run: choco install nsis -y
- name: Generate Settings for Run [${{ matrix.compiler }}:${{ matrix.architecture }}]
id: settings
env:
BUILD_SENTRY_SUPPORT: ${{ matrix.support_sentry }}
run: |
# Basic variable setup
# --------------------
$WZ_VC_TARGET_PLATFORMNAME = "$env:WZ_TARGET_ARCH"
$WZ_BUILD_DESC = "win_${env:WZ_TARGET_ARCH}"
if (-not ([string]::IsNullOrEmpty("${{ matrix.artifact_description }}")))
{
$WZ_BUILD_DESC = "win_${{ matrix.artifact_description }}"
}
if ($env:WZ_COMPILER_VER -eq "LLVM_MINGW") {
$WZ_USING_MINGW = "true"
if ($env:WZ_TARGET_ARCH -eq "x86") {
$VCPKG_DEFAULT_TRIPLET = "x86-mingw-dynamic"
$WZ_MINGW_PKG_PREFIX = "i686-w64-mingw32"
$WZ_ASM_MASM_COMPILER = "llvm-ml"
}
elseif ($env:WZ_TARGET_ARCH -eq "x64") {
$VCPKG_DEFAULT_TRIPLET = "x64-mingw-dynamic"
$WZ_MINGW_PKG_PREFIX = "x86_64-w64-mingw32"
$WZ_ASM_MASM_COMPILER = "llvm-ml;-m64"
}
elseif ($env:WZ_TARGET_ARCH -eq "arm64") {
$VCPKG_DEFAULT_TRIPLET = "arm64-mingw-dynamic"
$WZ_MINGW_PKG_PREFIX = "aarch64-w64-mingw32"
# llvm-ml does not support arm64
# Will need to use a similar workaround as Chromium's build process
# and use the armasm64.exe tool from MSVC
}
}
else {
$WZ_USING_MINGW = "false"
if ($env:WZ_TARGET_ARCH -eq "x86") {
$VCPKG_DEFAULT_TRIPLET = "x86-windows"
$WZ_VC_TARGET_PLATFORMNAME = "Win32" # special case, map "x86" -> "Win32"
}
elseif ($env:WZ_TARGET_ARCH -eq "x64") {
$VCPKG_DEFAULT_TRIPLET = "x64-windows"
}
elseif ($env:WZ_TARGET_ARCH -eq "arm64") {
$VCPKG_DEFAULT_TRIPLET = "arm64-windows"
}
}
$VCPKG_DEFAULT_HOST_TRIPLET = "x64-windows"
$WZ_FULL_POWERSHELL_PATH = (Get-Command powershell.exe).Path
$WZ_FULL_GIT_PATH = Split-Path -Path ((Get-Command git.exe).Path)
echo "WZ_FULL_GIT_PATH=${WZ_FULL_GIT_PATH}"
$WZ_FULL_CMAKE_PATH = Split-Path -Path ((Get-Command cmake.exe).Path)
echo "WZ_FULL_CMAKE_PATH=${WZ_FULL_CMAKE_PATH}"
$WZ_FULL_MSGMERGE_PATH = Split-Path -Path ((Get-Command msgmerge.exe).Path)
echo "WZ_FULL_MSGMERGE_PATH=${WZ_FULL_MSGMERGE_PATH}"
$WZ_FULL_MSGFMT_PATH = Split-Path -Path ((Get-Command msgfmt.exe).Path)
echo "WZ_FULL_MSGFMT_PATH=${WZ_FULL_MSGFMT_PATH}"
# ------------------------------
# MSVC version / generator info
$WZ_VISUAL_STUDIO_INSTALL_PATH = ""
if ($env:WZ_COMPILER_VER -eq "MSVC_2022") {
$WZ_VC_GENERATOR = "Visual Studio 17 2022"
#$env:WZ_VC_TOOLCHAIN = "v143"
# Get the installation path for a specific version of MSVC (2022)
$WZ_VISUAL_STUDIO_INSTALL_PATH = & "vswhere.exe" -latest -property installationPath -version "[17.0,18.0)"
if ($LastExitCode -ne 0)
{
echo "::warning ::Could not find MSVC 2022"
$WZ_VISUAL_STUDIO_INSTALL_PATH = ""
}
}
elseif ($env:WZ_COMPILER_VER -eq "MSVC_2019") {
$WZ_VC_GENERATOR = "Visual Studio 16 2019"
#$env:WZ_VC_TOOLCHAIN = "v142"
# Get the installation path for a specific version of MSVC (2019)
$WZ_VISUAL_STUDIO_INSTALL_PATH = & "vswhere.exe" -latest -property installationPath -version "[16.0,17.0)"
if ($LastExitCode -ne 0)
{
echo "::warning ::Could not find MSVC 2019"
$WZ_VISUAL_STUDIO_INSTALL_PATH = ""
}
}
elseif ($env:WZ_COMPILER_VER -eq "MSVC_2017") {
$WZ_VC_GENERATOR = "Visual Studio 15 2017"
#$env:WZ_VC_TOOLCHAIN = "v141"
# Get the installation path for a specific version of MSVC (2017)
$WZ_VISUAL_STUDIO_INSTALL_PATH = & "vswhere.exe" -latest -property installationPath -version "[15.0,16.0)"
if ($LastExitCode -ne 0)
{
echo "::warning ::Could not find MSVC 2017"
$WZ_VISUAL_STUDIO_INSTALL_PATH = ""
}
}
if ([string]::IsNullOrWhitespace(${WZ_VISUAL_STUDIO_INSTALL_PATH}))
{
$WZ_VISUAL_STUDIO_INSTALL_PATH = & "vswhere.exe" -latest -property installationPath
if ($env:WZ_COMPILER_VER -ne "LLVM_MINGW") {
echo "::warning ::Default to 'latest' MSVC: `"${WZ_VISUAL_STUDIO_INSTALL_PATH}`""
}
}
$WZ_VISUAL_STUDIO_INSTALL_VERSION = & "vswhere.exe" -path "${WZ_VISUAL_STUDIO_INSTALL_PATH}" -property installationVersion
echo "WZ_VISUAL_STUDIO_INSTALL_VERSION = ${WZ_VISUAL_STUDIO_INSTALL_VERSION}"
$VCPKG_VISUAL_STUDIO_PATH = "${WZ_VISUAL_STUDIO_INSTALL_PATH}"
#$CMAKE_GENERATOR_INSTANCE = "${WZ_VISUAL_STUDIO_INSTALL_PATH}"
# -------------
# Sentry crash-handler support
$WZ_ENABLE_SENTRY = "false"
if ("${env:BUILD_SENTRY_SUPPORT}" -eq "true") {
# Fully enable for master branch pushes (development builds) and workflow runs (draft tag release builds)
if (("${env:GITHUB_EVENT_NAME}" -eq "push") -and ("${env:GITHUB_REF}" -eq "refs/heads/master")) {
$WZ_ENABLE_SENTRY = "true"
}
elseif (("${env:GITHUB_EVENT_NAME}" -eq "workflow_run")) {
$WZ_ENABLE_SENTRY = "true"
}
}
# -------------
# Distributor
$WZ_DISTRIBUTOR = "UNKNOWN"
if (${env:GITHUB_REPOSITORY} -eq "Warzone2100/warzone2100") {
$WZ_DISTRIBUTOR = "wz2100.net"
}
# ----------------
# Determine vcpkg binary cache directory
$VCPKG_BINARYCACHE_DIR = "${{ github.workspace }}\vcpkg_cache"
$VCPKG_BINARY_SOURCES = "clear;files,${VCPKG_BINARYCACHE_DIR},readwrite"
echo "VCPKG_BINARYCACHE_DIR = ${VCPKG_BINARYCACHE_DIR}"
# ----------------
# Export Variables
$WZ_REPO_PATH = "${{ github.workspace }}\src"
# Export everything important to environment variables (for future steps)
echo "WZ_USING_MINGW=${WZ_USING_MINGW}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_MINGW_PKG_PREFIX=${WZ_MINGW_PKG_PREFIX}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_ASM_MASM_COMPILER=${WZ_ASM_MASM_COMPILER}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_FULL_POWERSHELL_PATH=${WZ_FULL_POWERSHELL_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_FULL_GIT_PATH=${WZ_FULL_GIT_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_FULL_CMAKE_PATH=${WZ_FULL_CMAKE_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_FULL_MSGMERGE_PATH=${WZ_FULL_MSGMERGE_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_FULL_MSGFMT_PATH=${WZ_FULL_MSGFMT_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_REPO_PATH=${WZ_REPO_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_ENABLE_SENTRY=${WZ_ENABLE_SENTRY}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_REPO_PATH=${WZ_REPO_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VCPKG_DEFAULT_TRIPLET=${VCPKG_DEFAULT_TRIPLET}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VCPKG_DEFAULT_HOST_TRIPLET=${VCPKG_DEFAULT_HOST_TRIPLET}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "WZ_VC_TARGET_PLATFORMNAME=${WZ_VC_TARGET_PLATFORMNAME}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "WZ_BUILD_DESC=${WZ_BUILD_DESC}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_BUILD_DESC=${WZ_BUILD_DESC}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "WZ_VC_GENERATOR=${WZ_VC_GENERATOR}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
#echo "WZ_VC_TOOLCHAIN=${WZ_VC_TOOLCHAIN}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "WZ_VISUAL_STUDIO_INSTALL_PATH=${WZ_VISUAL_STUDIO_INSTALL_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "WZ_VISUAL_STUDIO_INSTALL_VERSION=${WZ_VISUAL_STUDIO_INSTALL_VERSION}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "VCPKG_VISUAL_STUDIO_PATH=${VCPKG_VISUAL_STUDIO_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "WZ_DISTRIBUTOR=${WZ_DISTRIBUTOR}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VCPKG_BINARYCACHE_DIR=${VCPKG_BINARYCACHE_DIR}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VCPKG_BINARY_SOURCES=${VCPKG_BINARY_SOURCES}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
#####################################################
- name: 'Download & Install Vulkan SDK'
run: |
Start-Sleep -Milliseconds 1 # See: https://stackoverflow.com/a/49859001
$VerbosePreference = "Continue"
. "${env:WZ_REPO_PATH}\.ci\powershell\request.ps1"
Write-Host "Current value of env:VULKAN_SDK:${env:VULKAN_SDK}"
$VULKAN_DL_URL = "https://sdk.lunarg.com/sdk/download/1.3.231.1/windows/VulkanSDK-1.3.231.1-Installer.exe?Human=true"
$VULKAN_DL_SHA256 = "ffdf442893761a453499d612d86534a02573c3d2b2442b40311b69a4b2518bf2"
$VK_DL_BASEDIR = "${{ github.workspace }}\dl"
$VK_DL_PATH = "${VK_DL_BASEDIR}\vulkan.exe"
New-Item -ItemType Directory -Force -Path "$VK_DL_BASEDIR"
$req = Req -Params @{ 'Method'='GET';'Uri'="$VULKAN_DL_URL";'OutFile'="${VK_DL_PATH}" } -Retries 3 -SecondsDelay 10 -ExpectedHash "${VULKAN_DL_SHA256}" -Algorithm SHA256
Write-Host "Running Vulkan SDK installer..."
Start-Process "${VK_DL_PATH}" -ArgumentList "--accept-licenses","--default-answer","--confirm-command","install" -Wait
Write-Host "Vulkan SDK installer completed"
$machineEnvironment = [Environment]::GetEnvironmentVariables("Machine")
if (-not ($machineEnvironment.Contains("VULKAN_SDK")))
{
Write-Error "Failed to find updated VULKAN_SDK system environment variable"
}
Write-Host "New system VULKAN_SDK environment variable: $($machineEnvironment["VULKAN_SDK"])"
# Ensure future steps pick up the new VULKAN_SDK environment variable
echo "VULKAN_SDK=$($machineEnvironment["VULKAN_SDK"])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: 'Check environment'
run: |
if ([string]::IsNullOrWhitespace(${env:VULKAN_SDK}))
{
Write-Error "Missing env:VULKAN_SDK in next step: ${env:VULKAN_SDK}"
}
else
{
# Verify the VULKAN_SDK path exists
if (-not (Test-Path "${env:VULKAN_SDK}"))
{
Write-Error "env:VULKAN_SDK path does not exist: `"${env:VULKAN_SDK}`""
}
}
Write-Output "env:VULKAN_SDK configured for the following steps: `"${env:VULKAN_SDK}`""
- name: Create directories
run: |
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\build"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\portable"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\installer"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\debugsymbols"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\archive"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\error_logs"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\output\sentry_source_bundles"
New-Item -ItemType Directory -Force -Path "${{ github.workspace }}\sentry_artifacts"
- name: 'Download & Install Ninja-Build'
id: ninja-dl
run: |
Start-Sleep -Milliseconds 1 # See: https://stackoverflow.com/a/49859001
$VerbosePreference = "Continue"
. "${env:WZ_REPO_PATH}\.ci\powershell\request.ps1"
Write-Host "Current value of env:VULKAN_SDK:${env:VULKAN_SDK}"
$NINJA_DL_URL = "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip"
$NINJA_DL_SHA512 = "a700e794c32eb67b9f87040db7f1ba3a8e891636696fc54d416b01661c2421ff46fa517c97fd904adacdf8e621df3e68ea380105b909ae8b6651a78ae7eb3199"
$NINJA_DL_BASEDIR = "${{ github.workspace }}\dl"
$NINJA_DL_PATH = "${NINJA_DL_BASEDIR}\ninja-win.zip"
if (!(Test-Path -Path "$NINJA_DL_BASEDIR")) { New-Item -ItemType Directory -Force -Path "$NINJA_DL_BASEDIR" }
$req = Req -Params @{ 'Method'='GET';'Uri'="$NINJA_DL_URL";'OutFile'="${NINJA_DL_PATH}" } -Retries 3 -SecondsDelay 10
$ninja_zip_hash = Get-FileHash -LiteralPath "${NINJA_DL_PATH}" -Algorithm SHA512
if ($ninja_zip_hash.Hash -eq $NINJA_DL_SHA512) {
Write-Host "Successfully downloaded Ninja-Build .zip"
} Else {
Write-Error "The downloaded Ninja-build zip hash '$($ninja_zip_hash.Hash)' does not match the expected hash: '$NINJA_DL_SHA512'"
}
Write-Host "Extracting Ninja-Build..."
$NINJA_INSTALL_PATH = "${{ github.workspace }}\buildtools\ninja"
New-Item -ItemType Directory -Force -Path "${NINJA_INSTALL_PATH}"
Expand-Archive -LiteralPath "${NINJA_DL_PATH}" -DestinationPath "${NINJA_INSTALL_PATH}"
# Export the NINJA executable path
echo "NINJA_INSTALL_PATH=${NINJA_INSTALL_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "NINJA_INSTALL_PATH=${NINJA_INSTALL_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup LLVM-MINGW
if: success() && (steps.settings.outputs.WZ_USING_MINGW == 'true')
run: |
Start-Sleep -Milliseconds 1 # See: https://stackoverflow.com/a/49859001
$VerbosePreference = "Continue"
. "${env:WZ_REPO_PATH}\.ci\powershell\request.ps1"
$LLVM_MINGW_RELEASE = "20230614";
$LLVM_MINGW_PKG = "llvm-mingw-${LLVM_MINGW_RELEASE}-ucrt-x86_64"
$LLVM_MINGW_DL_URL = "https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_RELEASE}/${LLVM_MINGW_PKG}.zip"
$LLVM_MINGW_DL_SHA512 = "880429f4ef91cb079d64bfb56ef02ca1170cecc082c229d7fb6b02f4ed70a70e64d18e7ca61e95c47e483a970fb3996c5265c95c2dc118bb2fc97e28fd36c2e7"
$LLVM_MINGW_DL_BASEDIR = "${{ github.workspace }}\dl"
$LLVM_MINGW_DL_PATH = "${LLVM_MINGW_DL_BASEDIR}\llvm-mingw.zip"
if (!(Test-Path -Path "$LLVM_MINGW_DL_BASEDIR")) { New-Item -ItemType Directory -Force -Path "$LLVM_MINGW_DL_BASEDIR" }
$req = Req -Params @{ 'Method'='GET';'Uri'="$LLVM_MINGW_DL_URL";'OutFile'="${LLVM_MINGW_DL_PATH}" } -Retries 3 -SecondsDelay 10
$dl_zip_hash = Get-FileHash -LiteralPath "${LLVM_MINGW_DL_PATH}" -Algorithm SHA512
if ($dl_zip_hash.Hash -eq $LLVM_MINGW_DL_SHA512) {
Write-Host "Successfully downloaded LLVM-mingw .zip"
} Else {
Write-Error "The downloaded LLVM-mingw zip hash '$($dl_zip_hash.Hash)' does not match the expected hash: '$LLVM_MINGW_DL_SHA512'"
}
Write-Host "Extracting LLVM-mingw..."
$LLVM_MINGW_INSTALL_PATH = "${{ github.workspace }}\buildtools\llvm-mingw"
New-Item -ItemType Directory -Force -Path "${LLVM_MINGW_INSTALL_PATH}"
Expand-Archive -LiteralPath "${LLVM_MINGW_DL_PATH}" -DestinationPath "${LLVM_MINGW_INSTALL_PATH}"
# Export the LLVM-mingw install path
$LLVM_MINGW_INSTALL_PATH = "${LLVM_MINGW_INSTALL_PATH}\${LLVM_MINGW_PKG}"
echo "LLVM_MINGW_INSTALL_PATH=${LLVM_MINGW_INSTALL_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "LLVM_MINGW_INSTALL_PATH=${LLVM_MINGW_INSTALL_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Prepend bin path to the system PATH
echo "Path to LLVM-mingw bin folder: ${LLVM_MINGW_INSTALL_PATH}\bin"
echo "${LLVM_MINGW_INSTALL_PATH}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Prep MINGW Environment
id: mingwsettings
if: success() && (steps.settings.outputs.WZ_USING_MINGW == 'true')
working-directory: '${{ github.workspace }}\build'
env:
WZ_FULL_GIT_PATH: ${{ steps.settings.outputs.WZ_FULL_GIT_PATH }}
NINJA_INSTALL_PATH: ${{ steps.ninja-dl.outputs.NINJA_INSTALL_PATH }}
ASCIIDOCTOR_PATH: ${{ steps.asciidoctor-dl.outputs.ASCIIDOCTOR_PATH }}
WZ_FULL_POWERSHELL_PATH: ${{ steps.settings.outputs.WZ_FULL_POWERSHELL_PATH }}
WZ_FULL_MSGMERGE_PATH: ${{ steps.settings.outputs.WZ_FULL_MSGMERGE_PATH }}
WZ_FULL_MSGFMT_PATH: ${{ steps.settings.outputs.WZ_FULL_MSGFMT_PATH }}
WZ_MINGW_PKG_PREFIX: '${{ steps.settings.outputs.WZ_MINGW_PKG_PREFIX }}'
run: |
echo "PATH=${env:PATH}"
echo "WZ_FULL_GIT_PATH=${env:WZ_FULL_GIT_PATH}"
echo "NINJA_INSTALL_PATH=${env:NINJA_INSTALL_PATH}"
echo "ASCIIDOCTOR_PATH=${env:ASCIIDOCTOR_PATH}"
$POWERSHELL_FOLDER = Split-Path -Path "${env:WZ_FULL_POWERSHELL_PATH}"
$WZ_MINGW_DIST_PATH = "${env:LLVM_MINGW_INSTALL_PATH}\${env:WZ_MINGW_PKG_PREFIX}\bin"
echo "WZ_MINGW_DIST_PATH=\"${WZ_MINGW_DIST_PATH}\""
$WZ_MINGW_ENV_PATH = "${env:LLVM_MINGW_INSTALL_PATH}\bin;${env:WZ_FULL_GIT_PATH};${POWERSHELL_FOLDER};C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;${env:NINJA_INSTALL_PATH};${env:ASCIIDOCTOR_PATH};${env:WZ_FULL_MSGMERGE_PATH}"
if ("${env:WZ_FULL_MSGMERGE_PATH}" -ne "${env:WZ_FULL_MSGFMT_PATH}") {
$WZ_MINGW_ENV_PATH = "${WZ_MINGW_ENV_PATH};${env:WZ_FULL_MSGFMT_PATH}"
}
echo "WZ_MINGW_ENV_PATH=\"${WZ_MINGW_ENV_PATH}\""
echo "WZ_MINGW_ENV_PATH=${WZ_MINGW_ENV_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "WZ_MINGW_ENV_PATH=${WZ_MINGW_ENV_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "WZ_MINGW_DIST_PATH=${WZ_MINGW_DIST_PATH}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "WZ_MINGW_DIST_PATH=${WZ_MINGW_DIST_PATH}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Cache vcpkg dependencies
id: vcpkg-cache
if: success() && !(github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release')
uses: actions/cache@v3
with:
path: ${{ steps.settings.outputs.VCPKG_BINARYCACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ steps.settings.outputs.WZ_VISUAL_STUDIO_INSTALL_VERSION }}-${{ hashFiles('**/get-dependencies_win.ps1') }}-${{ hashFiles('**/vcpkg.json') }}-${{ hashFiles('**/.ci/vcpkg/**') }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ steps.settings.outputs.WZ_VISUAL_STUDIO_INSTALL_VERSION }}-${{ hashFiles('**/get-dependencies_win.ps1') }}-${{ hashFiles('**/vcpkg.json') }}
${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ steps.settings.outputs.WZ_VISUAL_STUDIO_INSTALL_VERSION }}-${{ hashFiles('**/get-dependencies_win.ps1') }}-
- name: Build vcpkg + dependencies
working-directory: '${{ github.workspace }}\build'
env:
WZ_USING_MINGW: ${{ steps.settings.outputs.WZ_USING_MINGW }}
WZ_FULL_POWERSHELL_PATH: ${{ steps.settings.outputs.WZ_FULL_POWERSHELL_PATH }}
run: |
Write-Host "env:VCPKG_DEFAULT_TRIPLET=`"${env:VCPKG_DEFAULT_TRIPLET}`""
Write-Host "env:VCPKG_VISUAL_STUDIO_PATH=`"${env:VCPKG_VISUAL_STUDIO_PATH}`""
Write-Host "env:VCPKG_BINARY_SOURCES=`"${env:VCPKG_BINARY_SOURCES}`""
Write-Host "env:PATH=`"${env:PATH}`""
if ("${env:WZ_USING_MINGW}" -eq "true") {
$env:PATH = "${env:WZ_MINGW_ENV_PATH}";
Write-Host "env:PATH=`"${env:PATH}`""
}
& "${env:WZ_FULL_POWERSHELL_PATH}" "${env:WZ_REPO_PATH}\get-dependencies_win.ps1" -VCPKG_BUILD_TYPE "release"
- name: Clean vcpkg temp files
working-directory: '${{ github.workspace }}\build'
run: |
# Remove the vcpkg\buildtrees folder. (Once all dependencies are installed, it isn't needed, and it takes up a lot of space in the cache.)
if (Test-Path .\vcpkg\buildtrees) { Remove-Item .\vcpkg\buildtrees -Force -Recurse -ErrorAction SilentlyContinue; }
# Clean the build remnants of vcpkg itself. (Since it's rebuilt fresh - even from a cached vcpkg directory - these aren't needed.)
. "${env:WZ_REPO_PATH}\.ci\powershell\importVCvars.ps1"
Import-VCVarsEnv "${env:WZ_VISUAL_STUDIO_INSTALL_PATH}" "-arch=${env:WZ_TARGET_ARCH} -host_arch=x64"
- name: CMake Configure (MSVC)
if: success() && (steps.settings.outputs.WZ_USING_MINGW != 'true')
working-directory: '${{ github.workspace }}\build'
env:
CXXFLAGS: '/MP'
BUILD_SENTRY_SUPPORT: ${{ matrix.support_sentry }}
WZ_ENABLE_SENTRY: ${{ steps.settings.outputs.WZ_ENABLE_SENTRY }}
SENTRY_IO_DSN: '${{ secrets.CRASHREPORTING_SENTRY_IO_DSN }}'
DISCORD_RPC_APPID: '${{ secrets.DISCORD_RPC_APPID }}'
run: |
$ADDITIONAL_CMAKE_PARAMS = ""
$WZ_BUILD_SENTRY_VALUE = "OFF"
if ("${env:BUILD_SENTRY_SUPPORT}" -eq "true") {
$WZ_BUILD_SENTRY_VALUE = "ON"
if (("${env:WZ_ENABLE_SENTRY}" -eq "true") -and (-not ([string]::IsNullOrEmpty("${env:SENTRY_IO_DSN}")))) {
$ADDITIONAL_CMAKE_PARAMS = "-DSENTRY_IO_DSN:STRING=${env:SENTRY_IO_DSN}"
}
}
# Use CMake to configure with the appropriate Visual Studio (MSBUILD) generator, toolchain, and target platform
echo "::add-matcher::${{ github.workspace }}\src\.ci\githubactions\pattern_matchers\cmake.json"
cmake -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\build\vcpkg\scripts\buildsystems\vcpkg.cmake" -DCPACK_PACKAGE_FILE_NAME:STRING="warzone2100_portable" -DWZ_DISTRIBUTOR:STRING="${env:WZ_DISTRIBUTOR}" -DCMAKE_GENERATOR_INSTANCE="${env:WZ_VISUAL_STUDIO_INSTALL_PATH}" -DDISCORD_RPC_APPID:STRING="${env:DISCORD_RPC_APPID}" -DWZ_BUILD_SENTRY:BOOL="${WZ_BUILD_SENTRY_VALUE}" ${ADDITIONAL_CMAKE_PARAMS} -G "${env:WZ_VC_GENERATOR}" -A "${env:WZ_VC_TARGET_PLATFORMNAME}" "${env:WZ_REPO_PATH}"
echo "::remove-matcher owner=cmake::"
- name: CMake Configure (MINGW)
if: success() && (steps.settings.outputs.WZ_USING_MINGW == 'true')
working-directory: '${{ github.workspace }}\build'
env:
BUILD_SENTRY_SUPPORT: ${{ matrix.support_sentry }}
WZ_ENABLE_SENTRY: ${{ steps.settings.outputs.WZ_ENABLE_SENTRY }}
SENTRY_IO_DSN: '${{ secrets.CRASHREPORTING_SENTRY_IO_DSN }}'
SENTRY_BACKEND_OVERRIDE: '${{ matrix.sentry_backend }}'
DISCORD_RPC_APPID: '${{ secrets.DISCORD_RPC_APPID }}'
WZ_FULL_CMAKE_PATH: '${{ steps.settings.outputs.WZ_FULL_CMAKE_PATH }}'
WZ_MINGW_PKG_PREFIX: '${{ steps.settings.outputs.WZ_MINGW_PKG_PREFIX }}'
WZ_ASM_MASM_COMPILER: '${{ steps.settings.outputs.WZ_ASM_MASM_COMPILER }}'
run: |
$SENTRY_DSN_PARAM = ""
$WZ_BUILD_SENTRY_VALUE = "OFF"
if ("${env:BUILD_SENTRY_SUPPORT}" -eq "true") {
$WZ_BUILD_SENTRY_VALUE = "ON"
if (("${env:WZ_ENABLE_SENTRY}" -eq "true") -and (-not ([string]::IsNullOrEmpty("${env:SENTRY_IO_DSN}")))) {
$SENTRY_DSN_PARAM = "-DSENTRY_IO_DSN:STRING=${env:SENTRY_IO_DSN}"
}
}
$SENTRY_BACKEND_PARAM = ""
if (-not ([string]::IsNullOrEmpty("${env:SENTRY_BACKEND_OVERRIDE}"))) {
$SENTRY_BACKEND_PARAM = "-DSENTRY_BACKEND:STRING=${env:SENTRY_BACKEND_OVERRIDE}"
}
echo "::add-matcher::${{ github.workspace }}\src\.ci\githubactions\pattern_matchers\cmake.json"
$env:PATH = "${env:WZ_MINGW_ENV_PATH}";
& "${env:WZ_FULL_CMAKE_PATH}\cmake.exe" -DCMAKE_C_COMPILER="${env:WZ_MINGW_PKG_PREFIX}-gcc" -DCMAKE_CXX_COMPILER="${env:WZ_MINGW_PKG_PREFIX}-g++" -DCMAKE_RC_COMPILER="${env:WZ_MINGW_PKG_PREFIX}-windres" -DCMAKE_ASM_MASM_COMPILER="${env:WZ_ASM_MASM_COMPILER}" -DWZ_MINGW_DIST_PATH="${env:WZ_MINGW_DIST_PATH}" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\build\vcpkg\scripts\buildsystems\vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release -DWZ_DISTRIBUTOR:STRING="${env:WZ_DISTRIBUTOR}" -DDISCORD_RPC_APPID:STRING="${env:DISCORD_RPC_APPID}" -DWZ_BUILD_SENTRY:BOOL=${WZ_BUILD_SENTRY_VALUE} ${SENTRY_DSN_PARAM} ${SENTRY_BACKEND_PARAM} -G "Ninja" "${{ steps.settings.outputs.WZ_REPO_PATH }}"
echo "::remove-matcher owner=cmake::"
- name: Upload vcpkg logs (on failure)
uses: actions/upload-artifact@v3
if: failure()
with:
name: win_${{ matrix.architecture }}_vcpkg_logs
path: '${{ github.workspace }}\build\vcpkg\buildtrees\*\*-out.log'
if-no-files-found: 'warn'
retention-days: 1
- name: CMake Build (MSVC)
if: success() && (steps.settings.outputs.WZ_USING_MINGW != 'true')
working-directory: '${{ github.workspace }}\build'
env:
CXXFLAGS: '/MP'
run: |
echo "::add-matcher::${{ github.workspace }}\src\.ci\githubactions\pattern_matchers\msvc.json"
& cmake --build . --config Release --target warzone2100 -- /m
echo "::remove-matcher owner=msvc::"
- name: CMake Build (MINGW)
if: success() && (steps.settings.outputs.WZ_USING_MINGW == 'true')
working-directory: '${{ github.workspace }}\build'
run: |
echo "::add-matcher::${{ github.workspace }}\src\.ci\githubactions\pattern_matchers\clang.json"
& cmake --build . --config Release --target warzone2100
echo "::remove-matcher owner=clang::"
- name: Package Portable Installer
working-directory: '${{ github.workspace }}\build'
env:
FULL_CMAKE_PATH: '${{ steps.settings.outputs.WZ_FULL_CMAKE_PATH }}'
run: |
. "${env:WZ_REPO_PATH}\.ci\powershell\importVCvars.ps1"
Import-VCVarsEnv "${env:WZ_VISUAL_STUDIO_INSTALL_PATH}" "-arch=${env:WZ_TARGET_ARCH} -host_arch=x64"
# Run CPack
& "${env:FULL_CMAKE_PATH}\cpack.exe" -D CPACK_PACKAGE_FILE_NAME="warzone2100_portable" -D CPACK_WZ_PORTABLE=ON -G NSIS -C "Release"
# Rename the portable installer
Move-Item -LiteralPath ".\warzone2100_portable.exe" -Destination "${{ github.workspace }}\output\portable\warzone2100_$($env:WZ_BUILD_DESC)_portable.exe"
- name: Collect Failure Logs
if: failure()
run: |
$NSIS_Log = "build\_CPack_Packages\win32\NSIS\NSISOutput.log"
if (Test-Path $NSIS_Log -PathType Leaf)
{
Copy-Item -LiteralPath "$NSIS_Log" -Destination ".\output\error_logs"
}
$NSIS_Log = "build\_CPack_Packages\win64\NSIS\NSISOutput.log"
if (Test-Path $NSIS_Log -PathType Leaf)
{
Copy-Item -LiteralPath "$NSIS_Log" -Destination ".\output\error_logs"
}
- name: Upload Failure Logs Artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: win_${{ matrix.architecture }}_error_logs
path: '${{ github.workspace }}\output\error_logs'
if-no-files-found: 'warn'
- name: Package Full Installer
working-directory: '${{ github.workspace }}\build'
env:
FULL_CMAKE_PATH: '${{ steps.settings.outputs.WZ_FULL_CMAKE_PATH }}'
run: |
. "${env:WZ_REPO_PATH}\.ci\powershell\importVCvars.ps1"
Import-VCVarsEnv "${env:WZ_VISUAL_STUDIO_INSTALL_PATH}" "-arch=${env:WZ_TARGET_ARCH} -host_arch=x64"
# Run CPack
& "${env:FULL_CMAKE_PATH}\cpack.exe" -D CPACK_PACKAGE_FILE_NAME="warzone2100_installer" -D CPACK_WZ_PORTABLE=OFF -G NSIS -C "Release"
# Rename the archive
Move-Item -LiteralPath ".\warzone2100_installer.exe" -Destination "${{ github.workspace }}\output\installer\warzone2100_$($env:WZ_BUILD_DESC)_installer.exe"
- name: Archive .ZIP of Regular build
working-directory: '${{ github.workspace }}\build'
env:
FULL_CMAKE_PATH: '${{ steps.settings.outputs.WZ_FULL_CMAKE_PATH }}'
run: |
. "${env:WZ_REPO_PATH}\.ci\powershell\importVCvars.ps1"
Import-VCVarsEnv "${env:WZ_VISUAL_STUDIO_INSTALL_PATH}" "-arch=${env:WZ_TARGET_ARCH} -host_arch=x64"
# Run CPack
& "${env:FULL_CMAKE_PATH}\cpack.exe" -D CPACK_PACKAGE_FILE_NAME="warzone2100_archive" -D CPACK_INCLUDE_TOPLEVEL_DIRECTORY=OFF -D CPACK_ARCHIVE_COMPONENT_INSTALL=ON -D CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE=ON -G ZIP -C "Release"
# Rename the archive
Move-Item -LiteralPath ".\warzone2100_archive.zip" -Destination "${{ github.workspace }}\output\archive\warzone2100_$($env:WZ_BUILD_DESC)_archive.zip"
- name: Archive Debug Symbols
working-directory: '${{ github.workspace }}\build'
env:
FULL_CMAKE_PATH: '${{ steps.settings.outputs.WZ_FULL_CMAKE_PATH }}'
run: |
. "${env:WZ_REPO_PATH}\.ci\powershell\importVCvars.ps1"
Import-VCVarsEnv "${env:WZ_VISUAL_STUDIO_INSTALL_PATH}" "-arch=${env:WZ_TARGET_ARCH} -host_arch=x64"
# Run CPack
& "${env:FULL_CMAKE_PATH}\cpack.exe" -D CPACK_PACKAGE_FILE_NAME="warzone2100_debugsymbols" -D CPACK_COMPONENTS_ALL="DebugSymbols;AdditionalDebugSymbols" -D CPACK_INCLUDE_TOPLEVEL_DIRECTORY=OFF -D CPACK_ARCHIVE_COMPONENT_INSTALL=ON -G 7Z -C "Release"
# Rename the archive
Move-Item -LiteralPath ".\warzone2100_debugsymbols.7z" -Destination "${{ github.workspace }}\output\debugsymbols\warzone2100_$($env:WZ_BUILD_DESC).DEBUGSYMBOLS.7z"
- name: Compare Build Outputs
working-directory: '${{ github.workspace }}\output'
run: |
# Log hashes of the setup EXEs
Write-Host "SHA512 Hashes:"
Write-Host "`nwarzone2100_$($env:WZ_BUILD_DESC)_portable.exe`n`t-> SHA512: $((Get-FileHash -LiteralPath ".\portable\warzone2100_$($env:WZ_BUILD_DESC)_portable.exe" -Algorithm SHA512).Hash)`n`t`-> Size (bytes): $((Get-Item -LiteralPath ".\portable\warzone2100_$($env:WZ_BUILD_DESC)_portable.exe").Length)"
Write-Host "`nwarzone2100_$($env:WZ_BUILD_DESC)_installer.exe`n`t-> SHA512: $((Get-FileHash -LiteralPath ".\installer\warzone2100_$($env:WZ_BUILD_DESC)_installer.exe" -Algorithm SHA512).Hash)`n`t`-> Size (bytes): $((Get-Item -LiteralPath ".\installer\warzone2100_$($env:WZ_BUILD_DESC)_installer.exe").Length)"
Write-Host "`nwarzone2100_$($env:WZ_BUILD_DESC)_archive.zip`n`t-> SHA512: $((Get-FileHash -LiteralPath ".\archive\warzone2100_$($env:WZ_BUILD_DESC)_archive.zip" -Algorithm SHA512).Hash)`n`t`-> Size (bytes): $((Get-Item -LiteralPath ".\archive\warzone2100_$($env:WZ_BUILD_DESC)_archive.zip").Length)"
Write-Host ""
#####################################################
# Upload build artifacts
#####################################################
- name: 'Upload Artifact - (Portable Build)'
uses: actions/upload-artifact@v3
if: success() && (github.repository == 'Warzone2100/warzone2100')
with:
name: warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}_portable
path: '${{ github.workspace }}\output\portable'
if-no-files-found: 'error'
- name: 'Upload Artifact - (Regular Installer)'
uses: actions/upload-artifact@v3
if: success() && (github.repository == 'Warzone2100/warzone2100')
with:
name: warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}_installer
path: '${{ github.workspace }}\output\installer'
if-no-files-found: 'error'
- name: 'Upload Artifact - (Debug Symbols)'
uses: actions/upload-artifact@v3
if: success() && (github.repository == 'Warzone2100/warzone2100')
with:
name: warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}_DEBUGSYMBOLS
path: '${{ github.workspace }}\output\debugsymbols'
if-no-files-found: 'error'
- name: 'Upload Artifact - (Archive)'
uses: actions/upload-artifact@v3
if: success() && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release')) && (matrix.deploy_release == true) && (github.repository == 'Warzone2100/warzone2100')
with:
name: warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}_archive
path: '${{ github.workspace }}\output\archive'
if-no-files-found: 'error'
#####################################################
# Upload Release assets (if a release tag)
#####################################################
- name: Upload Release Assets
if: success() && (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release') && (matrix.deploy_release == true) && (github.repository == 'Warzone2100/warzone2100')
run: |
$SOURCE_TAG = "$($env:WZ_GITHUB_REF -replace "refs/tags/")"
gh release upload "${SOURCE_TAG}" "${{ github.workspace }}\output\portable\warzone2100_$($env:WZ_BUILD_DESC)_portable.exe" "${{ github.workspace }}\output\installer\warzone2100_$($env:WZ_BUILD_DESC)_installer.exe" "${{ github.workspace }}\output\debugsymbols\warzone2100_$($env:WZ_BUILD_DESC).DEBUGSYMBOLS.7z" "${{ github.workspace }}\output\archive\warzone2100_$($env:WZ_BUILD_DESC)_archive.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
WZ_GITHUB_REF: ${{ steps.checkout-config.outputs.WZ_GITHUB_REF }}
#####################################################
# Create Sentry source bundle
#####################################################
- name: Create Sentry source bundle
if: success() && (matrix.support_sentry == true)
id: create-sentry-source-bundle
continue-on-error: true
working-directory: '${{ github.workspace }}\sentry_artifacts'
env:
WZ_REPO_PATH: ${{ steps.settings.outputs.WZ_REPO_PATH }}
WZ_ARCHIVE_PATH: '${{ github.workspace }}\output\archive\warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}_archive.zip'
WZ_DEBUGSYMBOLS_PATH: '${{ github.workspace }}\output\debugsymbols\warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}.DEBUGSYMBOLS.7z'
SOURCE_BUNDLE_OUTPUT_DIR: '${{ github.workspace }}\output\sentry_source_bundles'
run: |
# Download sentry-cli
echo "::group::Downloading sentry-cli ..."
cmake -P "${env:WZ_REPO_PATH}/.ci/githubactions/FetchSentryCLI.cmake"
echo "Downloading sentry-cli ... Done"
echo "::endgroup::"
# Extract the WZ archive to a temporary path
echo "::group::Expanding archive ..."
Expand-Archive -LiteralPath "${env:WZ_ARCHIVE_PATH}" -DestinationPath "$(pwd)\wz_extracted"
echo "Expanding archive ... Done"
# Extract the debug symbols to the temporary path's "bin" directory
$SYMBOLS_OUTPUT_DIR = "$(pwd)\wz_extracted"
echo "Extracting debug symbols ..."
Start-Process "7z" -ArgumentList "x","${env:WZ_DEBUGSYMBOLS_PATH}","-o${SYMBOLS_OUTPUT_DIR}","-aos" -Wait
echo "Extracting debug symbols ... Done"
# Remove any .sym files from extracted archive
Remove-Item "$(pwd)\wz_extracted\bin\*" -Recurse -Include *.sym
Get-ChildItem -Path "$(pwd)\wz_extracted\bin" -Recurse
echo "::endgroup::"
# Create the Sentry source bundle
echo "sentry-cli difutil bundle-sources ..."
& "$(pwd)\sentry-cli\sentry-cli.exe" difutil bundle-sources -o "${env:SOURCE_BUNDLE_OUTPUT_DIR}" "$(pwd)\wz_extracted\bin\warzone2100.pdb"
echo "sentry-cli difutil bundle-sources ... Done"
# List output bundles
Get-ChildItem -Path "${env:SOURCE_BUNDLE_OUTPUT_DIR}" -Recurse
- name: Upload Sentry source bundles
if: success() && (github.repository == 'Warzone2100/warzone2100') && (matrix.support_sentry == true) && (steps.settings.outputs.WZ_ENABLE_SENTRY == 'true') && (steps.create-sentry-source-bundle.outcome == 'success')
uses: actions/upload-artifact@v3
with:
name: 'warzone2100_${{ steps.settings.outputs.WZ_BUILD_DESC }}_debug_sourcebundles'
path: '${{ github.workspace }}\output\sentry_source_bundles'
retention-days: 1
if-no-files-found: 'warn'
upload-debug-symbols:
strategy:
matrix:
architecture: ["x86", "x64", "arm64"]
fail-fast: false
env:
WZ_TARGET_ARCH: ${{ matrix.architecture }}
name: 'Upload Debug Symbols (${{ matrix.architecture }})'
permissions:
contents: read
runs-on: ubuntu-latest
# Run on push to master branch (development build), or tag release automation build
if: (github.repository == 'Warzone2100/warzone2100') && ((github.event_name == 'push' && github.ref == 'refs/heads/master') || (github.event_name == 'workflow_run' && github.event.workflow_run.name == 'Draft Tag Release'))
needs: windows-build
environment: upload_symbols
# For this job to work, the following secrets must be set in the 'upload_symbols' environment:
# SENTRY_AUTH_TOKEN
steps:
- name: Prep Environment
id: settings
run: |
mkdir dl-archive
mkdir dl-sourcebundle
OUTPUTDIR="wz-${WZ_TARGET_ARCH}"
echo "OUTPUTDIR=${OUTPUTDIR}" >> $GITHUB_ENV
echo "ARCHIVEDIR=${OUTPUTDIR}" >> $GITHUB_OUTPUT
- name: Download Archive Artifact
uses: actions/download-artifact@v3
with:
name: 'warzone2100_win_${{ matrix.architecture }}_archive'
path: ./dl-archive
- name: Extract archive
run: |
ZIPFILE="./dl-archive/warzone2100_win_${WZ_TARGET_ARCH}_archive.zip"
unzip -o "${ZIPFILE}" -d "${OUTPUTDIR}" && rm "${ZIPFILE}"
- name: Download Debug Symbols Artifact
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: 'warzone2100_win_${{ matrix.architecture }}_DEBUGSYMBOLS'
path: ./dl-archive
- name: Extract Debug Symbols
continue-on-error: true
run: |
ZIPFILE="./dl-archive/warzone2100_win_${WZ_TARGET_ARCH}.DEBUGSYMBOLS.7z"
7z x "${ZIPFILE}" -o${OUTPUTDIR} -aos && rm "${ZIPFILE}"
- name: Cleanup breakpad symbols
run: |
# Remove the breakpad symbols (so they are never selected instead of the PDB)
BREAKPAD_SYM="${OUTPUTDIR}/bin/warzone2100.sym"
if [[ -f "${BREAKPAD_SYM}" ]]; then
echo "Removing breakpad .sym"
rm "${BREAKPAD_SYM}"
fi
- name: Download Source Bundle
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: 'warzone2100_win_${{ matrix.architecture }}_debug_sourcebundles'
path: ./dl-sourcebundle
- name: 'Upload debug symbols'
env:
SENTRY_AUTH_TOKEN: '${{ secrets.SENTRY_AUTH_TOKEN }}'
WZ_ARCHIVE_DIR: '${{ steps.settings.outputs.ARCHIVEDIR }}'
WZ_SOURCEBUNDLES_DIR: './dl-sourcebundle'
run: |
if [[ -z "${SENTRY_AUTH_TOKEN}" ]]; then
echo "No SENTRY_AUTH_TOKEN - skipping"
exit 0
fi
docker pull getsentry/sentry-cli
echo "Uploading debug symbols"
docker run --rm -e SENTRY_AUTH_TOKEN -v "$(pwd):/work" getsentry/sentry-cli upload-dif --no-zips -o warzone2100 -p warzone2100 "${WZ_ARCHIVE_DIR}"
echo "Uploading source bundles"
docker run --rm -e SENTRY_AUTH_TOKEN -v "$(pwd):/work" getsentry/sentry-cli upload-dif --type sourcebundle -o warzone2100 -p warzone2100 "${WZ_SOURCEBUNDLES_DIR}"
trigger-updates-json:
name: 'Trigger Info Update'
permissions:
contents: read
runs-on: ubuntu-latest
if: (github.repository == 'Warzone2100/warzone2100') && (github.ref == 'refs/heads/master')
needs: windows-build
environment: update_dispatch
# For this job to work, the following secrets must be set in the 'update_dispatch' environment:
# SITE_DISPATCH_ACCESS_TOKEN
steps:
- name: 'Trigger updates.json update'
run: |
curl -X POST https://api.github.com/repos/Warzone2100/update-data/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.SITE_DISPATCH_ACCESS_TOKEN }} \
--data '{"event_type": "development_build_update", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'