scripts: gha: fix shellcheck warnings in build_* scripts

This commit is contained in:
Alibek Omarov
2026-03-24 04:07:21 +05:00
parent cf8046ecd9
commit 9a050cb67f
12 changed files with 67 additions and 60 deletions

View File

@@ -5,21 +5,21 @@ export JAVA_HOME=$GITHUB_WORKSPACE/java
export ANDROID_HOME=$GITHUB_WORKSPACE/sdk export ANDROID_HOME=$GITHUB_WORKSPACE/sdk
export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/tools/bin export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/tools/bin
pushd android pushd android || exit 1
./gradlew assembleContinuous --no-daemon || exit 1 ./gradlew assembleContinuous --no-daemon || exit 1
pushd app/build/outputs/apk/continuous pushd app/build/outputs/apk/continuous || exit 1
$ANDROID_HOME/build-tools/36.0.0/apksigner sign \ "$ANDROID_HOME/build-tools/36.0.0/apksigner" sign \
--ks $GITHUB_WORKSPACE/android/debug.keystore \ --ks "$GITHUB_WORKSPACE/android/debug.keystore" \
--ks-key-alias androiddebugkey \ --ks-key-alias androiddebugkey \
--ks-pass pass:android \ --ks-pass pass:android \
--key-pass pass:android \ --key-pass pass:android \
--out app-continuous-signed.apk app-continuous-unsigned.apk || exit 1 --out app-continuous-signed.apk app-continuous-unsigned.apk || exit 1
popd popd || exit 1
popd popd || exit 1
mkdir -p artifacts/ mkdir -p artifacts/

View File

@@ -2,15 +2,15 @@
. scripts/lib.sh . scripts/lib.sh
cd $GITHUB_WORKSPACE || die cd "$GITHUB_WORKSPACE" || die
pushd hlsdk || die pushd hlsdk || die
./waf configure build install --destdir=../bin || die ./waf configure build install --destdir=../bin || die
popd popd || die
./waf configure --enable-utils --enable-tests --enable-lto --enable-tui build install --destdir=bin || die_configure ./waf configure --enable-utils --enable-tests --enable-lto --enable-tui build install --destdir=bin || die_configure
cp -vr /Library/Frameworks/SDL2.framework bin cp -vr /Library/Frameworks/SDL2.framework bin
mkdir -p artifacts/ mkdir -p artifacts/
tar -cJvf artifacts/xash3d-fwgs-apple-$ARCH.tar.xz -C bin . # skip the bin directory from resulting tar archive tar -cJvf "artifacts/xash3d-fwgs-apple-$ARCH.tar.xz" -C bin . # skip the bin directory from resulting tar archive

View File

@@ -2,7 +2,7 @@
. scripts/lib.sh . scripts/lib.sh
cd $GITHUB_WORKSPACE || die cd "$GITHUB_WORKSPACE" || die
./waf configure --enable-lto --ios build install --destdir=build/ios || die_configure ./waf configure --enable-lto --ios build install --destdir=build/ios || die_configure
@@ -11,7 +11,7 @@ cp -vr /Library/Frameworks/SDL2.framework ./build
pushd hlsdk || die pushd hlsdk || die
cmake -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DGAMEDIR=$(realpath ../build/ios) -DCMAKE_BUILD_TYPE=Debug -B build -S . cmake -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DGAMEDIR=$(realpath ../build/ios) -DCMAKE_BUILD_TYPE=Debug -B build -S .
cmake --build build --target install || die cmake --build build --target install || die
popd popd || die
./scripts/ios/createipa.sh ./scripts/ios/createipa.sh

View File

@@ -70,6 +70,7 @@ build_engine()
WAF_EXTRA_ARGS+=" --enable-tests" WAF_EXTRA_ARGS+=" --enable-tests"
fi fi
# shellcheck disable=SC2086
./waf configure $WAF_EXTRA_ARGS --enable-lto --enable-bundled-deps -s SDL2_linux --enable-stbtt --enable-utils --enable-tui --enable-dedicated || die_configure ./waf configure $WAF_EXTRA_ARGS --enable-lto --enable-bundled-deps -s SDL2_linux --enable-stbtt --enable-utils --enable-tui --enable-dedicated || die_configure
./waf build || die_configure ./waf build || die_configure

