From e29c2555c3ff19d9ee839797164ca40685ff5eee Mon Sep 17 00:00:00 2001 From: Ted John Date: Wed, 4 May 2016 20:48:07 +0100 Subject: [PATCH 1/4] do not install NSIS for PRs --- appveyor.yml | 12 ++--------- .../{appveyor_run.ps1 => appveyor_build.ps1} | 0 scripts/ps/appveyor_install.ps1 | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+), 10 deletions(-) rename scripts/ps/{appveyor_run.ps1 => appveyor_build.ps1} (100%) create mode 100644 scripts/ps/appveyor_install.ps1 diff --git a/appveyor.yml b/appveyor.yml index b765041d0b..0ceea609d9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,21 +8,13 @@ environment: OPENRCT2.ORG_TOKEN: secure: leQX3xCQpmBLGuMqrxjFlzexDt96ypNRMM5TTRVHbGE8PwVg9crgeykLc2BIZU6HDHveJCHqh2cGMdHtHYJYcw== install: -- cmd: >- - IF DEFINED ENCKEY ( nuget install secure-file -ExcludeVersion && secure-file\tools\secure-file -decrypt distribution\windows\code-sign-key-openrct2.org.pfx.enc -secret %ENCKEY% ) - - cinst nsis.portable --version=3.01-beta1 > nul - ps: >- - curl "http://nsis.sourceforge.net/mediawiki/images/5/53/KillProcDll%26FindProcDll.zip" -OutFile nsisxtra.zip - - 7z x nsisxtra.zip > $null - - cp FindProcDLL.dll "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Plugins\x86-ansi" + .\scripts\ps\appveyor_install.ps1 build_script: - ps: >- .\setenv.ps1 - appveyor_run + appveyor_build artifacts: - path: .\artifacts\openrct2.zip name: OpenRCT2-portable diff --git a/scripts/ps/appveyor_run.ps1 b/scripts/ps/appveyor_build.ps1 similarity index 100% rename from scripts/ps/appveyor_run.ps1 rename to scripts/ps/appveyor_build.ps1 diff --git a/scripts/ps/appveyor_install.ps1 b/scripts/ps/appveyor_install.ps1 new file mode 100644 index 0000000000..ef4871b2f4 --- /dev/null +++ b/scripts/ps/appveyor_install.ps1 @@ -0,0 +1,21 @@ +######################################################### +# Script to setup OpenRCT2 for building on AppVeyor +######################################################### + +if ($env:ENCKEY) +{ + Write-Host "Downloading secure-file from NuGet" -ForegroundColor Cyan + nuget install secure-file -ExcludeVersion + secure-file\tools\secure-file -decrypt distribution\windows\code-sign-key-openrct2.org.pfx.enc -secret $env:ENCKEY +} + +if (${env:OPENRCT2.ORG_TOKEN}) +{ + Write-Host "Downloading NSIS from chocolatey" -ForegroundColor Cyan + cinst nsis.portable --version=3.01-beta1 > $null + + Write-Host "Downloading KillProcDLL for NSIS" -ForegroundColor Cyan + curl "http://nsis.sourceforge.net/mediawiki/images/5/53/KillProcDll%26FindProcDll.zip" -OutFile nsisxtra.zip + 7z x nsisxtra.zip > $null + cp FindProcDLL.dll "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Plugins\x86-ansi" +} From 3deb2ef363c50f87dd2cd34af79cc606e12f4f7e Mon Sep 17 00:00:00 2001 From: Ted John Date: Wed, 4 May 2016 22:07:48 +0100 Subject: [PATCH 2/4] fix NSIS when branches contain slashes --- distribution/windows/install.nsi | 2 +- scripts/ps/publish.ps1 | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/distribution/windows/install.nsi b/distribution/windows/install.nsi index 768f104e7b..3c91d2b454 100644 --- a/distribution/windows/install.nsi +++ b/distribution/windows/install.nsi @@ -41,7 +41,7 @@ Name "${APPNAMEANDVERSION} ${APPBITS}-bit for Windows ${EXTRA_VERSION}" ; NOTE: Keep trailing backslash! InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenRCT2" "Install Folder" !ifndef OUTFILE - !define OUTFILE "openrct2-${APPVERSION}-${APPARCH}.exe" + !define OUTFILE "openrct2-install.exe" !endif OutFile "${OUTFILE}" CRCCheck force diff --git a/scripts/ps/publish.ps1 b/scripts/ps/publish.ps1 index ed2d4288da..9c42f240e8 100644 --- a/scripts/ps/publish.ps1 +++ b/scripts/ps/publish.ps1 @@ -18,17 +18,17 @@ param ( [switch]$Symbols = $false ) -if ($GitTag -eq "") +if (-not $GitTag) { - if ($GitBranch -eq $null) + if (-not $GitBranch) { $GitBranch = (git rev-parse --abbrev-ref HEAD) } - if ($GitCommitSha1 -eq $null) + if (-not $GitCommitSha1) { $GitCommitSha1 = (git rev-parse HEAD) } - if ($GitCommitSha1Short -eq $null) + if (-not $GitCommitSha1Short) { $GitCommitSha1Short = (git rev-parse --short HEAD) } From 4893abf8d186de9af6a9f05c2e9b4be1deb2a13a Mon Sep 17 00:00:00 2001 From: Ted John Date: Wed, 4 May 2016 22:33:35 +0100 Subject: [PATCH 3/4] add caching of chocolatey packages, (basically NSIS) --- appveyor.yml | 3 +++ scripts/ps/appveyor_install.ps1 | 31 +++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0ceea609d9..f24c8168e3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,8 @@ version: 0.0.5.{build} os: Visual Studio 2015 +cache: +- C:\ProgramData\chocolatey\bin -> scripts\ps\appveyor_install.ps1 +- C:\ProgramData\chocolatey\lib -> scripts\ps\appveyor_install.ps1 environment: ENCKEY: secure: saYAIpqXzpq0U+JH+MNi/isRQ6Y51PZhm4BrnePDiAPptFO5htxFOLegrYqxdy67 diff --git a/scripts/ps/appveyor_install.ps1 b/scripts/ps/appveyor_install.ps1 index ef4871b2f4..84aca4cb2f 100644 --- a/scripts/ps/appveyor_install.ps1 +++ b/scripts/ps/appveyor_install.ps1 @@ -2,20 +2,39 @@ # Script to setup OpenRCT2 for building on AppVeyor ######################################################### +function Check-ExitCode +{ + if ($LASTEXITCODE -ne 0) + { + $host.SetShouldExit($LASTEXITCODE) + } +} + if ($env:ENCKEY) { Write-Host "Downloading secure-file from NuGet" -ForegroundColor Cyan nuget install secure-file -ExcludeVersion secure-file\tools\secure-file -decrypt distribution\windows\code-sign-key-openrct2.org.pfx.enc -secret $env:ENCKEY + Check-ExitCode } if (${env:OPENRCT2.ORG_TOKEN}) { - Write-Host "Downloading NSIS from chocolatey" -ForegroundColor Cyan - cinst nsis.portable --version=3.01-beta1 > $null + if (-not (Test-Path "C:\ProgramData\chocolatey\lib\nsis.portable")) + { + Write-Host "Downloading NSIS from chocolatey" -ForegroundColor Cyan + cinst nsis.portable --version=3.01-beta1 > $null + if ($LASTEXITCODE -ne 0) + { + Get-Content "C:\ProgramData\chocolatey\logs\chocolatey.log" + $host.SetShouldExit(1) + } - Write-Host "Downloading KillProcDLL for NSIS" -ForegroundColor Cyan - curl "http://nsis.sourceforge.net/mediawiki/images/5/53/KillProcDll%26FindProcDll.zip" -OutFile nsisxtra.zip - 7z x nsisxtra.zip > $null - cp FindProcDLL.dll "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Plugins\x86-ansi" + Write-Host "Downloading KillProcDLL for NSIS" -ForegroundColor Cyan + curl "http://nsis.sourceforge.net/mediawiki/images/5/53/KillProcDll%26FindProcDll.zip" -OutFile nsisxtra.zip + Check-ExitCode + 7z x nsisxtra.zip > $null + Check-ExitCode + cp FindProcDLL.dll "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Plugins\x86-ansi" + } } From 9d568ae944a68cda0c120c4575928b80b6b6f7a6 Mon Sep 17 00:00:00 2001 From: Ted John Date: Wed, 4 May 2016 22:43:49 +0100 Subject: [PATCH 4/4] add caching of secure-file --- appveyor.yml | 1 + scripts/ps/appveyor_install.ps1 | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f24c8168e3..3fb469b0eb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,7 @@ os: Visual Studio 2015 cache: - C:\ProgramData\chocolatey\bin -> scripts\ps\appveyor_install.ps1 - C:\ProgramData\chocolatey\lib -> scripts\ps\appveyor_install.ps1 +- secure-file -> scripts\ps\appveyor_install.ps1 environment: ENCKEY: secure: saYAIpqXzpq0U+JH+MNi/isRQ6Y51PZhm4BrnePDiAPptFO5htxFOLegrYqxdy67 diff --git a/scripts/ps/appveyor_install.ps1 b/scripts/ps/appveyor_install.ps1 index 84aca4cb2f..92a1dcd9ef 100644 --- a/scripts/ps/appveyor_install.ps1 +++ b/scripts/ps/appveyor_install.ps1 @@ -12,8 +12,13 @@ function Check-ExitCode if ($env:ENCKEY) { - Write-Host "Downloading secure-file from NuGet" -ForegroundColor Cyan - nuget install secure-file -ExcludeVersion + if (-not (Test-Path "secure-file")) + { + Write-Host "Downloading secure-file from NuGet..." -ForegroundColor Cyan + nuget install secure-file -ExcludeVersion + } + + Write-Host "Decrypting code signing key..." -ForegroundColor Cyan secure-file\tools\secure-file -decrypt distribution\windows\code-sign-key-openrct2.org.pfx.enc -secret $env:ENCKEY Check-ExitCode } @@ -22,7 +27,7 @@ if (${env:OPENRCT2.ORG_TOKEN}) { if (-not (Test-Path "C:\ProgramData\chocolatey\lib\nsis.portable")) { - Write-Host "Downloading NSIS from chocolatey" -ForegroundColor Cyan + Write-Host "Downloading NSIS from chocolatey..." -ForegroundColor Cyan cinst nsis.portable --version=3.01-beta1 > $null if ($LASTEXITCODE -ne 0) { @@ -30,7 +35,7 @@ if (${env:OPENRCT2.ORG_TOKEN}) $host.SetShouldExit(1) } - Write-Host "Downloading KillProcDLL for NSIS" -ForegroundColor Cyan + Write-Host "Downloading KillProcDLL for NSIS..." -ForegroundColor Cyan curl "http://nsis.sourceforge.net/mediawiki/images/5/53/KillProcDll%26FindProcDll.zip" -OutFile nsisxtra.zip Check-ExitCode 7z x nsisxtra.zip > $null