1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Add Linux portable to GitHub CI (#10612)

This commit is contained in:
Ted John
2020-01-24 11:46:12 +00:00
committed by GitHub
parent 5be2604f27
commit eab255c4bf
11 changed files with 210 additions and 114 deletions

View File

@@ -5,22 +5,33 @@ set -e
basedir="$(readlink -f `dirname $0`/..)"
cd $basedir
# Patch version.h
if [[ "$OPENRCT2_BUILD" != "" ]]; then
echo -e "\033[0;36mPatching version.h...\033[0m"
fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD
productversion="$fileversion-${OPENRCT2_SHA1_SHORT}"
fileversion=${fileversion//./,}
echo "#define OPENRCT2_FILE_VERSION $fileversion" > "resources/version.h"
echo "#define OPENRCT2_PRODUCT_VERSION \"$productversion\"" >> "resources/version.h"
cat "resources/version.h"
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
# Patch version.h
if [[ "$OPENRCT2_BUILD" != "" ]]; then
echo -e "\033[0;36mPatching version.h...\033[0m"
fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD
productversion="$fileversion-${OPENRCT2_SHA1_SHORT}"
fileversion=${fileversion//./,}
echo "#define OPENRCT2_FILE_VERSION $fileversion" > "resources/version.h"
echo "#define OPENRCT2_PRODUCT_VERSION \"$productversion\"" >> "resources/version.h"
cat "resources/version.h"
fi
# Build everything
echo -e "\033[0;36mBuilding OpenRCT2 for Windows $CONFIGURATION|$PLATFORM...\033[0m"
vstool msbuild openrct2.proj //t:build
# Create openrct2.exe and openrct2.com with correct subsystem
cp bin/openrct2.exe bin/openrct2.com
vstool editbin //subsystem:console bin/openrct2.com
vstool editbin //subsystem:windows bin/openrct2.exe
else
echo -e "\033[0;36mBuilding OpenRCT2...\033[0m"
mkdir -p bin && cd bin
export DESTDIR=install
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/usr "$@"
if [[ "$TESTPAINT" == "true" ]]; then
testpaint_target=testpaint
fi
ninja -v $testpaint_target all install
fi
# Build everything
echo -e "\033[0;36mBuilding OpenRCT2 for Windows $CONFIGURATION|$PLATFORM...\033[0m"
vstool msbuild openrct2.proj //t:build
# Create openrct2.exe and openrct2.com with correct subsystem
cp bin/openrct2.exe bin/openrct2.com
vstool editbin //subsystem:console bin/openrct2.com
vstool editbin //subsystem:windows bin/openrct2.exe

18
scripts/build-appimage Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
echo -e "\033[0;36mBuilding AppImage for OpenRCT2...\033[0m"
# Ensure we are in root directory
basedir="$(readlink -f `dirname $0`/..)"
cd $basedir
linuxdeploy=/tmp/linuxdeploy-x86_64.AppImage
curl -Lo $linuxdeploy https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x $linuxdeploy
pushd bin
$linuxdeploy --appimage-extract-and-run --appdir install/ --output appimage --desktop-file install/usr/share/applications/openrct2.desktop
popd
mkdir -p artifacts
mv bin/OpenRCT2*.AppImage artifacts
rm $linuxdeploy

View File

@@ -31,14 +31,19 @@ else
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>'
echo 'Usage: build-portable <output-file> <install-path>'
exit 1
fi
output=$1
install=$2
echo -e "\033[0;36mCreating $output..."
echo -e "\033[0;36mCreating $output...\033[0m"
outputdir=$(dirname $output)
if ! [[ -d $outputdir ]]; then
mkdir -p $outputdir
fi
workdir=$output-temp
if [[ -d "$workdir" ]]
then
@@ -47,12 +52,12 @@ else
mkdir -p $workdir/OpenRCT2
cp -r $install/bin/* $workdir/OpenRCT2
cp -r $install/share/doc $workdir/OpenRCT2
cp -r $install/share/doc/openrct2 $workdir/OpenRCT2/doc
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"
echo -e "\033[0;32m$output created successfully\033[0m"
fi

8
scripts/check-code-formatting Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
set -e
# Ensure we are in root directory
basedir="$(readlink -f `dirname $0`/..)"
cd $basedir
scripts/run-clang-format.py -r src test --exclude src/openrct2/thirdparty

8
scripts/get-discord-rpc Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
set -e
basedir="$(readlink -f `dirname $0`/..)"
cd $basedir
git clone https://github.com/discordapp/discord-rpc -b v3.4.0
git clone https://github.com/janisozaur/rapidjson discord-rpc/thirdparty/rapidjson -b patch-1

13
scripts/run-testpaint Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
# Ensure we are in root directory
basedir="$(readlink -f `dirname $0`/..)"
cd $basedir/bin
# Scan objects first so that does not happen within a test
echo -e "\033[0;36mBuilding OpenRCT2 repository indexes...\033[0m"
./openrct2 scan-objects
echo -e "\033[0;36mRunning OpenRCT2 testpaint tests...\033[0m"
./testpaint || true

View File

@@ -5,13 +5,18 @@ set -e
basedir="$(readlink -f `dirname $0`/..)"
cd $basedir/bin
# Ensure test data uses LF
dos2unix testdata/keys/*
# Scan objects first so that does not happen within a test
echo -e "\033[0;36mBuilding OpenRCT2 repository indexes...\033[0m"
./openrct2 scan-objects
# Now run all the tests
echo -e "\033[0;36mRunning OpenRCT2 tests...\033[0m"
./tests --gtest_output=xml:../artifacts/test-results.xml
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
# Ensure test data uses LF
dos2unix testdata/keys/*
# Now run all the tests
echo -e "\033[0;36mRunning OpenRCT2 tests...\033[0m"
./tests --gtest_output=xml:../artifacts/test-results.xml
else
echo -e "\033[0;36mRunning OpenRCT2 tests...\033[0m"
ctest --output-on-failure
fi

View File

@@ -50,7 +50,7 @@ fi
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$(pwd)/${1#./}"
}
scriptsdir="$(realpath `dirname ${BASH_SOURCE[0]}`)"
scriptsdir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"
export PATH="$scriptsdir:$PATH"
# Output all the variables