View File

@@ -3,14 +3,14 @@
. scripts/lib.sh . scripts/lib.sh
. /opt/toolchains/motomagx/setenv-z6.sh . /opt/toolchains/motomagx/setenv-z6.sh
cd $GITHUB_WORKSPACE || die cd "$GITHUB_WORKSPACE" || die
mkdir -p Xash/valve/cl_dlls mkdir -p Xash/valve/cl_dlls
mkdir -p Xash/valve/dlls mkdir -p Xash/valve/dlls
pushd hlsdk || die pushd hlsdk || die
./waf configure -T fast --enable-magx --enable-simple-mod-hacks build install --destdir=../Xash || die ./waf configure -T fast --enable-magx --enable-simple-mod-hacks build install --destdir=../Xash || die
popd popd || die
./waf configure -T fast --enable-magx build install --destdir=Xash/ || die ./waf configure -T fast --enable-magx build install --destdir=Xash/ || die

View File

@@ -11,10 +11,10 @@ mkdir -p artifacts/ || die
echo "Running build script in Docker container..." echo "Running build script in Docker container..."
docker run --name xash-build --rm -v `pwd`:`pwd` -w `pwd` devkitpro/devkita64:latest bash ./scripts/gha/build_nswitch_docker.sh || die docker run --name xash-build --rm -v "$(pwd):$(pwd)" -w "$(pwd)" devkitpro/devkita64:latest bash ./scripts/gha/build_nswitch_docker.sh || die
echo "Packaging artifacts..." echo "Packaging artifacts..."
pushd pkgtemp || die pushd pkgtemp || die
7z a -t7z ../artifacts/xash3d-fwgs-nswitch.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r xash3d/ 7z a -t7z ../artifacts/xash3d-fwgs-nswitch.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r xash3d/
popd popd || die

View File

