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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 210 additions and 114 deletions

View File

@ -20,6 +20,7 @@ AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true

View File

@ -9,11 +9,12 @@ jobs:
name: Check code formatting
runs-on: ubuntu-latest
container:
image: openrct2/openrct2:format
image: openrct2/openrct2-build:0.2.4-format
steps:
- uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v1
- name: Run clang-format
run: scripts/run-clang-format.py -r src test --exclude src/openrct2/thirdparty
run: scripts/check-code-formatting
windows:
name: Windows
runs-on: windows-latest
@ -25,8 +26,8 @@ jobs:
CONFIGURATION: Release
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Checkout
uses: actions/checkout@v1
- name: Build OpenRCT2
shell: bash
run: . scripts/setenv && build
@ -37,8 +38,8 @@ jobs:
build-portable
build-symbols
build-installer -i
- uses: actions/upload-artifact@master
name: Upload artifacts (CI)
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v1
with:
name: "OpenRCT2-Windows-${{ matrix.platform }}"
path: artifacts
@ -56,20 +57,20 @@ jobs:
else
echo 'Not going to push build'
fi
osx:
macos:
name: macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Checkout
uses: actions/checkout@v1
- name: Build OpenRCT2
run: |
. scripts/setenv
xcodebuild
mkdir -p artifacts
mv build/Release/OpenRCT2.app artifacts
- uses: actions/upload-artifact@master
name: Upload artifacts (CI)
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v1
with:
name: "OpenRCT2-macOS"
path: artifacts
@ -84,36 +85,111 @@ jobs:
else
echo 'Not going to push build'
fi
build-appimage:
linux-portable:
name: Linux (x64, portable)
runs-on: ubuntu-latest
container:
image: openrct2/openrct2-build:0.2.4-bionic
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Get pre-reqs
shell: bash
run: . scripts/setenv && get-discord-rpc
- name: Build OpenRCT2
shell: bash
run: . scripts/setenv -q && build -DWITH_TESTS=on -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=ON -DPORTABLE=ON -DCMAKE_CXX_FLAGS="-g -gz"
- name: Build artifacts
shell: bash
run: . scripts/setenv -q && build-portable artifacts/OpenRCT2-Linux-x86_64.tar.gz bin/install/usr
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v1
with:
name: "OpenRCT2-Linux-x86_64"
path: artifacts
- name: Run Tests
shell: bash
run: . scripts/setenv -q && run-tests
- name: Upload artifacts (openrct2.org)
shell: bash
run: |
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/OpenRCT2-Linux-x86_64.tar.gz linux-x86_64 $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
fi
linux-portable-32:
name: Linux (i686, portable)
runs-on: ubuntu-latest
container:
image: openrct2/openrct2-build:0.2.4-bionic32
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Get pre-reqs
shell: bash
run: . scripts/setenv && get-discord-rpc
- name: Build OpenRCT2
shell: bash
env:
TESTPAINT: true
run: . scripts/setenv -q && build -DWITH_TESTS=on -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=ON -DPORTABLE=ON -DFORCE32=ON -DCMAKE_CXX_FLAGS="-m32 -gz"
- name: Build artifacts
shell: bash
run: . scripts/setenv -q && build-portable artifacts/OpenRCT2-Linux-i686.tar.gz bin/install/usr
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v1
with:
name: "OpenRCT2-Linux-i686"
path: artifacts
- name: Run Tests
shell: bash
run: . scripts/setenv -q && run-tests
- name: Run testpaint
shell: bash
run: . scripts/setenv -q && run-testpaint
- name: Upload artifacts (openrct2.org)
shell: bash
run: |
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/OpenRCT2-Linux-i686.tar.gz linux-i686 $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
fi
linux-appimage:
name: Linux (x64, AppImage)
runs-on: ubuntu-latest
container:
image: openrct2/openrct2:ubuntu_amd64
image: openrct2/openrct2-build:0.2.4-bionic
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Checkout
uses: actions/checkout@v1
- name: Get pre-reqs
run: |
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
mkdir bin && cd bin
apt-get update
apt-get install -y wget libcairo2
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy*.AppImage
shell: bash
run: . scripts/setenv -q && get-discord-rpc
- name: Build OpenRCT2
working-directory: bin
run: |
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
ninja -v
DESTDIR=AppDir ninja install
shell: bash
env:
DESTDIR: AppDir
run: . scripts/setenv -q && build -DCMAKE_BUILD_TYPE=Release
- name: Build AppImage
working-directory: bin
run: |
./linuxdeploy*.AppImage --appimage-extract-and-run --appdir AppDir/ --output appimage --desktop-file AppDir/usr/share/applications/openrct2.desktop
mkdir artifacts
mv OpenRCT2*.AppImage artifacts
- uses: actions/upload-artifact@master
shell: bash
run: . scripts/setenv -q && build-appimage
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v1
with:
name: OpenRCT2-AppImage
path: bin/artifacts
path: artifacts
linux-clang:
name: Linux (Debug, [http, network, OpenGL] disabled) using clang
runs-on: ubuntu-latest
container:
image: openrct2/openrct2-build:0.2.4-bionic
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build OpenRCT2
shell: bash
run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DDISABLE_NETWORK=ON -DDISABLE_HTTP_TWITCH=ON -DDISABLE_OPENGL=ON

