1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-11 01:52:32 +01:00

Move Windows CI from AppVeyor to GitHub actions (#10573)

This commit is contained in:
Ted John
2020-01-16 13:17:17 +00:00
committed by GitHub
parent b9ee231a59
commit ee09ffadf7
8 changed files with 128 additions and 140 deletions

View File

@@ -14,6 +14,63 @@ jobs:
- uses: actions/checkout@v1
- name: Run clang-format
run: scripts/run-clang-format.py -r src test --exclude src/openrct2/thirdparty
windows:
name: Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
platform: [win32, x64]
env:
CONFIGURATION: Release
PLATFORM: ${{ matrix.platform }}
GIT_COMMIT_SHA1: ${{ github.sha }}
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Install NSIS
shell: bash
run: scripts/install-nsis
- name: Prepare environment
shell: bash
run: dos2unix test/tests/testdata/keys/*
- name: Build OpenRCT2
shell: pwsh
run: |
$env:GIT_BRANCH = $env:GITHUB_REF -replace "refs/heads/(.*)", '$1'
$env:GIT_DESCRIBE = (git describe HEAD | sed -E "s/-g.+$//")
$env:BUILD_VERSION = $env:GIT_DESCRIBE | sed "s/v//" | sed "s/-/./"
Set-Content -Path 'resources\version.h' -Value "#define OPENRCT2_FILE_VERSION $($env:BUILD_VERSION -replace "\.", ",")"
Add-Content -Path 'resources\version.h' -Value "#define OPENRCT2_PRODUCT_VERSION `"$($env:BUILD_VERSION)-$($env:GIT_COMMIT_SHA1.Substring(0,10))`""
Remove-Item -Force -Recurse "C:\Program Files (x86)\NSIS"
cmd /c 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" && msbuild openrct2.proj'
- name: Run Tests
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild openrct2.proj /t:test
- uses: actions/upload-artifact@master
name: Upload artifacts (CI)
with:
name: "OpenRCT2-Windows-${{ matrix.platform }}"
path: artifacts
- name: Upload artifacts (openrct2.org)
shell: bash
run: |
if [[ "$OPENRCT2_ORG_TOKEN" != "" ]]; then
if [[ $GITHUB_REF == refs/tags/* ]]; then
GITHUB_BRANCH=
else
GITHUB_BRANCH=${GITHUB_REF#refs/heads/}
if [[ ! "$GITHUB_BRANCH" =~ ^(develop|push/) ]]; then
exit 0
fi
fi
scripts/upload-build artifacts/openrct2-portable-*.zip "windows-portable-$PLATFORM" $OPENRCT2_VERSION $GIT_COMMIT_SHA1 $GITHUB_BRANCH
scripts/upload-build artifacts/openrct2-installer-*.exe "windows-installer-$PLATFORM" $OPENRCT2_VERSION $GIT_COMMIT_SHA1 $GITHUB_BRANCH
scripts/upload-build artifacts/openrct2-symbols-*.zip "windows-symbols-$PLATFORM" $OPENRCT2_VERSION $GIT_COMMIT_SHA1 $GITHUB_BRANCH
fi
osx:
name: macOS
runs-on: macos-latest
@@ -57,6 +114,7 @@ jobs:
image: openrct2/openrct2:ubuntu_amd64
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Get pre-reqs
run: |
git clone https://github.com/discordapp/discord-rpc -b v3.4.0

View File

@@ -1,39 +0,0 @@
version: 0.2.4.{build}
image:
- Visual Studio 2017
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:
OPENRCT2_ORG_TOKEN:
secure: esyy5+5PRKZNYZ1hx1w/JpJGVwEC/YsJXnPp3cH98Yu7sW6/a03z/oJ1m9jhM/nDv5HL0swVK7pi9qQsN0utRg==
BUILD_SERVER: AppVeyor
PATH: C:\ProgramData\chocolatey\bin;$(PATH);C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
install:
- ps: >-
.\scripts\ps\appveyor_install.ps1
platform:
- x64
- Win32
configuration: Release
before_build:
- ps: Set-Content -Path '.\resources\version.h' -Value "#define OPENRCT2_FILE_VERSION $($env:APPVEYOR_BUILD_VERSION -replace "\.", ",")"
- ps: Add-Content -Path '.\resources\version.h' -Value "#define OPENRCT2_PRODUCT_VERSION `"$($env:APPVEYOR_BUILD_VERSION)-$($env:APPVEYOR_REPO_COMMIT.Substring(0,10))`""
build:
parallel: true
project: openrct2.proj
test_script:
- ps: msbuild openrct2.proj /t:Test /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
after_test:
- ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\artifacts\test-results.xml))
artifacts:
- path: .\artifacts\openrct2-portable*.zip
name: OpenRCT2-portable
- path: .\artifacts\openrct2-installer*.exe
name: OpenRCT2-installer
- path: .\artifacts\openrct2-symbols*.zip
name: OpenRCT2 debug symbols
deploy_script:
- ps: >-
.\scripts\ps\appveyor_deploy.ps1

View File

@@ -0,0 +1,29 @@
#!/bin/bash
set -e
if [[ "$#" -ne 2 ]]; then
echo 'Turn an OpenRCT2 cmake install into a portable tar.gz.'
echo ''
echo 'Usage: create-portable-build <output-file> <install-path>'
exit 1
fi
output=$1
install=$2
echo -e "\033[0;36mCreating $output..."
workdir=$output-temp
if [[ -d "$workdir" ]]
then
rm -rf $workdir
fi
mkdir -p $workdir/OpenRCT2
cp -r $install/bin/* $workdir/OpenRCT2
cp -r $install/share/doc $workdir/OpenRCT2
cp -r $install/share/openrct2 $workdir/OpenRCT2/data
pushd $workdir > /dev/null
tar -czf output.tar.gz OpenRCT2
popd > /dev/null
mv $workdir/output.tar.gz $output
rm -rf $workdir
echo -e "\033[0;32m$output created successfully"

25
scripts/install-nsis Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -e
nsisdir="C:/ProgramData/chocolatey/lib/nsis.portable"
if [[ -d $nsisdir ]]
then
echo -e "\033[0;36mNSIS already installed."
exit 0
fi
echo -e "\033[0;36mDownloading NSIS from chocolatey..."
cinst nsis.portable --version=3.01-beta1
echo -e "\033[0;36mDownloading KillProcDLL for NSIS..."
curl -sLo nsisxtra.zip "http://nsis.sourceforge.net/mediawiki/images/5/53/KillProcDll%26FindProcDll.zip"
7z x nsisxtra.zip
cp FindProcDLL.dll "$nsisdir/tools/nsis-3.0b1/Plugins/x86-ansi"
echo -e "\033[0;36mDownloading UAC plugin for NSIS..."
curl -sLo uac.zip "http://nsis.sourceforge.net/mediawiki/images/8/8f/UAC.zip"
7z x uac.zip
cp UAC.nsh "$nsisdir/tools/nsis-3.0b1/Include"
cp -r Plugins "$nsisdir/tools/nsis-3.0b1"
echo -e "\033[0;32mNSIS installed!"

View File

@@ -1,31 +0,0 @@
###########################################
# Script to deploy OpenRCT2 from AppVeyor #
###########################################
$nottesting = (${env:Configuration} -notlike "*tests")
# Only deploy from VS2017 for now.
$notvs2015 = (${env:APPVEYOR_JOB_NAME} -notlike "*2015*")
if ($nottesting -and $notvs2015)
{
# Check if OpenRCT2.org API security token is available
if (${env:OPENRCT2_ORG_TOKEN})
{
# Only upload tagged builds, develop branch or push/ branches
if (${env:APPVEYOR_REPO_TAG} -eq "true" -or ${env:APPVEYOR_REPO_BRANCH} -match "^develop$|^push/")
{
msbuild openrct2.proj /t:UploadArtifacts /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
# curl is sometimes aliased so be explicit
$zipPath = (Get-ChildItem artifacts/openrct2-symbols-*.zip).FullName
Write-Host "Uploading $zipPath to backtrace.io..."
curl.exe --data-binary "@$zipPath" 'https://openrct2.sp.backtrace.io:6098/post?format=symbols&token=e9e6d681fafdeac9f6131b4b59a155d54bebad567a8c0380d70643f4414819f5'
}
else
{
Write-Host "No deployment: Non-tagged or push branch." -ForegroundColor Yellow
}
}
else
{
Write-Host "No deployment: %OPENRCT2_ORG_TOKEN% not available." -ForegroundColor Yellow
}
}

View File

@@ -1,56 +0,0 @@
#########################################################
# Script to setup OpenRCT2 for building on AppVeyor
#########################################################
$testing = (${env:Configuration} -like "*tests")
function Check-ExitCode
{
if ($LASTEXITCODE -ne 0)
{
$host.SetShouldExit($LASTEXITCODE)
}
}
# Check if OpenRCT2.org API security token is available
if (${env:OPENRCT2_ORG_TOKEN} -and -not $testing)
{
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
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"
Write-Host "Downloading UAC plugin for NSIS..." -ForegroundColor Cyan
curl "http://nsis.sourceforge.net/mediawiki/images/8/8f/UAC.zip" -OutFile uac.zip
Check-ExitCode
7z x uac.zip > $null
Check-ExitCode
cp UAC.nsh "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1\Include"
cp Plugins "C:\ProgramData\chocolatey\lib\nsis.portable\tools\nsis-3.0b1" -Recurse -Force
}
}
else
{
# Don't build the NSIS installer for non-uploaded builds
${env:NO_NSIS} = "true"
}
$env:GIT_TAG = $env:APPVEYOR_REPO_TAG_NAME
if (${env:APPVEYOR_REPO_TAG} -ne "true")
{
$env:GIT_BRANCH = $env:APPVEYOR_REPO_BRANCH
}
$env:GIT_COMMIT_SHA1 = $env:APPVEYOR_REPO_COMMIT
$env:GIT_DESCRIBE = (git describe HEAD | sed -E "s/-g.+$//")

View File

@@ -1,3 +0,0 @@
$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path
$rootPath = Split-Path (Split-Path $scriptsPath)
&("$rootPath\bin\openrct2.exe") $args

View File

@@ -22,43 +22,48 @@ sha1=$4
branch=$5
case "$flavour" in
windows-portable-x86)
flavour=windows
windows-portable-win32)
flavour=windows-win32.zip
flavourid=1
;;
windows-portable-x64)
flavour=windows
flavour=windows-x64.zip
flavourid=6
;;
windows-installer-x86)
flavour=windows
windows-installer-win32)
flavour=windows-win32.exe
flavourid=2
;;
windows-installer-x64)
flavour=windows
flavour=windows-x64.exe
flavourid=7
;;
windows-symbols-x86)
flavour=windows
windows-symbols-win32)
flavour=windows-win32-symbols.zip
flavourid=5
;;
windows-symbols-x64)
flavour=windows
flavour=windows-x64-symbols.zip
flavourid=10
;;
macos)
flavour=macos.zip
flavourid=3
;;
linux-i686)
flavour=linux-i686.tar.gz
flavourid=4
;;
linux-x86_64)
flavour=linux-x86_64.tar.gz
flavourid=9
;;
android-arm)
flavour=android-arm.apk
flavourid=11
;;
android-x86)
flavour=android-x86.apk
flavourid=12
;;
*)
@@ -69,14 +74,14 @@ esac
if [ "$branch" != "" ]; then
versionextra=-$branch-${sha1:0:7}
fi
filename=OpenRCT2-$version$versionextra-$flavour.zip
filename=OpenRCT2-$version$versionextra-$flavour
echo -e "\033[0;36mUploading to openrct2.org as '$filename'..."
if [ "$OPENRCT2_ORG_TOKEN" == "" ]; then
echo -e "\033[0;31mOPENRCT2_ORG_TOKEN not set"
exit 1
fi
curl -m 300 --connect-timeout 5 -o - -v \
curl -m 300 --connect-timeout 5 -o - \
--form "key=$OPENRCT2_ORG_TOKEN" \
--form "fileName=$filename" \
--form "version=$version" \