mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 14:24:33 +01:00
setup AppVeyor CI
This commit is contained in:
13
appveyor.yml
13
appveyor.yml
@@ -1,4 +1,11 @@
|
||||
version: 0.0.3.{build}
|
||||
version: 0.0.4.{build}
|
||||
build_script:
|
||||
- set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
|
||||
- .\build.bat
|
||||
- ps: >-
|
||||
.\setenv.ps1
|
||||
|
||||
install
|
||||
|
||||
publish -Server AppVeyor -BuildNumber $env:APPVEYOR_BUILD_NUMBER -GitBranch $env:APPVEYOR_REPO_BRANCH
|
||||
artifacts:
|
||||
- path: .\artifacts\openrct2.zip
|
||||
name: OpenRCT2
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
#########################################################
|
||||
$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path
|
||||
|
||||
function AppExists($app)
|
||||
{
|
||||
$result = (Get-Command $app -CommandType Application -ErrorAction SilentlyContinue)
|
||||
return ($result -ne $null -and $result.Count -gt 0)
|
||||
}
|
||||
|
||||
function AddPath($path)
|
||||
{
|
||||
$env:path = "$path;$env:path"
|
||||
}
|
||||
|
||||
function Get-RootPath()
|
||||
{
|
||||
return Split-Path (Split-Path $scriptsPath)
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
# - Creates a ZIP for distribution
|
||||
#########################################################
|
||||
param (
|
||||
[string]$server = "",
|
||||
[string]$buildNo = ""
|
||||
[string]$Server = "",
|
||||
[string]$BuildNumber = "",
|
||||
[string]$GitBranch = ""
|
||||
)
|
||||
|
||||
# Setup
|
||||
@@ -18,21 +19,22 @@ Import-Module "$scriptsPath\common.psm1" -DisableNameChecking
|
||||
$rootPath = Get-RootPath
|
||||
|
||||
# Set build attributes
|
||||
function do-prepareSource($build_server = "", $build_number = "")
|
||||
function do-prepareSource()
|
||||
{
|
||||
Write-Host "Setting build #defines..." -ForegroundColor Cyan
|
||||
# $build_number = "";
|
||||
# $build_server = "";
|
||||
$build_branch = (git rev-parse --abbrev-ref HEAD)
|
||||
$build_commit_sha1 = (git rev-parse HEAD)
|
||||
$build_commit_sha1_short = (git rev-parse --short HEAD)
|
||||
if ($GitBranch -eq "")
|
||||
{
|
||||
$GitBranch = (git rev-parse --abbrev-ref HEAD)
|
||||
}
|
||||
$GitCommitSha1 = (git rev-parse HEAD)
|
||||
$GitCommitSha1Short = (git rev-parse --short HEAD)
|
||||
|
||||
$defines = @{ }
|
||||
$defines["OPENRCT2_BUILD_NUMBER"] = $build_number;
|
||||
$defines["OPENRCT2_BUILD_SERVER"] = $build_server;
|
||||
$defines["OPENRCT2_BRANCH"] = $build_branch;
|
||||
$defines["OPENRCT2_COMMIT_SHA1"] = $build_commit_sha1;
|
||||
$defines["OPENRCT2_COMMIT_SHA1_SHORT"] = $build_commit_sha1_short;
|
||||
$defines["OPENRCT2_BUILD_NUMBER"] = $BuildNumber;
|
||||
$defines["OPENRCT2_BUILD_SERVER"] = $Server;
|
||||
$defines["OPENRCT2_BRANCH"] = $GitBranch;
|
||||
$defines["OPENRCT2_COMMIT_SHA1"] = $GitCommitSha1;
|
||||
$defines["OPENRCT2_COMMIT_SHA1_SHORT"] = $GitCommitSha1Short;
|
||||
|
||||
$defineString = ""
|
||||
foreach ($key in $defines.Keys) {
|
||||
@@ -77,13 +79,24 @@ function do-package()
|
||||
Copy-Item -Force "$distDir\known_issues.txt" $tempDir -ErrorAction Stop
|
||||
Copy-Item -Force "$distDir\readme.txt" $tempDir -ErrorAction Stop
|
||||
|
||||
# Create archive
|
||||
7za a -tzip -mx9 $outZip "$tempDir\*"
|
||||
# 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
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
& $7zcmd a -tzip -mx9 $outZip "$tempDir\*"
|
||||
|
||||
# Remove temp directory
|
||||
Remove-Item -Force -Recurse $tempDir -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
do-prepareSource $server $buildNo
|
||||
do-prepareSource
|
||||
do-build
|
||||
do-package
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
&("..\bin\openrct2.exe") $args
|
||||
$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path
|
||||
$rootPath = Split-Path (Split-Path $scriptsPath)
|
||||
&("$rootPath\bin\openrct2.exe") $args
|
||||
|
||||
26
setenv.ps1
26
setenv.ps1
@@ -2,19 +2,12 @@
|
||||
# Setups a PowerShell environment for OpenRCT2 development
|
||||
###########################################################
|
||||
|
||||
function AppExists($app)
|
||||
{
|
||||
$result = (Get-Command $app -CommandType Application -ErrorAction SilentlyContinue)
|
||||
return ($result -ne $null -and $result.Count -gt 0)
|
||||
}
|
||||
|
||||
function AddPath($path)
|
||||
{
|
||||
$env:path = "$path;$env:path"
|
||||
}
|
||||
|
||||
# Setup
|
||||
$ErrorActionPreference = "Stop"
|
||||
$rootPath = Split-Path $Script:MyInvocation.MyCommand.Path
|
||||
$scriptsPath = "$rootPath\scripts\ps"
|
||||
Import-Module "$scriptsPath\common.psm1" -DisableNameChecking
|
||||
|
||||
Write-Host "Setting up OpenRCT2 development environment for Windows" -ForegroundColor Cyan
|
||||
|
||||
$appExists = @{}
|
||||
@@ -24,10 +17,17 @@ $appExists["7z"] = AppExists("7z");
|
||||
|
||||
if (-not $appExists["msbuild"])
|
||||
{
|
||||
$lookPath = Join-Path ${env:ProgramFiles(x86)} "MSBuild\14.0\Bin\amd64\MSBuild.exe"
|
||||
if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64")
|
||||
{
|
||||
$lookPath = Join-Path ${env:ProgramFiles(x86)} "MSBuild\14.0\Bin\amd64\MSBuild.exe"
|
||||
}
|
||||
else
|
||||
{
|
||||
$lookPath = Join-Path $env:ProgramFiles "MSBuild\14.0\Bin\MSBuild.exe"
|
||||
}
|
||||
if (Test-Path $lookPath)
|
||||
{
|
||||
AddPath($lookPath)
|
||||
AddPath(Split-Path $lookPath)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user