Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 10 additions & 6 deletions .github/workflows/core_codestyle.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
name: Codestyle Checks

permissions:
contents: read

on:
push:
branches: [ master ]
branches: [master, devel]
pull_request:
branches: [ master ]
branches: [master]

concurrency:
group: codestyle-${{ github.ref }}
cancel-in-progress: true

jobs:
check-codestyle:
strategy:
fail-fast: false

runs-on: ubuntu-latest
name: Check Codestyling
steps:
- uses: actions/checkout@v2
# v2 runs on a long-deprecated Node runtime and is scheduled for removal.
- uses: actions/checkout@v4

- name: Check Codestyling
run: source ./apps/ci/ci-codestyle.sh
49 changes: 38 additions & 11 deletions .github/workflows/core_linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ name: Linux Build (GCC + Clang)

on:
push:
branches: [ master, devel ]
branches: [master, devel]
pull_request:
branches: [ master ]
branches: [master]

permissions:
contents: read

# A second push to the same branch makes the first run's result worthless. Cancel it rather
# than pay for two builds and read the stale one.
concurrency:
group: linux-build-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -34,21 +40,35 @@ jobs:
submodules: recursive
fetch-depth: 1

- name: Cache CMake build
# ccache, not a cached build directory.
#
# The old workflow cached _build itself, which cannot work with make: actions/checkout
# rewrites every source file, so all sources end up NEWER than the restored objects and
# make rebuilds the lot anyway -- we paid to upload and download a build tree for zero
# reuse. Worse, the key hashed only **/CMakeLists.txt, and actions/cache does not
# re-save on an exact key hit, so once populated that tree was frozen for good.
#
# ccache keys on the *content* of each translation unit, so it is immune to both
# problems. The key carries github.sha (always unique => always saved) while
# restore-keys pulls the newest previous cache to seed it.
- name: Cache ccache
uses: actions/cache@v4
with:
path: _build
key: ${{ runner.os }}-${{ matrix.name }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}
path: ~/.cache/ccache
key: ${{ runner.os }}-${{ matrix.name }}-ccache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.name }}-cmake-
${{ runner.os }}-${{ matrix.name }}-ccache-

# libace-dev is deliberately absent: ACE was removed from the core (see "ACE removal"),
# and the single remaining "ace/..." include in the tree belongs to the Movemap
# generator, which BUILD_TOOLS=0 below no longer builds.
- name: Install build dependencies
run: |
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
git cmake make build-essential \
git cmake make build-essential ccache \
libssl-dev libbz2-dev default-libmysqlclient-dev \
libace-dev libreadline-dev \
libreadline-dev \
${{ matrix.pkg }}

- name: Configure project
Expand All @@ -60,18 +80,25 @@ jobs:
-DCMAKE_INSTALL_PREFIX=../_install \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DBUILD_TOOLS=1 \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_TOOLS=0 \
-DBUILD_MANGOSD=1 \
-DBUILD_REALMD=1 \
-DSOAP=1 \
-DSCRIPT_LIB_ELUNA=1 \
-DSCRIPT_LIB_SD3_GATE=1 \
-DSCRIPT_LIB_SD3=1 \
-DPLAYERBOTS=1 \
-DUSE_STORMLIB=1 \
-DPCH=0
-DPCH=0 \
--warn-uninitialized

- name: Build and install
run: |
cd _build
make -j"$(nproc)"
make install -j"$(nproc)"

- name: ccache statistics
if: always()
run: ccache -s
39 changes: 14 additions & 25 deletions .github/workflows/core_windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,49 @@ permissions:

on:
push:
branches: [ master , devel ]
branches: [master, devel]
pull_request:
branches: [ master ]
branches: [master]

# Supersede an in-flight run when the branch moves on: its result is already stale.
concurrency:
group: windows-build-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: windows-2022
strategy:
fail-fast: false

steps:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1


# Bump the -vN suffix to force a re-install of OpenSSL.
- name: Cache OpenSSL
id: cache-openssl
uses: actions/cache@v4
with:
path: |
C:\Program Files\OpenSSL
C:\Program Files\OpenSSL-Win64
key: ${{ runner.os }}-openssl-full
key: ${{ runner.os }}-openssl-v1


- name: Install full OpenSSL (developer)
- name: Install OpenSSL (developer)
if: steps.cache-openssl.outputs.cache-hit != 'true'
shell: powershell
run: |
Write-Host "Installing latest full OpenSSL for development..."
choco upgrade openssl -y --no-progress
$ver = & openssl version
Write-Host "Installed OpenSSL version: $ver"


