Harden Linux server runtime and packaging
Adds end-to-end Linux compatibility work for the dedicated server: new CI workflow (Ubuntu + Arch), line-ending/executable safeguards, and a local venv-first startup flow with split dependency files for server vs optional host GUI tooling. Improves runtime resilience with better bind error messages, stricter config validation, writable-state checks, cleaner socket/thread shutdown behavior, and SIGTERM-aware graceful stop handling for headless/systemd use. Updates deployment/startup docs and adds portability/runtime integration tests to lock in these behaviors.
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
name: Linux Compatibility
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "server/**"
|
||||
- ".gitattributes"
|
||||
- ".gitignore"
|
||||
- ".github/workflows/linux-compatibility.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
- "server/**"
|
||||
- ".gitattributes"
|
||||
- ".gitignore"
|
||||
- ".github/workflows/linux-compatibility.yml"
|
||||
|
||||
jobs:
|
||||
ubuntu:
|
||||
name: Ubuntu dedicated server
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: server
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y shellcheck
|
||||
|
||||
- name: Verify start.sh LF and executable bit
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
data = Path("start.sh").read_bytes()
|
||||
assert b"\r\n" not in data, "start.sh must use LF line endings"
|
||||
PY
|
||||
test -x start.sh
|
||||
|
||||
- name: Syntax and shellcheck
|
||||
run: |
|
||||
bash -n start.sh
|
||||
shellcheck start.sh
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Create clean venv and install server deps
|
||||
run: |
|
||||
python -m venv .venv
|
||||
.venv/bin/python -m pip install --upgrade pip
|
||||
.venv/bin/python -m pip install -r requirements-server.txt pytest
|
||||
# Ensure GUI-only deps are not required for dedicated server
|
||||
! .venv/bin/python -c "import PySide6" 2>/dev/null
|
||||
|
||||
- name: Compile and test
|
||||
run: |
|
||||
.venv/bin/python -m compileall -q .
|
||||
.venv/bin/python -m pytest -q
|
||||
.venv/bin/python test_npc_protocol.py
|
||||
.venv/bin/python test_combat_protocol.py
|
||||
|
||||
arch:
|
||||
name: Arch Linux container
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: archlinux:latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: server
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
pacman -Syu --noconfirm python python-pip shellcheck
|
||||
|
||||
- name: Verify start.sh LF and executable bit
|
||||
run: |
|
||||
python - <<'PY'
|
||||
from pathlib import Path
|
||||
data = Path("start.sh").read_bytes()
|
||||
assert b"\r\n" not in data, "start.sh must use LF line endings"
|
||||
PY
|
||||
test -x start.sh
|
||||
|
||||
- name: Syntax and shellcheck
|
||||
run: |
|
||||
bash -n start.sh
|
||||
shellcheck start.sh
|
||||
|
||||
- name: Create clean venv and install server deps
|
||||
run: |
|
||||
python -m venv .venv
|
||||
.venv/bin/python -m pip install --upgrade pip
|
||||
.venv/bin/python -m pip install -r requirements-server.txt pytest
|
||||
|
||||
- name: Compile and test
|
||||
run: |
|
||||
.venv/bin/python -m compileall -q .
|
||||
.venv/bin/python -m pytest -q
|
||||
.venv/bin/python test_npc_protocol.py
|
||||
.venv/bin/python test_combat_protocol.py
|
||||
Reference in New Issue
Block a user