Skip to content

[QUEST]Sandoria Teleport Scroll Quest to IF #16428

[QUEST]Sandoria Teleport Scroll Quest to IF

[QUEST]Sandoria Teleport Scroll Quest to IF #16428

Workflow file for this run

name: "build"
on:
pull_request:
types:
- opened
- synchronize
- reopened
push:
branches:
- base
- everything
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
Sanity_Checks:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common cppcheck luajit-5.1-dev luarocks mariadb-server-10.6 mariadb-client-10.6 libmariadb-dev-compat binutils-dev
pip install -r tools/requirements.txt
luarocks install luacheck --local
npm install -g diff-so-fancy
- id: changed-files
name: Get Changed Files
uses: Ana06/[email protected]
with:
filter: |
modules/**
src/**
scripts/**
sql/**
continue-on-error: true
- name: List Changed Files
if: always()
run: |
for changed_file in ${{ steps.changed-files.outputs.all }}; do
echo "${changed_file}"
done
- name: Git Formatting Checks
if: github.event_name == 'pull_request'
run: |
touch git_checks.txt
bash tools/ci/git.sh origin/${{ github.event.pull_request.base.ref }} >> git_checks.txt || true
cat git_checks.txt
if [ -s git_checks.txt ]
then
exit 1
fi
exit 0
- name: General File Checks
if: always()
run: |
touch general_checks.txt
for changed_file in ${{ steps.changed-files.outputs.all }}; do
if [[ -f $changed_file ]]; then
bash tools/ci/general.sh ${changed_file} >> general_checks.txt || true
fi
done
cat general_checks.txt
if [ -s general_checks.txt ]
then
exit 1
fi
exit 0
- name: CPP Checks
if: always()
run: |
touch cpp_checks.txt
for changed_file in ${{ steps.changed-files.outputs.all }}; do
if [[ -f $changed_file ]]; then
if [[ $changed_file == *.cpp ]]; then
bash tools/ci/cpp.sh ${changed_file} 2>> cpp_checks.txt >> cpp_checks.txt || true
fi
fi
done
cat cpp_checks.txt
if [ -s cpp_checks.txt ]
then
exit 1
fi
exit 0
- name: CPP Formatting Checks (clang-format-15)
if: always()
run: |
clang-format-15 -version
touch cpp_formatting_checks.txt
for changed_file in ${{ steps.changed-files.outputs.all }}; do
if [[ -f $changed_file ]]; then
if [[ $changed_file == *.cpp || $changed_file == *.h ]]; then
clang-format-15 -style=file -i ${changed_file}
fi
fi
done
git diff --color >> cpp_formatting_checks.txt
git reset --hard
if [ -s cpp_formatting_checks.txt ]
then
echo ""
echo "You have errors in your C++ code formatting."
echo "Please see below in red for the incorrect formatting, and in green for the correct formatting."
echo "You can either fix the formatting by hand or use clang-format."
echo "(You can safely ignore warnings about \$TERM and tput)"
echo ""
cat cpp_formatting_checks.txt | diff-so-fancy || true
exit 1
fi
exit 0
- name: Upload CPP Formatting Diff
if: hashFiles('cpp_formatting_checks.txt') != ''
uses: actions/upload-artifact@v4
with:
name: clang_format_diff
path: |
cpp_formatting_checks.txt
- name: Lua Checks
if: always()
run: |
touch lua_checks.txt
python3 tools/ci/lua_stylecheck.py test >> lua_checks.txt
for changed_file in ${{ steps.changed-files.outputs.all }}; do
if [[ -f $changed_file ]]; then
if [[ $changed_file == *.lua ]]; then
bash tools/ci/lua.sh ${changed_file} >> lua_checks.txt || true
fi
fi
done
python3 tools/ci/check_lua_binding_usage.py >> lua_checks.txt
cat lua_checks.txt
if [ -s lua_checks.txt ]
then
exit 1
fi
exit 0
- name: SQL Checks
if: always()
run: |
touch sql_checks.txt
for changed_file in ${{ steps.changed-files.outputs.all }}; do
if [[ -f $changed_file ]]; then
if [[ $changed_file == *.sql ]]; then
bash tools/ci/sql.sh ${changed_file} >> sql_checks.txt || true
fi
fi
done
python3 tools/price_checker.py >> sql_checks.txt
cat sql_checks.txt
if [ -s sql_checks.txt ]
then
exit 1
fi
exit 0
- name: Python Checks
if: always()
run: |
touch python_checks.txt
for changed_file in ${{ steps.changed-files.outputs.all }}; do
if [[ -f $changed_file ]]; then
if [[ $changed_file == *.py ]]; then
bash tools/ci/python.sh ${changed_file} >> python_checks.txt || true
fi
fi
done
cat python_checks.txt
if [ -s python_checks.txt ]
then
exit 1
fi
exit 0
Linux_LuaLanguageServer:
needs: Sanity_Checks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Or else we don't get full blame information
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common cmake libmariadb-dev-compat libluajit-5.1-dev libzmq3-dev zlib1g-dev libssl-dev binutils-dev
pip install -r tools/requirements.txt
- name: Run Lua Language Server
run: |
python3 tools/ci/lua_lang_server.py
- name: Upload Lua Language Server Output
if: hashFiles('lua_lang_errors.txt') != ''
uses: actions/upload-artifact@v4
with:
name: lua_lang_errors
path: lua_lang_errors.txt
- name: Check Output
run: |
if [ -f lua_lang_errors.txt ]; then
cat lua_lang_errors.txt
exit 1
fi
Linux_Clang15_64bit:
needs: Sanity_Checks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common cmake libmariadb-dev-compat libluajit-5.1-dev libzmq3-dev zlib1g-dev libssl-dev binutils-dev
#- name: Cache 'build' folder
# uses: actions/cache@v4
# with:
# path: build
# key: ${{ runner.os }}-clang
- name: Configure CMake
run: |
export CC=/usr/bin/clang-15
export CXX=/usr/bin/clang++-15
mkdir -p build
cmake -S . -B build
- name: Build
run: |
cmake --build build -j4
- name: Archive Executables
uses: actions/upload-artifact@v4
with:
name: linux_executables
path: |
xi_connect
xi_map
xi_search
xi_world
Linux_ClangTidy15_64bit:
needs: Sanity_Checks
runs-on: ubuntu-22.04
steps:
# workaround for broken clang on ubuntu runner until fixed: https://github.com/actions/runner-images/issues/8659
- uses: claywar/workaround8649@4892524a133793c85e25513fae79fc968e63877c
with:
os: ubuntu-22.04
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common cmake libmariadb-dev-compat libluajit-5.1-dev libzmq3-dev zlib1g-dev libssl-dev binutils-dev
#- name: Cache 'build' folder
# uses: actions/cache@v4
# with:
# path: build
# key: ${{ runner.os }}-clang
- name: Configure CMake
run: |
export CC=/usr/bin/clang-15
export CXX=/usr/bin/clang++-15
mkdir -p build
cmake -S . -B build -DENABLE_CLANG_TIDY=ON
- name: Build
run: |
touch clang-tidy.txt
cmake --build build -j4 >> clang-tidy.txt || true
cat clang-tidy.txt
if grep -q warning\|error clang-tidy.txt; then
exit 1
fi
Linux_GCC13_64bit:
needs: Sanity_Checks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common cmake libmariadb-dev-compat libluajit-5.1-dev libzmq3-dev zlib1g-dev libssl-dev binutils-dev
# Required for 22.04 Image, remove on transition to 24.04
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install gcc-13 g++-13
#- name: Cache 'build' folder
# uses: actions/cache@v4
# with:
# path: build
# key: ${{ runner.os }}-gcc
- name: Configure CMake
run: |
export CC=/usr/bin/gcc-13
export CXX=/usr/bin/g++-13
mkdir -p build
CFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS=-m64 cmake -S . -B build
- name: Build
run: |
cmake --build build -j4
Windows_64bit_Debug:
needs: Sanity_Checks
runs-on: windows-2022
env:
MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache 'build' folder
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-msvc64d
- name: Configure CMake
shell: cmd
run: |
mkdir -p build
cmake -S . -B build -A x64 -DCMAKE_BUILD_TYPE=Debug
- name: Build
shell: cmd
run: |
cmake --build build -j4
- name: Archive Executables
uses: actions/upload-artifact@v4
with:
name: windows_executables
path: |
xi_connect.exe
xi_map.exe
xi_search.exe
xi_world.exe
Windows_64bit_Release_Tracy_Modules:
needs: Sanity_Checks
runs-on: windows-2022
env:
MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache 'build' folder
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-msvc64-t
- name: Enable Modules
shell: bash
run: |
python3 << EOF
with open("modules/init.txt", "w") as f:
f.write("custom\n")
f.write("era\n")
f.write("renamer\n")
EOF
- name: Configure CMake
shell: cmd
run: |
mkdir -p build
cmake -S . -B build -A x64 -DCMAKE_BUILD_TYPE=Release -DENABLE_TRACY=ON
- name: Build
shell: cmd
run: |
cmake --build build -j4
MacOS_64bit:
needs: Sanity_Checks
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Dependencies (Brew)
run: |
brew install mariadb zeromq zmq luajit
- name: Configure CMake
run: |
mkdir -p build
cmake -S . -B build
- name: Build
run: |
cmake --build build -j4
Full_Startup_Checks_Linux:
runs-on: ubuntu-22.04
needs: Linux_Clang15_64bit
services:
mysql:
image: mariadb:10.6
env:
MYSQL_DATABASE: xidb
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/download-artifact@v4
with:
name: linux_executables
path: .
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common cmake mariadb-client-10.6 libmariadb-dev-compat libluajit-5.1-dev libzmq3-dev zlib1g-dev libssl-dev luarocks binutils-dev
pip install bcrypt
- name: Verify MySQL connection from container
run: |
mysql -h 127.0.0.1 -uroot -proot -e "SHOW DATABASES"
- name: Import SQL files
run: |
for f in sql/*.sql; do
echo -e "Importing $f into the database..."
mysql xidb -h 127.0.0.1 -uroot -proot < $f
done
mysql xidb -h 127.0.0.1 -uroot -proot -e "SHOW tables"
- name: Copy settings
run: |
cp settings/default/* settings/
- name: Enable Modules
shell: bash
run: |
python3 << EOF
with open("modules/init.txt", "w") as f:
f.write("custom\n")
f.write("era\n")
f.write("renamer\n")
EOF
- name: Startup and character login checks
uses: nick-invision/retry@v3
with:
timeout_minutes: 15
max_attempts: 3
retry_on: timeout
shell: bash
command: |
chmod +x xi_connect
chmod +x xi_map
chmod +x xi_search
chmod +x xi_world
ls -l
printf "\nStart server processes\n"
screen -d -m -S xi_connect ./xi_connect --log login-server.log
screen -d -m -S xi_search ./xi_search --log search-server.log
screen -d -m -S xi_map ./xi_map --log map-server.log
screen -d -m -S xi_world ./xi_world --log world-server.log
printf "\nWaiting 5m for servers to fully start up\n"
sleep 300s
# define bash helper function to help diagnose any sql errors
function mysqlcmd() { mysql xidb -h 127.0.0.1 -uroot -proot --verbose -e "$@"; }
printf "\nPopulating database\n"
# Clean out anything already there (just in case)
mysqlcmd "DELETE FROM accounts;"
mysqlcmd "DELETE FROM chars;"
mysqlcmd "DELETE FROM char_look;"
mysqlcmd "DELETE FROM char_stats;"
# Clean tables that are made from triggers on insert to char table
mysqlcmd "DELETE FROM char_equip;"
mysqlcmd "DELETE FROM char_exp;"
mysqlcmd "DELETE FROM char_history;"
mysqlcmd "DELETE FROM char_inventory;"
mysqlcmd "DELETE FROM char_jobs;"
mysqlcmd "DELETE FROM char_pet;"
mysqlcmd "DELETE FROM char_points;"
mysqlcmd "DELETE FROM char_profile;"
mysqlcmd "DELETE FROM char_storage;"
mysqlcmd "DELETE FROM char_unlocks;"
# Create an account
PASSWORD_HASH=\$2a\$12\$piFoDKvu80KK68xLgQFpt.ZCqVPTjPmhSUfA31.Yw9n404dTsrR6q
mysqlcmd "INSERT INTO accounts (id, login, password, timecreate, timelastmodify, status, priv)
VALUES(1000, 'admin1', '$PASSWORD_HASH', NOW(), NOW(), 1, 1);
SELECT id, login, content_ids FROM accounts;"
# Create a character
mysqlcmd "INSERT INTO chars (charid, accid, charname, pos_zone, nation, gmlevel)
VALUES(1, 1000, 'Test', 0, 0, 5);
SELECT charid, accid, charname, pos_zone FROM chars;"
# Set char_look (default is 0 and trips up scripting)
mysqlcmd "INSERT INTO char_look (charid, face, race, size, head, body, hands, legs, feet, main, sub, ranged)
VALUES (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
SELECT charid, face, race FROM char_look;"
# Populate more char tables with defaults
mysqlcmd "INSERT INTO char_stats (charid, mjob)
VALUES(1, 1);
SELECT charid, mjob FROM char_stats;"
# Update character information
# Place near some Robber Crabs in Kuftal Tunnel
mysqlcmd "UPDATE chars
SET
pos_zone = 174,
pos_prevzone = 174,
pos_x = 55,
pos_y = -9,
pos_z = -140
WHERE charid = 1;"
mysqlcmd "SELECT charid, accid, charname, pos_zone, pos_x, pos_y, pos_z FROM chars;"
# Set GodMode CharVar = 1
mysqlcmd "INSERT INTO char_vars(charid, varname, value)
VALUES(1, 'GodMode', 1);"
printf "\nRunning HeadlessXI for 60 seconds\n"
python3 << EOF
import time
try:
from tools.headlessxi.hxiclient import HXIClient
hxi_client = HXIClient('admin1', 'admin1', 'localhost')
hxi_client.login()
print('Sleeping 60s')
time.sleep(60)
hxi_client.logout()
exit(0)
except Exception as e:
exit(-1)
EOF
hxi_result=$?
pkill -SIGINT xi_map
pkill -SIGINT xi_search
pkill -SIGINT xi_connect
pkill -SIGINT xi_world
# fail if hxi had a non-zero exit code
if [[ "$hxi_result" -ne "0" ]]; then
echo "hxi exited with code $hxi_result"
exit $hxi_result
fi
- name: Check for errors and warnings
if: ${{ success() || failure() }}
run: |
cat login-server*.log
cat map-server*.log
cat search-server*.log
cat world-server*.log
if grep -qi "warning\|error\|crash" login-server*.log; then
exit -1
fi
if grep -qi "warning\|error\|crash" map-server*.log; then
exit -1
fi
if grep -qi "warning\|error\|crash" search-server*.log; then
exit -1
fi
if grep -qi "warning\|error\|crash" world-server*.log; then
exit -1
fi
MultiInstance_Startup_Checks_Linux:
runs-on: ubuntu-22.04
needs: Linux_Clang15_64bit
services:
mysql:
image: mariadb:10.6
env:
MYSQL_DATABASE: xidb
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/download-artifact@v4
with:
name: linux_executables
path: .
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common cmake mariadb-client-10.6 libmariadb-dev-compat libluajit-5.1-dev libzmq3-dev zlib1g-dev libssl-dev luarocks binutils-dev
- name: Verify MySQL connection from container
run: |
mysql -h 127.0.0.1 -uroot -proot -e "SHOW DATABASES"
- name: Import SQL files
run: |
for f in sql/*.sql; do
echo -e "Importing $f into the database..."
mysql xidb -h 127.0.0.1 -uroot -proot < $f
done
mysql xidb -h 127.0.0.1 -uroot -proot -e "SHOW tables"
- name: Assign odd zones a different port
run: |
mysql xidb -h 127.0.0.1 -uroot -proot -e "UPDATE xidb.zone_settings SET zoneport = 54231 WHERE zoneid % 2 = 0;"
- name: Copy settings
run: |
cp settings/default/* settings/
- name: Startup checks
env:
MYSQL_HOST: mysql
run: |
chmod +x xi_connect
chmod +x xi_map
chmod +x xi_search
chmod +x xi_world
ls -l
printf "\nStart server processes\n"
screen -d -m -S xi_connect ./xi_connect --log login-server.log
screen -d -m -S xi_search ./xi_search --log search-server.log
screen -d -m -S xi_map ./xi_map --log map-server-0.log --ip 127.0.0.1 --port 54230
screen -d -m -S xi_map ./xi_map --log map-server-1.log --ip 127.0.0.1 --port 54231
screen -d -m -S xi_world ./xi_world --log world-server.log
sleep 300s
killall screen
- name: Check for errors and warnings
if: ${{ success() || failure() }}
run: |
cat login-server*.log
cat search-server*.log
cat map-server-0*.log
cat map-server-1*.log
cat world-server*.log
if grep -qi "warning\|error\|crash" login-server*.log; then
exit -1
fi
if grep -qi "warning\|error\|crash" search-server*.log; then
exit -1
fi
if grep -qi "warning\|error\|crash" map-server-0*.log; then
exit -1
fi
if grep -qi "warning\|error\|crash" map-server-1*.log; then
exit -1
fi
if grep -qi "warning\|error\|crash" world-server*.log; then
exit -1
fi
Full_Startup_Checks_Windows:
runs-on: windows-2022
needs: Windows_64bit_Debug
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/download-artifact@v4
with:
name: windows_executables
path: .
- uses: zach2good/setup-mariadb@v1
with:
database: xidb
- name: Copy settings
run: |
cp settings/default/* settings/
- name: Install Python Dependencies
run: |
pip install -r tools/requirements.txt
- name: Import SQL files
shell: bash
run: |
for f in sql/*.sql; do
echo -e "Importing $f into the database..."
mysql xidb -h 127.0.0.1 -uroot -proot < $f
done
mysql xidb -h 127.0.0.1 -uroot -proot -e "SHOW tables"
- name: Startup checks
shell: bash
run: |
python3 ./tools/ci/startup_checks.py