- name: Setup Windows 10 SDK
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621


- name: Configure OpenSSL environment
shell: bash
run: |
Expand All @@ -63,28 +61,20 @@ jobs:
echo "OPENSSL_INCLUDE_DIR=C:/Program Files/OpenSSL-Win64/include" >> $GITHUB_ENV
echo "OPENSSL_CRYPTO_LIBRARY=C:/Program Files/OpenSSL-Win64/lib/VC/libcrypto64MT.lib" >> $GITHUB_ENV
echo "OPENSSL_SSL_LIBRARY=C:/Program Files/OpenSSL-Win64/lib/VC/libssl64MT.lib" >> $GITHUB_ENV
else
echo "::error::OpenSSL not found in either expected location"
exit 1
fi


- name: Cache CMake build
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-cmake-


- name: Configure CMake project
shell: bash
run: |
mkdir -p build && cd build
cmake .. \
-G "Visual Studio 17 2022" \
-A x64 \
-DCMAKE_BUILD_TYPE=Release \
-DOPENSSL_USE_STATIC_LIBS=TRUE \
-DBUILD_TOOLS=1 \
-DBUILD_TOOLS=0 \
-DBUILD_MANGOSD=1 \
-DBUILD_REALMD=1 \
-DSOAP=1 \
Expand All @@ -94,7 +84,6 @@ jobs:
-DUSE_STORMLIB=1 \
-DPCH=0


- name: Build project
shell: bash
run: |
Expand Down
50 changes: 36 additions & 14 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,53 @@
name: Docker Build

# This was the one workflow with no permissions block at all, so it ran with the repository's
# default token scope -- which can be write. It only builds images and pushes nothing, so
# read is all it ever needed.
permissions:
contents: read

on:
push:
branches: [ master , devel ]
branches: [master, devel]
pull_request:
branches: [ master ]
branches: [master]

concurrency:
group: docker-build-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
# v2 runs on a deprecated Node runtime.
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout Submodules
shell: bash
run: |
git submodule init && git submodule update
submodules: recursive
fetch-depth: 1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

# Layer caching across runs.
- name: Build Mangosd Docker image
run: |
docker build -t mangosd:latest -f dockercontainer/DockerFile-mangosd .
uses: docker/build-push-action@v6
with:
context: .
file: dockercontainer/DockerFile-mangosd
tags: mangosd:latest
push: false
cache-from: type=gha,scope=mangosd
cache-to: type=gha,mode=max,scope=mangosd

- name: Build Realmd Docker image
run: |
docker build -t realmd:latest -f dockercontainer/DockerFile-realmd .
uses: docker/build-push-action@v6
with:
context: .
file: dockercontainer/DockerFile-realmd
tags: realmd:latest
push: false
cache-from: type=gha,scope=realmd
cache-to: type=gha,mode=max,scope=realmd
52 changes: 33 additions & 19 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ this repo. Humans: also read [`doc/CodingStandard.md`](doc/CodingStandard.md).
`Rel##_##_###_*.sql` migrations that chain via `db_version`.
- Clone/update **recursively**: `dep`, `src/realmd`, `src/modules/{SD3,Eluna}`, `src/tools/Extractor_projects`
and `win` are submodules. Never shallow-update a submodule to a non-tip pinned SHA.
- Less-obvious locations: out-of-process services in `src/ipc/` + `src/ah-service/`; scripting in
`src/modules/` (Eluna = Lua, SD3 = C++, Bots = playerbots).
- Less-obvious locations: scripting lives in `src/modules/` — Eluna (Lua) and SD3 (C++) are submodules;
Bots (playerbots) is in-tree. The AuctionHouseBot is in `src/game/AuctionHouseBot/`.

## Build & test

Expand All @@ -22,20 +22,30 @@ this repo. Humans: also read [`doc/CodingStandard.md`](doc/CodingStandard.md).

