Skip to content

Fix the mechanism divergence in VxMath instead of replacing a DLL #421

Fix the mechanism divergence in VxMath instead of replacing a DLL

Fix the mechanism divergence in VxMath instead of replacing a DLL #421

Workflow file for this run

name: Server
on:
push:
branches: [ main, collision-overhaul ]
paths-ignore:
- 'BallanceMMOClient/**'
- '.git*'
- 'README.md'
- 'docs/**'
- '.github/workflows/client.yml'
pull_request:
branches: [ main, collision-overhaul ]
paths-ignore:
- 'BallanceMMOClient/**'
- '.git*'
- 'README.md'
- 'docs/**'
- '.github/workflows/client.yml'
workflow_dispatch:
# The server now embeds the headless engine, so a build is expensive; drop
# superseded runs of the same ref.
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build-server-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Recursive: the server statically links the Ballanced engine
# (BMMO_BUILD_SIM) for its headless physics simulation.
- name: Fetch git submodules
run: git submodule update --init --recursive
- name: Install dependencies (OpenSSL, Protobuf)
run: sudo apt install libssl-dev libprotobuf-dev protobuf-compiler ninja-build
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
echo -e "\nfile(WRITE ${{github.workspace}}/version.txt \${BMMO_VER})" >> CMakeLists.txt
cmake -G Ninja -B ${{github.workspace}}/build -S ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SERVER=ON -DBUILD_CLIENT=OFF -DBUILD_SERVER_TESTS=ON -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SERVER_APPIMAGE=ON
echo "BMMO_VER=$(cat ${{github.workspace}}/version.txt)" >> "$GITHUB_ENV"
echo "SHA_SHORT=$(git rev-parse --short ${{github.sha}})" >> "$GITHUB_ENV"
- name: Build and install
# Build your program with the given configuration
working-directory: ${{github.workspace}}
run: DESTDIR=AppDir cmake --build ./build --config ${{env.BUILD_TYPE}} --target install
# enable_testing() is called in BallanceMMOServer/, so the tests live in
# that subdirectory of the build tree; ctest run anywhere above it reports
# "No tests were found" and still exits 0.
- name: Test
run: ctest --test-dir ${{github.workspace}}/build/BallanceMMOServer -C ${{env.BUILD_TYPE}} --output-on-failure --no-tests=error
- name: Build AppImage
working-directory: ${{github.workspace}}/build/BallanceMMOServer
run: |
curl -o linuxdeploy.AppImage -L https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20240109-1/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy.AppImage
appdeploy=$(./linuxdeploy.AppImage --appimage-extract | grep AppRun | head -n 1)
echo Got linuxdeploy exec entry at $appdeploy
$appdeploy --appdir ../AppDir --output appimage --desktop-file ../../BallanceMMOServer/appimage/BMMOLaunchSelector.desktop --icon-file ../../BallanceMMOServer/appimage/BallanceMMO.svg
- name: Prepare artifact directory and dry run
working-directory: ${{github.workspace}}/build/BallanceMMOServer
run: |
appfile=$(ls BallanceMMOLaunchSelector*.AppImage | awk '{print $1}')
chmod +x $appfile
mkdir artifacts
mv -t artifacts $appfile start_ballancemmo_loop.sh
server_binary=$(artifacts/$appfile --appimage-extract | grep "bin/BallanceMMOServer" | head -n 1)
chmod +x $server_binary && ./$server_binary --dry-run
- name: Release Artifact
uses: actions/upload-artifact@v4
with:
name: server-linux-${{env.BMMO_VER}}-${{env.SHA_SHORT}}
path: build/BallanceMMOServer/artifacts
build-server-windows:
runs-on: windows-latest
env:
VCPKG_ROOT: ${{github.workspace}}/submodule/vcpkg
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
- name: Fetch git submodules
run: git submodule update --init --recursive
# Setup MSVC command prompt environment vars
- uses: ilammy/msvc-dev-cmd@v1
- name: Restore artifacts, setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: 9e593bb18ea69cc5095e012465dcd675a822ed0d
vcpkgDirectory: '${{env.VCPKG_ROOT}}'
vcpkgJsonGlob: vcpkg.json
runVcpkgInstall: false
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# - name: vcpkg check / install dependencies
# working-directory: ${{env.VCPKG_ROOT}}
# run: vcpkg install --triplet x64-windows
- name: Configure CMake
run: |
echo "`nfile(WRITE version.txt `${BMMO_VER})" | Out-File CMakeLists.txt -Encoding "UTF8" -Append
cmake -G Ninja -B ${{github.workspace}}/build -S ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_MANIFEST_MODE=ON -DVCPKG_MANIFEST_DIR="${{github.workspace}}" -DYAML_BUILD_SHARED_LIBS=ON -DBUILD_SERVER=ON -DBUILD_CLIENT=OFF -DBUILD_SERVER_TESTS=ON
echo "BMMO_VER=$(cat version.txt)" >> $env:GITHUB_ENV
echo "SHA_SHORT=$(git rev-parse --short ${{github.sha}})" >> $env:GITHUB_ENV
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
# - name: List build dir
# working-directory: ${{github.workspace}}/build
# run: dir
# - name: Run post-build script
# working-directory: ${{github.workspace}}/build/BallanceMMOServer
# run: ${{github.workspace}}/build/BallanceMMOServer/postbuild.bat ${{env.BUILD_TYPE}}
# The tests are registered in the BallanceMMOServer subdirectory of the
# build tree (that is where enable_testing() is called); ctest run above
# it reports "No tests were found" and still exits 0.
- name: Test
run: ctest --test-dir ${{github.workspace}}/build/BallanceMMOServer -C ${{env.BUILD_TYPE}} --output-on-failure --no-tests=error
# by setting a different working directory we avoid releasing the config file
- name: Dry run and prepare for release
working-directory: ${{github.workspace}}/build/BallanceMMOServer
run: |
.\BallanceMMOServer.exe --dry-run
New-Item -ItemType Directory -Path ${{env.BUILD_TYPE}} -Force | Out-Null
Copy-Item -Path *.dll, *.exe, start_ballancemmo_loop.bat, bmmo_loop.ps1 -Destination ${{env.BUILD_TYPE}} -Force -ErrorAction Ignore
- name: Release Artifact
uses: actions/upload-artifact@v4
with:
name: server-windows-${{env.BMMO_VER}}-${{env.SHA_SHORT}}
path: build/BallanceMMOServer/${{env.BUILD_TYPE}}