readability

This commit is contained in:
tooomm 2026-07-24 22:56:29 +02:00
parent a253d0344a
commit 3d2dedd007

View file

@ -127,6 +127,7 @@ set -e
if [[ ! $BUILDTYPE ]]; then if [[ ! $BUILDTYPE ]]; then
BUILDTYPE=Release BUILDTYPE=Release
fi fi
if [[ ! $BUILD_DIR ]]; then if [[ ! $BUILD_DIR ]]; then
BUILD_DIR="build" BUILD_DIR="build"
fi fi
@ -137,12 +138,15 @@ flags=("-DCMAKE_BUILD_TYPE=$BUILDTYPE")
if [[ $MAKE_SERVER ]]; then if [[ $MAKE_SERVER ]]; then
flags+=("-DWITH_SERVER=1") flags+=("-DWITH_SERVER=1")
fi fi
if [[ $MAKE_NO_CLIENT ]]; then if [[ $MAKE_NO_CLIENT ]]; then
flags+=("-DWITH_CLIENT=0" "-DWITH_ORACLE=0") flags+=("-DWITH_CLIENT=0" "-DWITH_ORACLE=0")
fi fi
if [[ $MAKE_TEST ]]; then if [[ $MAKE_TEST ]]; then
flags+=("-DTEST=1") flags+=("-DTEST=1")
fi fi
if [[ $USE_CCACHE ]]; then if [[ $USE_CCACHE ]]; then
flags+=("-DUSE_CCACHE=1") flags+=("-DUSE_CCACHE=1")
if [[ $CCACHE_SIZE ]]; then if [[ $CCACHE_SIZE ]]; then
@ -150,9 +154,11 @@ if [[ $USE_CCACHE ]]; then
ccache --max-size "$CCACHE_SIZE" ccache --max-size "$CCACHE_SIZE"
fi fi
fi fi
if [[ $PACKAGE_TYPE ]]; then if [[ $PACKAGE_TYPE ]]; then
flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE") flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE")
fi fi
if [[ $USE_VCPKG ]]; then if [[ $USE_VCPKG ]]; then
flags+=("-DUSE_VCPKG=1") flags+=("-DUSE_VCPKG=1")
fi fi
@ -163,6 +169,7 @@ buildflags=(--config "$BUILDTYPE")
# Prepare compilation # Prepare compilation
if [[ $RUNNER_OS == macOS ]]; then if [[ $RUNNER_OS == macOS ]]; then
# TODO qtdir # TODO qtdir
# QTDIR is needed for macOS since we actually only use the cached thin Qt binaries instead of the install-qt-action, # QTDIR is needed for macOS since we actually only use the cached thin Qt binaries instead of the install-qt-action,
# which sets a few environment variables # which sets a few environment variables
if QTDIR=$(find "$GITHUB_WORKSPACE/Qt" -depth -maxdepth 2 -name macos -type d -print -quit); then if QTDIR=$(find "$GITHUB_WORKSPACE/Qt" -depth -maxdepth 2 -name macos -type d -print -quit); then
@ -171,6 +178,7 @@ if [[ $RUNNER_OS == macOS ]]; then
echo "could not find QTDIR!" echo "could not find QTDIR!"
exit 2 exit 2
fi fi
# The qtdir is located at Qt/<qtversion>/macos # The qtdir is located at Qt/<qtversion>/macos
# We use "find" to get the first subfolder with the name "macos" # We use "find" to get the first subfolder with the name "macos"
# This works independent of the Qt version as there should be only one version installed on the runner at a time # This works independent of the Qt version as there should be only one version installed on the runner at a time
@ -186,14 +194,18 @@ if [[ $RUNNER_OS == macOS ]]; then
triplet_version="custom-triplet" triplet_version="custom-triplet"
triplet_file="$triplets_dir/$triplet_version.cmake" triplet_file="$triplets_dir/$triplet_version.cmake"
arch=$(uname -m) arch=$(uname -m)
if [[ $arch == x86_64 ]]; then if [[ $arch == x86_64 ]]; then
arch="x64" arch="x64"
fi fi
mkdir -p "$triplets_dir" mkdir -p "$triplets_dir"
triplet_source="../vcpkg/triplets/$arch-osx.cmake" triplet_source="../vcpkg/triplets/$arch-osx.cmake"
if [[ ! -f "$triplet_source" ]]; then if [[ ! -f "$triplet_source" ]]; then
triplet_source="../vcpkg/triplets/community/$arch-osx.cmake" triplet_source="../vcpkg/triplets/community/$arch-osx.cmake"
fi fi
cp "$triplet_source" "$triplet_file" cp "$triplet_source" "$triplet_file"
echo "set(VCPKG_CMAKE_SYSTEM_VERSION $TARGET_MACOS_VERSION)" >>"$triplet_file" echo "set(VCPKG_CMAKE_SYSTEM_VERSION $TARGET_MACOS_VERSION)" >>"$triplet_file"
echo "set(VCPKG_OSX_DEPLOYMENT_TARGET $TARGET_MACOS_VERSION)" >>"$triplet_file" echo "set(VCPKG_OSX_DEPLOYMENT_TARGET $TARGET_MACOS_VERSION)" >>"$triplet_file"
@ -206,6 +218,7 @@ if [[ $RUNNER_OS == macOS ]]; then
fi fi
echo "::group::Signing Certificate" echo "::group::Signing Certificate"
if [[ -n "$MACOS_CERTIFICATE_NAME" ]]; then if [[ -n "$MACOS_CERTIFICATE_NAME" ]]; then
echo "$MACOS_CERTIFICATE" | base64 --decode >"certificate.p12" echo "$MACOS_CERTIFICATE" | base64 --decode >"certificate.p12"
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
@ -218,6 +231,7 @@ if [[ $RUNNER_OS == macOS ]]; then
else else
echo "No signing certificate configured. Skipping set up of keychain in macOS environment." echo "No signing certificate configured. Skipping set up of keychain in macOS environment."
fi fi
echo "::endgroup::" echo "::endgroup::"
if [[ $MAKE_PACKAGE ]]; then if [[ $MAKE_PACKAGE ]]; then
@ -273,23 +287,28 @@ echo "::endgroup::"
# Post-build ccache # Post-build ccache
if [[ $USE_CCACHE ]]; then if [[ $USE_CCACHE ]]; then
if [[ $CCACHE_EVICTION_AGE ]]; then if [[ $CCACHE_EVICTION_AGE ]]; then
echo "::group::evict ccache files older than $CCACHE_EVICTION_AGE" echo "::group::evict ccache files older than $CCACHE_EVICTION_AGE"
ccache --evict-older-than "$CCACHE_EVICTION_AGE" ccache --evict-older-than "$CCACHE_EVICTION_AGE"
echo "::endgroup::" echo "::endgroup::"
fi fi
echo "::group::Show ccache stats" echo "::group::Show ccache stats"
ccache --verify # remove again ccache --verify # remove again
ccache --show-stats --verbose # too verbose? ccache --show-stats --verbose # too verbose?
ccache --show-compression # helpful? ccache --show-compression # helpful?
echo "::endgroup::" echo "::endgroup::"
elif [[ $CCACHE_EVICTION_AGE ]]; then elif [[ $CCACHE_EVICTION_AGE ]]; then
echo "::error file=$0::ccache eviction is enabled while ccache is disabled!" echo "::error file=$0::ccache eviction is enabled while ccache is disabled!"
fi fi
# [macOS] Inspect binaries # [macOS] Inspect binaries
if [[ $RUNNER_OS == macOS ]]; then if [[ $RUNNER_OS == macOS ]]; then
echo "::group::Inspect Mach-O binaries" echo "::group::Inspect Mach-O binaries"
for app in cockatrice oracle servatrice; do for app in cockatrice oracle servatrice; do
binary="$GITHUB_WORKSPACE/build/$app/$app.app/Contents/MacOS/$app" binary="$GITHUB_WORKSPACE/build/$app/$app.app/Contents/MacOS/$app"
echo "Inspecting $app..." echo "Inspecting $app..."
@ -297,6 +316,7 @@ if [[ $RUNNER_OS == macOS ]]; then
file "$binary" file "$binary"
lipo -info "$binary" lipo -info "$binary"
echo "" echo ""
done done
echo "::endgroup::" echo "::endgroup::"
fi fi