1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 21:43:06 +01:00

Merge pull request #16770 from Margen67/scripts_part1

This commit is contained in:
Tulio Leao
2022-03-17 23:42:53 -03:00
committed by GitHub
19 changed files with 128 additions and 82 deletions

View File

@@ -1,5 +1,21 @@
name: CI
on: [push, pull_request]
on:
push:
paths-ignore:
- '.editorconfig'
- '.gitattributes'
- '.github/*_TEMPLATE/**'
- '.github/workflows/localisation.yml'
- '.gitignore'
- '.vscode/**'
pull_request:
paths-ignore:
- '.editorconfig'
- '.gitattributes'
- '.github/*_TEMPLATE/**'
- '.github/workflows/localisation.yml'
- '.gitignore'
- '.vscode/**'
defaults:
run:
shell: bash
@@ -17,7 +33,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Commit Messages
@@ -27,13 +43,14 @@ jobs:
check-code-formatting:
name: Check code formatting
runs-on: ubuntu-latest
container:
image: openrct2/openrct2-build:4-format
container: openrct2/openrct2-build:4-format
defaults:
run:
shell: sh
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Run clang-format
shell: sh
run: scripts/check-code-formatting
windows:
name: Windows
@@ -48,7 +65,7 @@ jobs:
PLATFORM: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Build OpenRCT2
run: . scripts/setenv && build
- name: Build artifacts
@@ -58,7 +75,7 @@ jobs:
build-symbols
build-installer -i
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-${{ matrix.platform }}
path: artifacts
@@ -69,10 +86,10 @@ jobs:
run: |
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/openrct2-portable-*.zip "windows-portable-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-installer-*.exe "windows-installer-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-symbols-*.zip "windows-symbols-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-backtrace-symbols artifacts/openrct2-symbols-*.zip
upload-build artifacts/openrct2-portable-*.zip "windows-portable-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-installer-*.exe "windows-installer-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-symbols-*.zip "windows-symbols-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-backtrace-symbols artifacts/openrct2-symbols-*.zip
else
echo 'Not going to push build'
fi
@@ -80,8 +97,7 @@ jobs:
name: Windows (${{ matrix.platform_name }}) using mingw
runs-on: ubuntu-latest
needs: check-code-formatting
container:
image: openrct2/openrct2-build:4-mingw
container: openrct2/openrct2-build:4-mingw
strategy:
fail-fast: false
matrix:
@@ -97,7 +113,7 @@ jobs:
build_flags: -DDISABLE_HTTP=Off -DENABLE_SCRIPTING=ON -DCMAKE_CXX_FLAGS="-Wno-error=cast-function-type -Wno-error=unused-function" -DSTATIC=on -DMINGW_TARGET_NT5_1=ON
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
@@ -105,14 +121,14 @@ jobs:
- name: Build OpenRCT2
run: |
sudo su
mkdir bin && cd bin
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt -DCMAKE_BUILD_TYPE=Release -DDISABLE_IPO=on -DFORCE32=on ${{ matrix.build_flags }}
cmake -B bin -G Ninja -DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt -DCMAKE_BUILD_TYPE=Release -DDISABLE_IPO=on -DFORCE32=on ${{ matrix.build_flags }}
cd bin
ninja -k0
- name: Upload artifacts (CI)
if: matrix.platform == 'NT5.1'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ matrix.platform }}
name: OpenRCT2-Windows-${{ matrix.platform }}
path: bin/openrct2.exe
if-no-files-found: error
macos-cmake:
@@ -127,7 +143,7 @@ jobs:
- arch: x64
cache_key: macos-x64
# Note: only build/run tests on the native architecture of the CI agent
# Github macos-latest agents are currently all Intel
# GitHub macos-latest agents are currently all Intel
build_flags: -DARCH="x86_64" -DWITH_TESTS=on
run_tests: true
- arch: arm64
@@ -136,7 +152,7 @@ jobs:
run_tests: false
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
@@ -157,7 +173,7 @@ jobs:
cd artifacts
zip -rqy openrct2-macos.zip OpenRCT2.app
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-${{ matrix.arch }}-cmake
path: artifacts/openrct2-macos.zip
@@ -168,14 +184,14 @@ jobs:
needs: macos-cmake
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: download x64 app bundle
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-x64-cmake
path: macos_universal/x64
- name: download arm64 app bundle
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-arm64-cmake
path: macos_universal/arm64
@@ -195,7 +211,7 @@ jobs:
cd artifacts
zip -rqy openrct2-macos.zip OpenRCT2.app
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-universal
path: artifacts/openrct2-macos.zip
@@ -204,16 +220,15 @@ jobs:
run: |
. scripts/setenv
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/openrct2-macos.zip macos $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-macos.zip macos $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
echo 'Not going to push build'
fi
linux-portable:
name: Linux (${{ matrix.platform }}, ${{ matrix.distro }}, portable)
runs-on: ubuntu-latest
needs: check-code-formatting
container:
image: ${{ matrix.image }}
container: ${{ matrix.image }}
strategy:
fail-fast: false
matrix:
@@ -236,7 +251,7 @@ jobs:
build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g -gz"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
@@ -248,7 +263,7 @@ jobs:
- name: Build artifacts
run: . scripts/setenv -q && build-portable artifacts/OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}.tar.gz bin/install/usr
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}
path: artifacts
@@ -260,19 +275,18 @@ jobs:
run: |
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}.tar.gz linux-${{ matrix.platform }} $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/OpenRCT2-${{ runner.os }}-${{ matrix.distro }}-${{ matrix.platform }}.tar.gz linux-${{ matrix.platform }} $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
echo 'Not going to push build'
fi
linux-appimage:
name: Linux (x64, AppImage)
runs-on: ubuntu-latest
needs: check-code-formatting
container:
image: openrct2/openrct2-build:0.3.1-bionic
container: openrct2/openrct2-build:0.3.1-bionic
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
@@ -284,7 +298,7 @@ jobs:
- name: Build AppImage
run: . scripts/setenv -q && build-appimage
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-AppImage
path: artifacts
@@ -308,7 +322,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout image
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: OpenRCT2/openrct2-docker
- name: Build image
@@ -321,20 +335,19 @@ jobs:
OPENRCT2_BRANCH=$(echo "$GITHUB_REF" | sed 's/refs\/heads\///')
echo "Current branch is $OPENRCT2_BRANCH"
if [ "$OPENRCT2_BRANCH" = 'develop' ]; then
docker login -u "$OPENRCT2_DOCKER_USER" -p "$OPENRCT2_DOCKER_PASS"
docker push openrct2/openrct2-cli:develop
docker login -u "$OPENRCT2_DOCKER_USER" -p "$OPENRCT2_DOCKER_PASS"
docker push openrct2/openrct2-cli:develop
else
echo 'Image not pushed'
echo 'Image not pushed'
fi
linux-clang:
name: Linux (Debug, [http, network, OpenGL] disabled) using clang
runs-on: ubuntu-latest
needs: check-code-formatting
container:
image: openrct2/openrct2-build:0.3.1-bionic
container: openrct2/openrct2-build:0.3.1-bionic
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
@@ -345,11 +358,10 @@ jobs:
name: Android
runs-on: ubuntu-latest
needs: check-code-formatting
container:
image: openrct2/openrct2-build:0.3.1-android
container: openrct2/openrct2-build:0.3.1-android
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
@@ -363,7 +375,7 @@ jobs:
mkdir -p artifacts
mv src/openrct2-android/app/build/outputs/apk/arm/pr/app-arm-pr.apk artifacts/openrct2-arm.apk
- name: Upload artifacts (CI)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: OpenRCT2-Android
path: artifacts
@@ -372,7 +384,7 @@ jobs:
run: |
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/openrct2-arm.apk android-arm $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-arm.apk android-arm $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
echo 'Not going to push build'
fi

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
# Ensure we are in root directory
if [[ $(uname) == "Darwin" ]]; then
@@ -10,7 +12,7 @@ cd $basedir
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
# Patch version.h
if [[ "$OPENRCT2_BUILD" != "" ]]; then
if [[ -n "$OPENRCT2_BUILD" ]]; then
echo -e "\033[0;36mPatching version.h...\033[0m"
fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD
productversion="$fileversion-${OPENRCT2_SHA1_SHORT}"

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
echo -e "\033[0;36mBuilding AppImage for OpenRCT2...\033[0m"

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
if [[ "$#" -gt 2 || "$1" == "-h" ]]; then
echo 'Create a Windows installer for OpenRCT2'
@@ -17,7 +19,7 @@ if [[ "$1" == "-i" ]]; then
fi
basedir="$(readlink -f `dirname $0`/..)"
if [[ "$output" == "" ]]; then
if [[ -z "$output" ]]; then
mkdir -p "$basedir/artifacts"
output="$basedir/artifacts/openrct2-installer-$CONFIGURATION-$PLATFORM.exe"
fi

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
# Create a Windows symbols archive for OpenRCT2

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
# Check 7z or zip is available
if [ -x "$(command -v 7z)" ]; then