```sh
git clone --recursive https://github.com/mangosone/server.git && cd server
sudo apt-get install -y git cmake make build-essential \
libssl-dev libbz2-dev default-libmysqlclient-dev libace-dev libreadline-dev # Debian/Ubuntu deps
sudo apt-get install -y git cmake make build-essential ccache \
libssl-dev libbz2-dev default-libmysqlclient-dev libreadline-dev # Debian/Ubuntu deps
mkdir -p _build _install && cd _build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../_install \
-DBUILD_TOOLS=1 -DBUILD_MANGOSD=1 -DBUILD_REALMD=1 -DSOAP=1 \
-DSCRIPT_LIB_ELUNA=1 -DSCRIPT_LIB_SD3_GATE=1 -DPLAYERBOTS=1 \
-DUSE_STORMLIB=1 -DBUILD_AH_SERVICE=1 -DPCH=0
-DBUILD_TOOLS=0 -DBUILD_MANGOSD=1 -DBUILD_REALMD=1 -DSOAP=1 \
-DSCRIPT_LIB_ELUNA=1 -DSCRIPT_LIB_SD3=1 -DPLAYERBOTS=1 \
-DUSE_STORMLIB=1 -DPCH=0
make -j"$(nproc)" && make install -j"$(nproc)"
```

Windows: use the EasyBuild helper in `win/`. **A PR MUST keep CI green:** the Linux build compiles with
**both** GCC and Clang, Windows builds on AppVeyor, and Codacy/CodeFactor gate quality. If you touch
`src/ipc/` or `src/ah-service/`, keep `ah-service --selftest` passing (it must print `intent codec selftest OK`
and `ipc selftest OK`).
Every `-D` above is a real option (see the `option(...)` block in `CMakeLists.txt`). CMake **silently ignores
an unknown `-D`** — it only mutters "Manually-specified variables were not used" at the end — so a misspelt
flag looks like it works while configuring nothing. Check the name against `CMakeLists.txt` before adding one.

`BUILD_TOOLS=0`: the asset extractors are not used, and the Movemap generator is the last thing in the tree
that wanted ACE — which is why `libace-dev` is no longer in the dependency list either.

Windows: use the EasyBuild helper in `win/`. **A PR MUST keep CI green.** CI is GitHub Actions
(`.github/workflows/`): `core_linux_build.yml` builds with **both GCC and Clang**, `core_windows_build.yml`
builds with MSVC, `core_codestyle.yml` checks the style rules below, and `docker_build.yml` builds the images.

The GCC/Clang split matters more than it looks: the two standard libraries do not leak the same headers, so
a missing `#include` can pass on one and fail on the other. **Include what you use** — if a file names
`std::vector`, it includes `<vector>` itself rather than inheriting it from some header four levels up.

## Code style

Expand All @@ -56,9 +66,12 @@ Source of truth: [`doc/CodingStandard.md`](doc/CodingStandard.md). Non-default r

## Architecture note

The **in-process AuctionHouseBot is the default**; the out-of-process AH service is additive and default-off
(`AH.Service.Enabled`). `mangosd` is the **sole authority** over game state — worker/service "intents" are
re-validated server-side before they are applied.
`mangosd` is the **sole authority** over game state. The world runs as a single heartbeat loop on the main
thread (`Master::WorldLoop`); everything else — the console, remote access, SOAP, the freeze watchdog, the
DB delay threads — is auxiliary and must not mutate world state directly. Anything arriving from another
thread is queued to the world thread (see `World::QueueCliCommand`) rather than applied where it landed.

The AuctionHouseBot (`src/game/AuctionHouseBot/`) runs **in-process**.

## Logging

Expand All @@ -76,8 +89,9 @@ Recommended runtime mode: `LogLevel=1` (quiet console) + `LogFileLevel=3` (buffe

## Review focus (for `@claude`)

Prioritise: **(1)** correctness/safety in `src/game/` handlers and anything touching live world/DB state or
the `mangosd`↔worker trust boundary; **(2)** coding-standard conformance above; **(3)** build/CI impact (GCC
*and* Clang, Windows, the AH self-test); **(4)** DB-migration correctness (use the `mangosone/database`
pattern). Keep feedback concrete and minimal-diff; flag correctness/standard issues, not style preferences
the standard doesn't cover.
Prioritise: **(1)** correctness/safety in `src/game/` handlers and anything touching live world or DB state,
especially cross-thread state (the shutdown signal, the CLI command queue, the DB delay threads);
**(2)** coding-standard conformance above; **(3)** build/CI impact — GCC *and* Clang *and* MSVC, including
missing `#include`s that only one standard library exposes; **(4)** DB-migration correctness (use the
`mangosone/database` pattern). Keep feedback concrete and minimal-diff; flag correctness/standard issues, not
style preferences the standard doesn't cover.
Loading
Loading