View File

@ -25,55 +25,6 @@ env:
matrix:
include:
- os: linux
name: Ubuntu amd64 GCC MinSizeRel
if: type != cron
services:
- docker
env:
- OPENRCT2_CMAKE_OPTS="-G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=OpenRCT2 -DPORTABLE=ON -DCMAKE_CXX_FLAGS=\"-g -gz\"" TARGET=ubuntu_amd64
- secure: "S3u2VCE2Vy8KNXoeh+DhnzjCmgTX0r95uEZrXDU+IKANOOCKn7Dg4OFDZE3LY/i1y2/EUDpnR5yLC38Ks795EUP/sv/OoMl4tjQ20yERjqWh+gcIRrgx7SdVabuAh3t4aBdaLD4Pfnj5avxeCt6rL7yGnj0wdbrbJSBZPsgSnuQ="
after_success:
- sudo chown -R $USER build
- cd build
# make install is done inside docker
- mv OpenRCT2/bin/openrct2 OpenRCT2/ && mv OpenRCT2/bin/openrct2-cli OpenRCT2/ && mv OpenRCT2/bin/libopenrct2.so OpenRCT2/ && mv OpenRCT2/share/openrct2 OpenRCT2/data && mv OpenRCT2/share/doc/openrct2 OpenRCT2/doc && mv OpenRCT2/bin/libdiscord-rpc.so OpenRCT2/
- rm -rf OpenRCT2/bin OpenRCT2/share # remove empty dirs
- tar cvzf openrct2-linux.tar.gz OpenRCT2/
- ls -lR
- if [[ "z${TRAVIS_TAG}" != "z" ]] ; then
export PUSH_BRANCH=master ;
else export PUSH_BRANCH=$TRAVIS_BRANCH ; export FILENAME_PART=-${TRAVIS_BRANCH}-$(git rev-parse --short HEAD) ;
fi
- curl -m $CURL_MAX_TIME --connect-timeout $CURL_CONNECT_TIMEOUT --upload-file openrct2-linux.tar.gz https://transfer.sh/openrct2-linux-x86_64.tar.gz -o link && cat link && echo || echo "Failed transfer.sh upload"
- if [[ "z$OPENRCT2_ORG_TOKEN" != "z" && "$TRAVIS_PULL_REQUEST" == "false" && ("${TRAVIS_BRANCH}" =~ ^(develop|push/) || "z${TRAVIS_TAG}" != "z") ]] ; then
curl -m $CURL_MAX_TIME --connect-timeout $CURL_CONNECT_TIMEOUT -o - -v --form "key=$OPENRCT2_ORG_TOKEN" --form "fileName=OpenRCT2-${OPENRCT2_VERSION}${FILENAME_PART}-linux-x86_64.tar.gz" --form "version=${OPENRCT2_VERSION}" --form "gitHash=$TRAVIS_COMMIT" --form "gitBranch=$PUSH_BRANCH" --form "flavourId=9" --form "file=@openrct2-linux.tar.gz" "https://openrct2.org/altapi/?command=push-build";
fi
- os: linux
name: Ubuntu i686 GCC Debug m32 no-build-shared-libs
if: type != cron
services:
- docker
env:
- OPENRCT2_CMAKE_OPTS="-G Ninja -DFORCE32=ON -DBUILD_SHARED_LIBS=off -DCMAKE_INSTALL_PREFIX=OpenRCT2 -DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS=\"-coverage -m32 -gz\"" TARGET=ubuntu_i686
- secure: "S3u2VCE2Vy8KNXoeh+DhnzjCmgTX0r95uEZrXDU+IKANOOCKn7Dg4OFDZE3LY/i1y2/EUDpnR5yLC38Ks795EUP/sv/OoMl4tjQ20yERjqWh+gcIRrgx7SdVabuAh3t4aBdaLD4Pfnj5avxeCt6rL7yGnj0wdbrbJSBZPsgSnuQ="
- secure: "JGMzQHmDgpnVzP2uYP5KL7h6SzzGmL4kH7vJmGQRpudKAEzhzB0n7lzjrJOU82hxwmuQQ+RKlE/uxdI32Xbgl+wzZMdfQoZGMWHZfl8Le0Ft5gfZncPuE3poCbiSyPSXok9zU12JHKpEjV/sgqXv/HwhL3jAC68GPGpmxb6xWj8="
after_success:
- sudo chown -R $USER build
- cd build
# make install is done inside docker
- mv OpenRCT2/bin/openrct2 OpenRCT2/ && mv OpenRCT2/share/openrct2 OpenRCT2/data && mv OpenRCT2/share/doc/openrct2 OpenRCT2/doc
- rm -rf OpenRCT2/bin OpenRCT2/share # remove empty dirs
- tar cvzf openrct2-linux.tar.gz OpenRCT2/
- ls -lR
- if [[ "z${TRAVIS_TAG}" != "z" ]] ; then
export PUSH_BRANCH=master ;
else export PUSH_BRANCH=$TRAVIS_BRANCH ; export FILENAME_PART=-${TRAVIS_BRANCH}-$(git rev-parse --short HEAD) ;
fi
- curl -m $CURL_MAX_TIME --connect-timeout $CURL_CONNECT_TIMEOUT --upload-file openrct2-linux.tar.gz https://transfer.sh/openrct2-linux-i686.tar.gz -o link && cat link && echo || echo "Failed transfer.sh upload"
- if [[ "z$OPENRCT2_ORG_TOKEN" != "z" && "$TRAVIS_PULL_REQUEST" == "false" && ("${TRAVIS_BRANCH}" =~ ^(develop|push/) || "z${TRAVIS_TAG}" != "z") ]] ; then
curl -m $CURL_MAX_TIME --connect-timeout $CURL_CONNECT_TIMEOUT -o - -v --form "key=$OPENRCT2_ORG_TOKEN" --form "fileName=OpenRCT2-${OPENRCT2_VERSION}${FILENAME_PART}-linux-i686.tar.gz" --form "version=${OPENRCT2_VERSION}" --form "gitHash=$TRAVIS_COMMIT" --form "gitBranch=$PUSH_BRANCH" --form "flavourId=4" --form "file=@openrct2-linux.tar.gz" "https://openrct2.org/altapi/?command=push-build";
fi
- os: linux
name: Ubuntu amd64 Clang
if: type != cron

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