@@ -5,7 +5,7 @@
build_hlsdk() build_hlsdk()
{ {
echo "Building HLSDK: $1 branch..." echo "Building HLSDK: $1 branch..."
git checkout $1 git checkout "$1" || die
# This is not our bug if HLSDK doesn't build with -Werrors enabled # This is not our bug if HLSDK doesn't build with -Werrors enabled
./waf configure -T release --nswitch --disable-werror || die_configure ./waf configure -T release --nswitch --disable-werror || die_configure
@@ -50,9 +50,9 @@ echo "Building HLSDK..."
pushd hlsdk-portable || die pushd hlsdk-portable || die
build_hlsdk mobile_hacks valve build_hlsdk mobile_hacks valve
build_hlsdk opfor gearbox build_hlsdk opfor gearbox
popd popd || die
# bshift can be used from mobile_hacks branch # bshift can be used from mobile_hacks branch
pushd pkgtemp/xash3d pushd pkgtemp/xash3d || die
cp -v valve/dlls/hl_nswitch_arm64.so bshift/dlls/bshift_nswitch_arm64.so cp -v valve/dlls/hl_nswitch_arm64.so bshift/dlls/bshift_nswitch_arm64.so
popd popd || die

View File

@@ -5,7 +5,7 @@
build_hlsdk() build_hlsdk()
{ {
echo "Building HLSDK: $1 branch..." echo "Building HLSDK: $1 branch..."
git checkout $1 git checkout "$1" || die
# This is not our bug if HLSDK doesn't build with -Werrors enabled # This is not our bug if HLSDK doesn't build with -Werrors enabled
./waf configure -T release --psvita --disable-werror || die_configure ./waf configure -T release --psvita --disable-werror || die_configure
@@ -34,7 +34,7 @@ pushd vita-rtld || die
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release || die_configure cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release || die_configure
cmake --build build -- -j$JOBS || die cmake --build build -- -j$JOBS || die
cmake --install build || die cmake --install build || die
popd popd || die
echo "Building SDL..." echo "Building SDL..."
@@ -42,7 +42,7 @@ pushd SDL || die
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DVIDEO_VITA_VGL=ON -DSDL_RENDER=OFF || die_configure cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DVIDEO_VITA_VGL=ON -DSDL_RENDER=OFF || die_configure
cmake --build build -- -j$JOBS || die cmake --build build -- -j$JOBS || die
cmake --install build || die cmake --install build || die
popd popd || die
echo "Building engine..." echo "Building engine..."
@@ -55,16 +55,16 @@ echo "Building HLSDK..."
pushd hlsdk-portable || die pushd hlsdk-portable || die
build_hlsdk mobile_hacks valve build_hlsdk mobile_hacks valve
build_hlsdk opfor gearbox build_hlsdk opfor gearbox
popd popd || die
# bshift can be used from mobile_hacks branch # bshift can be used from mobile_hacks branch
pushd pkgtemp/data/xash3d pushd pkgtemp/data/xash3d || die
cp -v valve/dlls/hl_psvita_armv7hf.so bshift/dlls/bshift_psvita_armv7hf.so cp -v valve/dlls/hl_psvita_armv7hf.so bshift/dlls/bshift_psvita_armv7hf.so
popd popd || die
echo "Generating default config files..." echo "Generating default config files..."
pushd pkgtemp/data/xash3d/valve pushd pkgtemp/data/xash3d/valve || die
touch config.cfg touch config.cfg
echo 'unbindall' >> config.cfg echo 'unbindall' >> config.cfg
@@ -91,13 +91,13 @@ echo 'r_refdll "gl"' >> video.cfg
touch opengl.cfg touch opengl.cfg
echo 'gl_nosort "1"' >> opengl.cfg echo 'gl_nosort "1"' >> opengl.cfg
cp *.cfg ../gearbox/ cp ./*.cfg ../gearbox/
cp *.cfg ../bshift/ cp ./*.cfg ../bshift/
popd popd || die
echo "Packaging artifacts..." echo "Packaging artifacts..."
pushd pkgtemp || die pushd pkgtemp || die
7z a -t7z ../artifacts/xash3d-fwgs-psvita.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r xash.vpk data/ 7z a -t7z ../artifacts/xash3d-fwgs-psvita.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r xash.vpk data/
popd popd || die

View File

@@ -3,7 +3,7 @@
. scripts/lib.sh . scripts/lib.sh
# Build engine # Build engine
cd $BUILDDIR cd "$BUILDDIR" || die
WAF_EXTRA_ARGS="" WAF_EXTRA_ARGS=""
@@ -20,6 +20,7 @@ fi
# NOTE: to build with other version use --msvc_version during configuration # NOTE: to build with other version use --msvc_version during configuration
# NOTE: sometimes you may need to add WinSDK to %PATH% # NOTE: sometimes you may need to add WinSDK to %PATH%
# NOTE: --enable-msvcdeps only used for CI builds, enabling it non-English versions of MSVC causes useless console spam # NOTE: --enable-msvcdeps only used for CI builds, enabling it non-English versions of MSVC causes useless console spam
# shellcheck disable=SC2086
./waf.bat configure -s "SDL2_VC" -T release --enable-utils --enable-tests --enable-lto --enable-msvcdeps --enable-tui $WAF_EXTRA_ARGS || die_configure ./waf.bat configure -s "SDL2_VC" -T release --enable-utils --enable-tests --enable-lto --enable-msvcdeps --enable-tui $WAF_EXTRA_ARGS || die_configure
./waf.bat build || die ./waf.bat build || die
./waf.bat install --destdir=. || die ./waf.bat install --destdir=. || die
@@ -42,13 +43,13 @@ WINSDK_LATEST=$(ls -1 "C:/Program Files (x86)/Windows Kits/10/bin" | grep -E '^1
echo "Latest installed Windows SDK is $WINSDK_LATEST" echo "Latest installed Windows SDK is $WINSDK_LATEST"
"C:/Program Files (x86)/Windows Kits/10/bin/$WINSDK_LATEST/x64/signtool.exe" \ "C:/Program Files (x86)/Windows Kits/10/bin/$WINSDK_LATEST/x64/signtool.exe" \
sign //f scripts/fwgs.pfx //fd SHA256 //p "$FWGS_PFX_PASSWORD" *.dll *.exe sign //f scripts/fwgs.pfx //fd SHA256 //p "$FWGS_PFX_PASSWORD" ./*.dll ./*.exe
if [ "$ARCH" = "i386" ]; then # VGUI is already signed if [ "$ARCH" = "i386" ]; then # VGUI is already signed
cp 3rdparty/vgui_support/vgui-dev/lib/win32_vc6/vgui.dll . cp 3rdparty/vgui_support/vgui-dev/lib/win32_vc6/vgui.dll .
fi fi
mkdir -p artifacts/ mkdir -p artifacts/
7z a -t7z artifacts/xash3d-fwgs-win32-$ARCH.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on \ 7z a -t7z "artifacts/xash3d-fwgs-win32-$ARCH.7z" -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on \
*.dll *.exe *.pdb activities.txt \ ./*.dll ./*.exe ./*.pdb activities.txt \
valve/ valve/

View File

@@ -1,6 +1,8 @@
#!/bin/bash
#cd into script directory #cd into script directory
SCRIPTDIR=${0%/*} SCRIPTDIR=${0%/*}
cd $SCRIPTDIR cd "$SCRIPTDIR" || exit 1
#shouldn't build any mods that are supported by mobile_hacks #shouldn't build any mods that are supported by mobile_hacks
./buildhlsdk.sh aghl _ag ./buildhlsdk.sh aghl _ag
@@ -40,4 +42,4 @@ export XENWARRIOR=ON
cd ../../ cd ../../
./createipa.sh ./createipa.sh

View File

@@ -2,33 +2,33 @@
#cd into script directory #cd into script directory
SCRIPTDIR=${0%/*} SCRIPTDIR=${0%/*}
cd $SCRIPTDIR cd "$SCRIPTDIR" || exit 1
MODPATH=mod-build/$1 MODPATH=mod-build/$1
if [ -z $1 ]; then if [ -z "$1" ]; then
MODPATH=mod-build/hlsdk MODPATH=mod-build/hlsdk
git clone --recursive https://github.com/FWGS/hlsdk-portable -b mobile_hacks $MODPATH git clone --recursive https://github.com/FWGS/hlsdk-portable -b mobile_hacks "$MODPATH"
else else
git clone --recursive https://github.com/FWGS/hlsdk-portable -b $1 $MODPATH git clone --recursive https://github.com/FWGS/hlsdk-portable -b "$1" "$MODPATH"
fi fi
mkdir ../../build/ios mkdir ../../build/ios || exit 1
IOSDIR=$(realpath ../../build/ios) IOSDIR=$(realpath ../../build/ios)
cd $MODPATH cd "$MODPATH" || exit 1
#compiling hlsdk for ios release is broken, so just build for debug #compiling hlsdk for ios release is broken, so just build for debug
cmake -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DGAMEDIR=$IOSDIR -DCMAKE_BUILD_TYPE=Debug -B build -S . cmake -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DGAMEDIR="$IOSDIR" -DCMAKE_BUILD_TYPE=Debug -B build -S .
cmake --build build --target install cmake --build build --target install
if [ ! -z $2 ]; then if [ ! -z "$2" ]; then
mv $IOSDIR/cl_dlls/client_arm64.dylib $IOSDIR/cl_dlls/client_arm64$2.dylib mv "$IOSDIR/cl_dlls/client_arm64.dylib" "$IOSDIR/cl_dlls/client_arm64$2.dylib"
else else
cd ../../ cd ../../
./createipa.sh ./createipa.sh
fi fi
if [ -d mod-build ]; then if [ -d mod-build ]; then
rm -rf mod-build/ rm -rf mod-build/
fi fi
exit 0 exit 0

View File

@@ -1,45 +1,48 @@
#!/bin/bash #!/bin/bash
#cd into script directory #cd into script directory
cd "${0%/*}" cd "${0%/*}" || exit 1
BUILDDIR=$(realpath ../../build)
cd "../../engine/platform/ios/bundle"
if [ -d $BUILDDIR ]; then BUILDDIR=$(realpath ../../build)
cd "../../engine/platform/ios/bundle" || exit 1
if [ -d "$BUILDDIR" ]; then
mkdir -p "$BUILDDIR/ios/xash3d.app" mkdir -p "$BUILDDIR/ios/xash3d.app"
cp -r "$BUILDDIR/ios/dlls" "$BUILDDIR/ios/xash3d.app" cp -r "$BUILDDIR/ios/dlls" "$BUILDDIR/ios/xash3d.app"
cp -r "$BUILDDIR/ios/cl_dlls" "$BUILDDIR/ios/xash3d.app" cp -r "$BUILDDIR/ios/cl_dlls" "$BUILDDIR/ios/xash3d.app"
cp Info.plist "$BUILDDIR/ios/xash3d.app" cp Info.plist "$BUILDDIR/ios/xash3d.app"
cp ftp_commands.plist "$BUILDDIR/ios/xash3d.app" cp ftp_commands.plist "$BUILDDIR/ios/xash3d.app"
if [ ! -d $BUILDDIR/SDL2.framework ]; then if [ ! -d "$BUILDDIR/SDL2.framework" ]; then
echo "Couldn't find SDL2.framework, place it in the build directory" echo "Couldn't find SDL2.framework, place it in the build directory"
exit 1 exit 1
fi fi
cp -r $BUILDDIR/SDL2.framework "$BUILDDIR/ios/xash3d.app" cp -r "$BUILDDIR/SDL2.framework" "$BUILDDIR/ios/xash3d.app"
cd ../../../../ cd ../../../../ || exit 1
./waf build install --destdir="$BUILDDIR/ios/xash3d.app" ./waf build install --destdir="$BUILDDIR/ios/xash3d.app"
#echo "Generating dSYMs" #echo "Generating dSYMs"
#find "$BUILDDIR/ios/xash3d.app" -name "*.dylib" -type f -exec dsymutil {} \; #find "$BUILDDIR/ios/xash3d.app" -name "*.dylib" -type f -exec dsymutil {} \;
#dsymutil "$BUILDDIR/ios/xash3d.app/xash" #dsymutil "$BUILDDIR/ios/xash3d.app/xash"
cd $BUILDDIR cd "$BUILDDIR" || exit 1
rm -r "$BUILDDIR/ios/Payload/" rm -r "$BUILDDIR/ios/Payload/"
mkdir "$BUILDDIR/ios/Payload" mkdir "$BUILDDIR/ios/Payload"
cp -r "$BUILDDIR/ios/xash3d.app" ios/Payload/ cp -r "$BUILDDIR/ios/xash3d.app" ios/Payload/
rm -r "$BUILDDIR/ios/xash3d.app" rm -r "$BUILDDIR/ios/xash3d.app"
cd ios cd ios || exit 1
codesign --entitlements $(realpath ../../engine/platform/ios/bundle/entitlements.plist) --sign "-" --force Payload/xash3d.app codesign --entitlements "$(realpath ../../engine/platform/ios/bundle/entitlements.plist)" --sign "-" --force Payload/xash3d.app
if [ -e ../xash3d.ipa ]; then if [ -e ../xash3d.ipa ]; then
rm ../xash3d.ipa rm ../xash3d.ipa
fi fi
zip -q -r ../xash3d.ipa Payload zip -q -r ../xash3d.ipa Payload
else else
echo "Couldn't find the build directory, compile the engine before running this script!" echo "Couldn't find the build directory, compile the engine before running this script!"
exit 1 exit 1
fi fi
exit 0 exit 0