View File

@@ -1,8 +1,10 @@
#!/bin/sh -e
#!/usr/bin/env sh
set -e
readlink_bin='readlink'
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ "$(uname)" == "Darwin" ]; then
if ! [ -x "$(command -v greadlink)" ]; then
echo 'Please install greadlink with Homebrew: brew install coreutils'
exit 1

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
echo "Creating macOS universal app bundle"
# create app skeleton

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
if [[ $(uname) == "Linux" ]]; then
basedir="$(readlink -f `dirname $0`/..)"

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
if [[ "$#" -ne 0 && "$#" -ne 2 ]]; then
echo 'Install a portable version of NSIS which can build the OpenRCT2 Windows installer.'

View File

@@ -1,10 +1,12 @@
#!/bin/bash -ex
#!/usr/bin/env bash
set -ex
REPO_ROOT=$(readlink -f $(dirname "$0")/../..)
docker run --rm -it -e NO_CLEANUP=1 -e CI=1 --device /dev/fuse:mrw -v $(readlink -f .):/ws openrct2/openrct2:ubuntu_amd64 bash -exc "
cd /ws
apt-get update
apt-get install -y wget libcairo2
apt-get install -y libcairo2
scripts/linux/build-appimage.sh
"

View File

@@ -1,7 +1,9 @@
#!/bin/bash -ex
#!/usr/bin/env bash
set -ex
# use RAM disk if possible
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
if [ -z "$CI" ] && [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
else
TEMP_BASE=/tmp
@@ -15,7 +17,7 @@ cleanup () {
fi
}
if [ "$NO_CLEANUP" == "" ] && trap cleanup EXIT
if [ -z "$NO_CLEANUP" ] && trap cleanup EXIT
# store repo root as variable
REPO_ROOT=$(readlink -f $(dirname "$0")/../..)
@@ -32,7 +34,7 @@ cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -DCMAKE_BUILD_TYPE=Relea
ninja -k0
DESTDIR=AppDir ninja install
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
curl -fLO https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy*.AppImage
./linuxdeploy*.AppImage --appimage-extract-and-run --appdir AppDir/ --output appimage

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
# Ensure we are in root directory
basedir="$(readlink -f `dirname $0`/..)"

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
# Ensure we are in root directory
if [[ $(uname) == "Darwin" ]]; then

View File

@@ -1,4 +1,6 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
# This sets up more environment variables using the existing environment
# It should be dot sourced into your environment
@@ -34,13 +36,13 @@ else
export OPENRCT2_PUSH=true
fi
fi
if [[ "$OPENRCT2_ORG_TOKEN" == "" ]]; then
if [[ -z "$OPENRCT2_ORG_TOKEN" ]]; then
unset OPENRCT2_PUSH
fi
# Get the short SHA1
export OPENRCT2_SHA1=$GITHUB_SHA
export OPENRCT2_SHA1_SHORT=${OPENRCT2_SHA1:0:7}
export OPENRCT2_SHA1_SHORT=${OPENRCT2_SHA1::7}
unset OPENRCT2_VERSION_EXTRA
if [[ "$OPENRCT2_TAG" != "true" ]]; then
export OPENRCT2_VERSION_EXTRA=$OPENRCT2_BRANCH-$OPENRCT2_SHA1_SHORT

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
if [[ "$#" -ne 1 ]]; then
echo 'Upload OpenRCT2 debug symbols to https://backtrace.io.'
@@ -11,7 +13,7 @@ fi
path=$1
if [ "$BACKTRACE_IO_TOKEN" == "" ]; then
if [ -z "$BACKTRACE_IO_TOKEN" ]; then
echo -e "\033[0;31mBACKTRACE_IO_TOKEN not set"
exit 1
fi

View File

@@ -1,4 +1,6 @@
#!/bin/bash -e
#!/usr/bin/env bash
set -e
if [[ "$#" -ne 4 && "$#" -ne 5 ]]; then
echo 'Upload an OpenRCT2 build to openrct2.org.'
@@ -71,13 +73,13 @@ case "$flavour" in
exit 1
esac
if [ "$branch" != "" ]; then
versionextra=-$branch-${sha1:0:7}
if [ -n "$branch" ]; then
versionextra=-$branch-${sha1::7}
fi
filename=OpenRCT2-$version$versionextra-$flavour
echo -e "\033[0;36mUploading to openrct2.org as '$filename'..."
if [ "$OPENRCT2_ORG_TOKEN" == "" ]; then
if [ -z "$OPENRCT2_ORG_TOKEN" ]; then
echo -e "\033[0;31mOPENRCT2_ORG_TOKEN not set"
exit 1
fi

View File

@@ -1,3 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
vstool.cmd $@

View File

@@ -120,7 +120,7 @@ if $cygwin ; then
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
if [ -n "$GRADLE_CYGPATTERN" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh