ci: migrate to GitHub Actions

* travis: disable build, disable deploy, add free aarch64/ppc64le/s390x builds

* scripts: cleanup of old CI scripts

* scripts: now port to GitHub Actions

* actions: fix extras checkout

* github: remove codeql action, turned out not to be very useful

* github: remove quiet flag on wget

* github: are we allowed to use envvars?

* github: add needed dependencies for linux

* github: install wget for windows

* scripts: convert our CPU architecture naming into what AppImage uses

* github: run scripts with bash explicitly

* github: first try to upload to GitHub Releases, enable amd64 win32 builds

* Use our uploadtool fork

* ci: include android, motomagx build for gha, refactor cirrus and travis ci scripts

* gha: try to fix build

* travis: try to fix build

* gha: try to fix upload, fix win32 build

* gha: use curl instead of wget, as it's preinstalled for windows. Fix Android build

* gha: add llvm repository, install clang-12 for android

* gha: motomagx: fail fast

* gha: android: explicitly set clang-12 as compiler and llvm-strip-12 as strip

* waifulib: xcompile: respect environment variables when using host compiler for Android

* waifulib: xcompile: use correct environ dict

* gha: try to fix -fuse-ld=lld with clang-12

* waifulib: xcompile: fix typo

* scripts: xcompile: fix motomagx build

* mainui: upgrade

* gha: fix android build, last time

* engine: wscript: disable crashhandler for magx
This commit is contained in:
Alibek Omarov #SupportRMS
2021-07-03 20:21:09 +03:00
committed by GitHub
parent 9287a0f5c5
commit 21a31ec81d
29 changed files with 417 additions and 537 deletions

26
scripts/gha/build_android.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
export ANDROID_SDK_HOME=$GITHUB_WORKSPACE/sdk
export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
pushd android
if [[ "$GH_CPU_ARCH" == "32" ]]; then
export ARCHS="armeabi armeabi-v7a x86"
elif [[ "$GH_CPU_ARCH" == "64" ]]; then
export ARCHS="aarch64 x86_64"
elif [[ "$GH_CPU_ARCH" == "32&64" ]]; then
export ARCHS="armeabi armeabi-v7a x86 aarch64 x86_64"
fi
export API=21
export TOOLCHAIN=host
export CC=clang-12
export CXX=clang++-12
export STRIP=llvm-strip-12
sh compile.sh release
if [[ "$GH_CPU_ARCH" == "64" ]]; then
mv xashdroid.apk ../xashdroid-64.apk
else
mv xashdroid.apk ../xashdroid-32.apk
fi

114
scripts/gha/build_linux.sh Executable file
View File

@@ -0,0 +1,114 @@
#!/bin/bash
. scripts/lib.sh
APP=xash3d-fwgs
APPDIR=$APP.AppDir
APPIMAGE=$APP-$ARCH.AppImage
build_sdl2()
{
cd "$BUILDDIR"/SDL2_src || die
if [ "$ARCH" = "i386" ]; then
export CFLAGS="-msse2 -march=i686 -m32 -ggdb -O2"
export LDFLAGS="-m32"
fi
./configure \
--disable-render \
--disable-haptic \
--disable-power \
--disable-filesystem \
--disable-file \
--disable-libudev \
--disable-dbus \
--disable-ibus \
--disable-ime \
--disable-fcitx \
--enable-alsa-shared \
--enable-pulseaudio-shared \
--enable-wayland-shared \
--enable-x11-shared \
--prefix / || die # get rid of /usr/local stuff
make -j2 || die
mkdir -p "$BUILDDIR"/SDL2_linux
make install DESTDIR="$BUILDDIR"/SDL2_linux || die
export CFLAGS=""
export LDFLAGS=""
}
build_engine()
{
# Build engine
cd "$BUILDDIR" || die
if [ "$ARCH" = "amd64" ]; then # we need enabling 64-bit target only on Intel-compatible CPUs
AMD64="-8"
fi
if [ "$1" = "dedicated" ]; then
./waf configure -T release -d -W $AMD64 || die
elif [ "$1" = "full" ]; then
./waf configure --sdl2=SDL2_linux -T release --enable-stb --prefix="$APPDIR" -W $AMD64 --enable-utils || die
else
die
fi
./waf build || die
}
build_appimage()
{
cd "$BUILDDIR" || die
./waf install || die
# Generate extras.pak
python3 scripts/makepak.py xash-extras/ "$APPDIR/extras.pak"
cp SDL2_linux/lib/libSDL2-2.0.so.0 "$APPDIR/"
if [ "$ARCH" = "i386" ]; then
cp vgui-dev/lib/vgui.so "$APPDIR/"
fi
cat > "$APPDIR"/AppRun << 'EOF'
#!/bin/sh
if [ "$XASH3D_BASEDIR" = "" ]; then
export XASH3D_BASEDIR=$PWD
fi
echo "Xash3D FWGS installed as AppImage."
echo "Base directory is $XASH3D_BASEDIR. Set XASH3D_BASEDIR environment variable to override this"
export XASH3D_EXTRAS_PAK1="${APPDIR}"/extras.pak
export LD_LIBRARY_PATH="${APPDIR}":$LD_LIBRARY_PATH
${DEBUGGER} "${APPDIR}"/xash3d "$@"
exit $?
EOF
chmod +x "$APPDIR"/xash3d "$APPDIR"/AppRun # Engine launcher & engine launcher script
echo "Contents of AppImage: "
ls -R "$APPDIR"
wget "https://raw.githubusercontent.com/FWGS/fwgs-artwork/master/xash3d/icon_512.png" -O "$APPDIR/$APP.png"
cat > "$APPDIR/$APP.desktop" <<EOF
[Desktop Entry]
Name=xash3d-fwgs
Icon=xash3d-fwgs
Type=Application
Exec=AppRun
Categories=Game;
EOF
./appimagetool.AppImage "$APPDIR" "$APPIMAGE"
}
rm -rf build # clean-up build directory
build_engine dedicated
mv build/engine/xash xashds-linux-$ARCH
rm -rf build
build_sdl2
build_engine full
build_appimage

33
scripts/gha/build_motomagx.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
. scripts/lib.sh
. /opt/toolchains/motomagx/setenv-z6.sh
cd $GITHUB_WORKSPACE
mkdir -p Xash/valve/cl_dlls
mkdir -p Xash/valve/dlls
cd hlsdk
./waf configure -T fast --enable-magx --enable-simple-mod-hacks build install --destdir=../Xash || die
cd ../
./waf configure -T fast --enable-magx --win-style-install --prefix='' build install --destdir=Xash/ || die
cat > Xash/run.sh << 'EOF'
mypath=${0%/*}
LIBDIR1=/ezxlocal/download/mystuff/games/lib
LIBDIR2=/mmc/mmca1/games/lib
LIBDIR3=$mypath
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBDIR1:$LIBDIR2:$LIBDIR3
export HOME=$mypath
export SDL_QT_INVERT_ROTATION=1
export SWAP_PATH=$HOME/xash.swap
cd $mypath
sleep 1
exec $mypath/xash -dev $@
EOF
7z a -t7z $GITHUB_WORKSPACE/xash3d-fwgs-magx.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r Xash/

37
scripts/gha/build_win32.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
. scripts/lib.sh
# Build engine
cd $BUILDDIR
if [ "$ARCH" = "amd64" ]; then # we need enabling 64-bit target only on Intel-compatible CPUs
AMD64="-8"
fi
# NOTE: to build with other version use --msvc_version during configuration
# NOTE: sometimes you may need to add WinSDK to %PATH%
./waf.bat configure -s "SDL2_VC" -T "debug" --prefix=`pwd` --enable-utils $AMD64 || die
./waf.bat build -v || die
./waf.bat install || die
if [ "$ARCH" = "i386" ]; then
cp SDL2_VC/lib/x86/SDL2.dll . # Install SDL2
cp vgui-dev/lib/win32_vc6/vgui.dll .
elif [ "$ARCH" = "amd64" ]; then
cp SDL2_VC/lib/x64/SDL2.dll .
else
die
fi
7z a -t7z $BUILDDIR/xash3d-fwgs-win32-$ARCH.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on *.dll *.exe *.pdb
echo "Generating VC2008 project"
rm -rf vc2008/
mkdir vc2008/
./waf.bat msdev
cp *.sln vc2008/
find . -name "*.vcproj" -exec cp --parents \{\} vc2008/ \;
rm -rf vc2008/vc2008 # HACKHACK
7z a -t7z $BUILDDIR/xash3d-fwgs-vc2008-sln-$ARCH.7z -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on -r vc2008

53
scripts/gha/deps_android.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
echo "Install packages"
echo "deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-12 main" | sudo tee -a /etc/apt/sources.list
wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install clang-12 lld-12 llvm-12 llvm-12-tools p7zip-full
sudo rm /usr/bin/lld /usr/bin/ld.lld
sudo ln -s /usr/bin/lld-12 /usr/bin/lld
sudo ln -s /usr/bin/ld.lld-12 /usr/bin/ld.lld
echo "Download HLSDK"
cd $GITHUB_WORKSPACE
git clone --depth 1 --recursive https://github.com/FWGS/hlsdk-xash3d -b mobile_hacks hlsdk || exit 1
echo "Download and unpack Android SDK"
mkdir -p sdk || exit 1
pushd sdk
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -qO sdk.zip > /dev/null || exit 1
unzip -q sdk.zip || exit 1
popd
echo "Download all needed tools and NDK"
yes | sdk/tools/bin/sdkmanager --licenses > /dev/null 2>/dev/null # who even reads licenses? :)
NDK_BUNDLE="ndk-bundle"
if [ "$ANDROID_NDK_VER" = "r10e" ]; then
NDK_BUNDLE=""
fi
sdk/tools/bin/sdkmanager --install build-tools\;29.0.1 platform-tools platforms\;android-29 $NDK_BUNDLE > /dev/null 2>/dev/null
if [ "$ANDROID_NDK_VER" = "r10e" ]; then
wget https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip -qO ndk.zip > /dev/null || exit 1
unzip -q ndk.zip || exit 1
mv android-ndk-r10e sdk/ndk-bundle
fi
echo "Download Xash3D FWGS Android source"
git clone --depth 1 https://github.com/FWGS/xash3d-android-project -b waf android || exit 1
pushd android
mv xash3d-fwgs xash3d-fwgs-sub
ln -s $GITHUB_WORKSPACE xash3d-fwgs
echo "Installed Xash3D FWGS source symlink"
mv hlsdk-xash3d hlsdk-xash3d-sub
ln -s $GITHUB_WORKSPACE/hlsdk hlsdk-xash3d
echo "Installed HLSDK source symlink"
mv xash-extras xash-extras-sub
ln -s $GITHUB_WORKSPACE/xash-extras xash-extras
echo "Installed xash-extras symlink"
popd

24
scripts/gha/deps_linux.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
cd $GITHUB_WORKSPACE
if [ "$GH_CPU_ARCH" == "i386" ]; then
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install gcc-multilib g++-multilib libx11-dev:i386 libxext-dev:i386 x11-utils libgl1-mesa-dev libasound-dev libstdc++6:i386 libfuse2:i386 zlib1g:i386
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-i686.AppImage" -O appimagetool.AppImage
elif [ "$GH_CPU_ARCH" == "amd64" ]; then
sudo apt update
sudo apt install gcc-multilib g++-multilib libx11-dev libxext-dev x11-utils libgl1-mesa-dev libasound-dev libstdc++6 libfuse2 zlib1g
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O appimagetool.AppImage
else
exit 1
fi
chmod +x appimagetool.AppImage
wget http://libsdl.org/release/SDL2-$SDL_VERSION.zip -O SDL2.zip
unzip -q SDL2.zip
mv SDL2-$SDL_VERSION SDL2_src

15
scripts/gha/deps_motomagx.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
cd $GITHUB_WORKSPACE
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 libstdc++6:i386 gcc-multilib g++-multilib p7zip-full
sudo mkdir -p /opt/toolchains
pushd /opt/toolchains/
sudo git clone https://github.com/a1batross/motomagx_toolchain motomagx --depth=1
popd
git clone https://github.com/FWGS/hlsdk-xash3d hlsdk -b mobile_hacks --depth=1

5
scripts/gha/deps_win32.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
curl http://libsdl.org/release/SDL2-devel-$SDL_VERSION-VC.zip -o SDL2.zip
unzip -q SDL2.zip
mv SDL2-$SDL_VERSION SDL2_VC