diff --git a/appveyor.yml b/appveyor.yml index 2a883cc798..f756ad5db5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,3 +28,5 @@ artifacts: name: OpenRCT2-portable - path: .\artifacts\*.exe name: OpenRCT2-installer +- path: .\artifacts\openrct2-symbols.zip + name: OpenRCT2 debug symbols diff --git a/scripts/ps/appveyor_run.ps1 b/scripts/ps/appveyor_run.ps1 index baab8d99bb..a063aedda2 100644 --- a/scripts/ps/appveyor_run.ps1 +++ b/scripts/ps/appveyor_run.ps1 @@ -40,10 +40,12 @@ if (${env:CODE-SIGN-KEY-OPENRCT2.ORG.PFX.PASSWORD} -ne $null) # Enable pushing builds to OpenRCT2.org if token environment variable is set $pushBuilds = $false $installer = $false +$symbols = $false if (${env:OPENRCT2.ORG_TOKEN} -ne $null) { $pushBuilds = $true $installer = $true + $symbols = $true } # Write out summary of the build @@ -98,6 +100,18 @@ if ($installer) -CodeSign $codeSign } +if ($symbols) +{ + publish package ` + -Symbols ` + -Server $server ` + -GitTag $tag ` + -GitBranch $env:APPVEYOR_REPO_BRANCH ` + -GitSha1 $env:APPVEYOR_REPO_COMMIT ` + -GitSha1Short $env:APPVEYOR_REPO_COMMIT_SHORT ` + -CodeSign $codeSign +} + if ($pushBuilds) { $versionExtension = "" @@ -127,4 +141,14 @@ if ($pushBuilds) -version $version ` -flavourId 2 } + + # Push symbols + if ($symbols) + { + Write-Host "Sending symbols to OpenRCT2.org" -ForegroundColor Cyan + Push-Build -file ".\artifacts\openrct2-symbols.zip" ` + -name "$pushFileName-symbols.zip" ` + -version $version ` + -flavourId 5 + } } diff --git a/scripts/ps/publish.ps1 b/scripts/ps/publish.ps1 index 5fa9f27952..05b94deddf 100644 --- a/scripts/ps/publish.ps1 +++ b/scripts/ps/publish.ps1 @@ -14,7 +14,8 @@ param ( [string]$GitSha1 = "", [string]$GitSha1Short = "", [bool] $CodeSign = $false, - [switch]$Installer = $false + [switch]$Installer = $false, + [switch]$Symbols = $false ) if ($GitTag -eq "") @@ -97,6 +98,38 @@ function Do-Build() return 0 } +# Symbols +function Do-Symbols() +{ + Write-Host "Publishing OpenRCT2 debug symbols as zip..." -ForegroundColor Cyan + $artifactsDir = "$rootPath\artifacts" + $releaseDir = "$rootPath\bin" + $outZip = "$rootPath\artifacts\openrct2-symbols.zip" + + Copy-Item -Force "$releaseDir\openrct2.pdb" $artifactsDir -ErrorAction Stop + + # Create archive using 7z (renowned for speed and compression) + $7zcmd = "7za" + if (-not (AppExists($7zcmd))) + { + # AppVeyor in particular uses '7z' instead + $7zcmd = "7z" + if (-not (AppExists($7zcmd))) + { + Write-Host "Publish script requires 7z to be in PATH" -ForegroundColor Red + return 1 + } + } + & $7zcmd a -tzip -mx9 $outZip "$artifactsDir\openrct2.pdb" > $null + if ($LASTEXITCODE -ne 0) + { + Write-Host "Failed to create zip." -ForegroundColor Red + return 1 + } + Remove-Item -Force -Recurse "$artifactsDir\openrct2.pdb" -ErrorAction SilentlyContinue + return 0 +} + # Package function Do-Package() { @@ -209,6 +242,10 @@ function Do-Task-Package() { if (($result = (Do-Installer)) -ne 0) { return $result } } + elseif ($Symbols) + { + if (($result = (Do-Symbols)) -ne 0) { return $result } + } else { if (($result = (Do-Package)) -ne 0) { return $result }