diff --git a/.github/scripts/export-and-verify-sql-dumps.sh b/.github/scripts/export-and-verify-sql-dumps.sh new file mode 100755 index 000000000..063d21dfb --- /dev/null +++ b/.github/scripts/export-and-verify-sql-dumps.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Copyright (C) 2026-present VMaNGOS https://github.com/vmangos +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +set -euo pipefail + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +output_dir="$1" +dump_dir="$output_dir/mysql-dump" +mysql_client_args=(--host=127.0.0.1 --protocol=TCP -u root -proot) + +dump_database() { + local database="$1" + local file_path="$2" + docker exec mysqldb mysqldump "${mysql_client_args[@]}" "$database" > "$file_path" +} + +import_sql_file() { + local database="$1" + local file_path="$2" + docker exec -i mysqldb mysql "${mysql_client_args[@]}" "$database" < "$file_path" +} + +mkdir -p "$dump_dir" + +echo "Exporting MySQL dumps..." +dump_database mangos "$dump_dir/mangos.sql" +dump_database realmd "$dump_dir/logon.sql" +dump_database logs "$dump_dir/logs.sql" +dump_database characters "$dump_dir/characters.sql" + +echo "Creating verification databases..." +for database in realmd_verify characters_verify mangos_verify logs_verify; do + docker exec mysqldb mysql "${mysql_client_args[@]}" -e "CREATE DATABASE IF NOT EXISTS $database DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" +done + +echo "Reimporting exported dumps..." +import_sql_file realmd_verify "$dump_dir/logon.sql" +import_sql_file logs_verify "$dump_dir/logs.sql" +import_sql_file mangos_verify "$dump_dir/mangos.sql" +import_sql_file characters_verify "$dump_dir/characters.sql" diff --git a/.github/scripts/prepare-sql-test-environment.sh b/.github/scripts/prepare-sql-test-environment.sh new file mode 100755 index 000000000..9eba6bf36 --- /dev/null +++ b/.github/scripts/prepare-sql-test-environment.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash + +# Copyright (C) 2026-present VMaNGOS https://github.com/vmangos +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +set -euo pipefail + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +world_db_archive="$1" +workspace="${GITHUB_WORKSPACE:?GITHUB_WORKSPACE must be set}" +mysql_client_args=(--host=127.0.0.1 --protocol=TCP -u root -proot) + +import_sql_file() { + local database="$1" + local file_path="$2" + docker exec -i mysqldb mysql "${mysql_client_args[@]}" "$database" < "$file_path" +} + +apply_migration_file() { + local database="$1" + local file_name="$2" + local file_path="$workspace/sql/migrations/$file_name" + + if [ -f "$file_path" ]; then + import_sql_file "$database" "$file_path" + fi +} + +echo "Stopping preinstalled MySQL service..." +sudo service mysql stop + +echo "Starting MySQL container..." +sudo docker run --name mysqldb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.6 --max_allowed_packet=128M + +echo "Waiting for database availability..." +max_attempts=30 +attempt=0 +until docker exec mysqldb mysqladmin "${mysql_client_args[@]}" ping --silent &> /dev/null; do + attempt=$((attempt + 1)) + if [ "$attempt" -gt "$max_attempts" ]; then + echo "Database failed to become ready in time!" >&2 + exit 1 + fi + echo "Waiting for database to be ready... (attempt $attempt/$max_attempts)" + sleep 5 +done +echo "Database is ready!" + +echo "Downloading base world database..." +world_db_archive_path="$workspace/$world_db_archive.7z" +curl --fail --location --silent --show-error \ + --output "$world_db_archive_path" \ + "https://github.com/brotalnia/database/raw/master/$world_db_archive.7z" +7z e -y "$world_db_archive_path" -o"$workspace" + +echo "Creating source databases..." +for database in realmd characters mangos logs; do + docker exec mysqldb mysql "${mysql_client_args[@]}" -e "CREATE DATABASE IF NOT EXISTS $database DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" +done + +echo "Importing schema and base data..." +import_sql_file realmd "$workspace/sql/logon.sql" +import_sql_file logs "$workspace/sql/logs.sql" +import_sql_file mangos "$workspace/$world_db_archive.sql" +import_sql_file characters "$workspace/sql/characters.sql" + +echo "Applying SQL migrations..." +cd "$workspace/sql/migrations" +chmod +x merge.sh +./merge.sh + +apply_migration_file mangos world_db_updates.sql +apply_migration_file characters characters_db_updates.sql +apply_migration_file realmd logon_db_updates.sql +apply_migration_file logs logs_db_updates.sql diff --git a/.github/scripts/publish-moving-release.sh b/.github/scripts/publish-moving-release.sh new file mode 100755 index 000000000..3bba59d5c --- /dev/null +++ b/.github/scripts/publish-moving-release.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# Copyright (C) 2026-present VMaNGOS https://github.com/vmangos +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +set -euo pipefail + +if [ "$#" -ne 3 ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +release_tag="$1" +release_title_prefix="$2" +asset_dir="$3" +repo_url="https://github.com/$GITHUB_REPOSITORY" +release_title="$release_title_prefix($(date -u +%F))" +notes_file="$(mktemp)" + +trap 'rm -f "$notes_file"' EXIT + +git fetch --force --tags origin +previous_sha="$(git rev-parse -q --verify "refs/tags/$release_tag^{commit}" 2>/dev/null || true)" + +echo "## Commits" > "$notes_file" + +if [ -n "$previous_sha" ] && [ "$previous_sha" != "$GITHUB_SHA" ]; then + git_log_args=(--reverse --format='%H%x09%s' "$previous_sha..$GITHUB_SHA") +else + git_log_args=(-1 --format='%H%x09%s' "$GITHUB_SHA") +fi + +git log "${git_log_args[@]}" | while IFS=$'\t' read -r commit_sha subject; do + short_sha="${commit_sha:0:7}" + if [[ "$subject" =~ \(\#([0-9]+)\) ]]; then + pr_number="${BASH_REMATCH[1]}" + printf -- '- %s: %s [#%s](%s/pull/%s)\n' "$short_sha" "$subject" "$pr_number" "$repo_url" "$pr_number" + else + printf -- '- %s: %s\n' "$short_sha" "$subject" + fi +done >> "$notes_file" + +if gh release view "$release_tag" >/dev/null 2>&1; then + gh release delete "$release_tag" --yes +fi + +git tag -f "$release_tag" "$GITHUB_SHA" +git push origin "refs/tags/$release_tag" --force + +shopt -s nullglob +assets=("$asset_dir"/*) + +if [ "${#assets[@]}" -gt 0 ]; then + gh release create "$release_tag" "${assets[@]}" --title "$release_title" --notes-file "$notes_file" --prerelease --verify-tag +else + gh release create "$release_tag" --title "$release_title" --notes-file "$notes_file" --prerelease --verify-tag +fi diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml new file mode 100644 index 000000000..660d70bab --- /dev/null +++ b/.github/workflows/ci-build.yaml @@ -0,0 +1,101 @@ +# Build on Ubuntu with GCC and Clang, plus a Windows Visual Studio build. +name: CI Build + +on: + push: + paths-ignore: + - '.github/ISSUE_TEMPLATE.md' + - '.github/ISSUE_TEMPLATE/**' + - '.github/PULL_REQUEST_TEMPLATE.md' + - '.github/workflows/development-db-dump.yaml' + - '.github/workflows/pr-sql-check.yaml' + - '.gitignore' + - 'CONTRIBUTING.md' + - 'LICENSE' + - 'README.md' + - 'sql/**' + + pull_request: + paths-ignore: + - '.github/ISSUE_TEMPLATE.md' + - '.github/ISSUE_TEMPLATE/**' + - '.github/PULL_REQUEST_TEMPLATE.md' + - '.github/workflows/development-db-dump.yaml' + - '.github/workflows/pr-sql-check.yaml' + - '.gitignore' + - 'CONTRIBUTING.md' + - 'LICENSE' + - 'README.md' + - 'sql/**' + +jobs: + build: + name: Build on ${{ matrix.job_name }} + runs-on: ${{ matrix.os }} + permissions: + contents: read + strategy: + matrix: + include: + - os: ubuntu-24.04 + c_compiler: gcc + cxx_compiler: g++ + compiler: gcc + job_name: Ubuntu GCC + - os: ubuntu-24.04 + c_compiler: clang + cxx_compiler: clang++ + compiler: clang + job_name: Ubuntu Clang + - os: windows-2022 + job_name: Windows Visual Studio + + steps: + - name: Check out repository + uses: actions/checkout@v6 + + - name: Install Ubuntu build dependencies + if: matrix.os == 'ubuntu-24.04' + run: | + sudo apt update + sudo apt install -y --no-install-recommends \ + build-essential \ + cmake \ + libcurl4-openssl-dev \ + libmysqlclient-dev \ + libssl-dev \ + zlib1g-dev + + - name: Install Clang compiler + if: matrix.compiler == 'clang' + run: sudo apt install -y --no-install-recommends clang + + - name: Build and install on Ubuntu + if: matrix.os == 'ubuntu-24.04' + run: | + set -euo pipefail + mkdir -p build _install + cd build + cmake ../ \ + -DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \ + -DCMAKE_CXX_COMPILER="${{ matrix.cxx_compiler }}" \ + -DCMAKE_INSTALL_PREFIX="../_install" \ + -DUSE_EXTRACTORS=1 \ + -DENABLE_MAILSENDER=1 + make -j"$(nproc)" + make install + + - name: Build and install on Windows + if: matrix.os == 'windows-2022' + shell: bash # Windows runners default to PowerShell. + run: | + set -euo pipefail + # Build cURL. + cd "$GITHUB_WORKSPACE/dep/windows/optional_dependencies" + ./curl_download_and_build.bat + # Build VMaNGOS. + cd "$GITHUB_WORKSPACE" + mkdir -p build + cd build + cmake -DUSE_EXTRACTORS=1 -DENABLE_MAILSENDER=1 -G "Visual Studio 17 2022" -A x64 .. + "/c/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/MSBuild.exe" "MaNGOS.sln" //p:Platform=x64 //p:Configuration=Release //m diff --git a/.github/workflows/db_check.yml b/.github/workflows/db_check.yml deleted file mode 100644 index f6ef5089d..000000000 --- a/.github/workflows/db_check.yml +++ /dev/null @@ -1,104 +0,0 @@ -# this runner include the check only, only runs for pull_request -name: vmangos Development DB Check - -on: - pull_request: - paths: - - '**.sql' - - '.github/workflows/db_check.yml' -env: - REPO_DIR : ${{github.workspace}} - WORLD_DB : "world_full_14_june_2021" -jobs: - build: - runs-on: ubuntu-latest # 18.04 has mysql5.7 and latest(20.04) has mysql8 - permissions: - contents: read - - # ... some other config ... - - steps: - - - name: Shutdown Ubuntu MySQL (SUDO) - run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it - - - name: Start docker mysql - run: | - sudo docker pull mysql - sudo docker run --name mysqldb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.6 --max_allowed_packet=128M - sudo docker start mysqldb - echo "Waiting for database availability..." - max_attempts=30 - attempt=0 - until docker exec mysqldb mysqladmin -u root -proot ping --silent &> /dev/null; do - attempt=$((attempt+1)) - if [ $attempt -gt $max_attempts ]; then - echo "Database failed to become ready in time!" - exit 1 - fi - echo "Waiting for database to be ready... (attempt $attempt/$max_attempts)" - sleep 5 - done - echo "Database is ready!" - - - name: Checkout update sql - uses: actions/checkout@v4 - - - name: Checkout base sql - run: | - cd ${{github.workspace}} - git clone https://github.com/brotalnia/database - pwd - 7z e -y ${{github.workspace}}/database/${{env.WORLD_DB}}.7z - ls - - name: Create tables - run: | - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS realmd_db_check DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS characters_db_check DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS mangos_db_check DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS logs_db_check DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - - name: Import data - run: | - docker exec -i mysqldb sh -c 'exec mysql -u root -proot realmd_db_check' < ${{github.workspace}}/sql/logon.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot logs_db_check' < ${{github.workspace}}/sql/logs.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot mangos_db_check' < ${{github.workspace}}/${{env.WORLD_DB}}.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot characters_db_check' < ${{github.workspace}}/sql/characters.sql - - - name: Apply Migration - run: | - cd ${{github.workspace}}/sql/migrations/ && chmod +x merge.sh && ./merge.sh - [ -f "${{github.workspace}}/sql/migrations/world_db_updates.sql" ] && docker exec -i mysqldb sh -c 'exec mysql -u root -proot mangos_db_check' < ${{github.workspace}}/sql/migrations/world_db_updates.sql - [ -f "${{github.workspace}}/sql/migrations/characters_db_updates.sql" ] && docker exec -i mysqldb sh -c 'exec mysql -u root -proot characters_db_check' < ${{github.workspace}}/sql/migrations/characters_db_updates.sql - [ -f "${{github.workspace}}/sql/migrations/logon_db_updates.sql" ] && docker exec -i mysqldb sh -c 'exec mysql -u root -proot realmd_db_check' < ${{github.workspace}}/sql/migrations/logon_db_updates.sql - [ -f "${{github.workspace}}/sql/migrations/logs_db_updates.sql" ] && docker exec -i mysqldb sh -c 'exec mysql -u root -proot logs_db_check' < ${{github.workspace}}/sql/migrations/logs_db_updates.sql - - name: Export Dump - run: | - mkdir dbexport - cd ${{github.workspace}}/dbexport - mkdir db_dump - docker exec mysqldb sh -c 'exec mysqldump -u root -proot mangos_db_check' > ${{github.workspace}}/dbexport/db_dump/mangos.sql - docker exec mysqldb sh -c 'exec mysqldump -u root -proot realmd_db_check' > ${{github.workspace}}/dbexport/db_dump/logon.sql - docker exec mysqldb sh -c 'exec mysqldump -u root -proot logs_db_check' > ${{github.workspace}}/dbexport/db_dump/logs.sql - docker exec mysqldb sh -c 'exec mysqldump -u root -proot characters_db_check' > ${{github.workspace}}/dbexport/db_dump/characters.sql - - - # cd db_dump - # mkdir update_check_only_do_not_import - # cp ${{github.workspace}}/sql/migrations/world_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/world_db_updates.sql - # cp ${{github.workspace}}/sql/migrations/logon_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/logon_db_updates.sql - # cp ${{github.workspace}}/sql/migrations/logs_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/logs_db_updates.sql - # cp ${{github.workspace}}/sql/migrations/characters_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/characters_db_updates.sql - - - name: Create New tables - run: | - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS realmd2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS characters2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS mangos2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS logs2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - - - name: Import data back in to verify the dump data - run: | - docker exec -i mysqldb sh -c 'exec mysql -u root -proot realmd2' < ${{github.workspace}}/dbexport/db_dump/logon.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot logs2' < ${{github.workspace}}/dbexport/db_dump/logs.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot mangos2' < ${{github.workspace}}/dbexport/db_dump/mangos.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot characters2' < ${{github.workspace}}/dbexport/db_dump/characters.sql diff --git a/.github/workflows/db_dump.yml b/.github/workflows/db_dump.yml deleted file mode 100644 index 928a5c14d..000000000 --- a/.github/workflows/db_dump.yml +++ /dev/null @@ -1,179 +0,0 @@ -# this runner include the check and dump, only runs for push action -name: vmangos Development DB Dump - -on: - push: - branches: - - development - paths: - - '**.sql' - - '.github/workflows/db_dump.yml' - -env: - REPO_DIR : ${{github.workspace}} - WORLD_DB : "world_full_14_june_2021" -jobs: - build: - runs-on: ubuntu-latest # 18.04 has mysql5.7 and latest(20.04) has mysql8 - permissions: - contents: read - - # ... some other config ... - - steps: - - - name: Shutdown Ubuntu MySQL (SUDO) - run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it - - - name: Start docker mysql - run: | - sudo docker pull mysql - sudo docker run --name mysqldb -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.6 --max_allowed_packet=128M - sudo docker start mysqldb - echo "Waiting for database availability..." - max_attempts=30 - attempt=0 - until docker exec mysqldb mysqladmin -u root -proot ping --silent &> /dev/null; do - attempt=$((attempt+1)) - if [ $attempt -gt $max_attempts ]; then - echo "Database failed to become ready in time!" - exit 1 - fi - echo "Waiting for database to be ready... (attempt $attempt/$max_attempts)" - sleep 5 - done - echo "Database is ready!" - - - name: Checkout update sql - uses: actions/checkout@v4 - - - name: Checkout base sql - run: | - cd ${{github.workspace}} - git clone https://github.com/brotalnia/database - pwd - 7z e -y ${{github.workspace}}/database/${{env.WORLD_DB}}.7z - ls - - name: Create tables - run: | - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS realmd DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS characters DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS mangos DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS logs DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - - name: Import data - run: | - docker exec -i mysqldb sh -c 'exec mysql -u root -proot realmd' < ${{github.workspace}}/sql/logon.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot logs' < ${{github.workspace}}/sql/logs.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot mangos' < ${{github.workspace}}/${{env.WORLD_DB}}.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot characters' < ${{github.workspace}}/sql/characters.sql - - - name: Apply Migration - run: | - cd ${{github.workspace}}/sql/migrations/ && chmod +x merge.sh && ./merge.sh - [ -f "${{github.workspace}}/sql/migrations/world_db_updates.sql" ] && docker exec -i mysqldb sh -c 'exec mysql -u root -proot mangos' < ${{github.workspace}}/sql/migrations/world_db_updates.sql - [ -f "${{github.workspace}}/sql/migrations/characters_db_updates.sql" ] && docker exec -i mysqldb sh -c 'exec mysql -u root -proot characters' < ${{github.workspace}}/sql/migrations/characters_db_updates.sql - [ -f "${{github.workspace}}/sql/migrations/logon_db_updates.sql" ] && docker exec -i mysqldb sh -c 'exec mysql -u root -proot realmd' < ${{github.workspace}}/sql/migrations/logon_db_updates.sql - [ -f "${{github.workspace}}/sql/migrations/logs_db_updates.sql" ] && docker exec -i mysqldb sh -c 'exec mysql -u root -proot logs' < ${{github.workspace}}/sql/migrations/logs_db_updates.sql - - name: Export Dump - run: | - mkdir dbexport - cd ${{github.workspace}}/dbexport - mkdir db_dump - docker exec mysqldb sh -c 'exec mysqldump -u root -proot mangos' > ${{github.workspace}}/dbexport/db_dump/mangos.sql - docker exec mysqldb sh -c 'exec mysqldump -u root -proot realmd' > ${{github.workspace}}/dbexport/db_dump/logon.sql - docker exec mysqldb sh -c 'exec mysqldump -u root -proot logs' > ${{github.workspace}}/dbexport/db_dump/logs.sql - docker exec mysqldb sh -c 'exec mysqldump -u root -proot characters' > ${{github.workspace}}/dbexport/db_dump/characters.sql - - - # cd db_dump - # mkdir update_check_only_do_not_import - # cp ${{github.workspace}}/sql/migrations/world_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/world_db_updates.sql - # cp ${{github.workspace}}/sql/migrations/logon_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/logon_db_updates.sql - # cp ${{github.workspace}}/sql/migrations/logs_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/logs_db_updates.sql - # cp ${{github.workspace}}/sql/migrations/characters_db_updates.sql ${{github.workspace}}/dbexport/db_dump/update_check_only_do_not_import/characters_db_updates.sql - - - name: Install SQLite dependencies - run: | - sudo apt-get -qq update - sudo apt-get -qq install mawk sqlite3 - git clone https://github.com/dumblob/mysql2sqlite - chmod +x ${{github.workspace}}/mysql2sqlite/mysql2sqlite - - - name: Create SQLite databases - run: | - mkdir ${{github.workspace}}/dbexport/sqlite_dump || true - ${{github.workspace}}/mysql2sqlite/mysql2sqlite ${{github.workspace}}/dbexport/db_dump/mangos.sql | sqlite3 ${{github.workspace}}/dbexport/sqlite_dump/mangos.sqlite - ${{github.workspace}}/mysql2sqlite/mysql2sqlite ${{github.workspace}}/dbexport/db_dump/logon.sql | sqlite3 ${{github.workspace}}/dbexport/sqlite_dump/logon.sqlite - ${{github.workspace}}/mysql2sqlite/mysql2sqlite ${{github.workspace}}/dbexport/db_dump/logs.sql | sqlite3 ${{github.workspace}}/dbexport/sqlite_dump/logs.sqlite - ${{github.workspace}}/mysql2sqlite/mysql2sqlite ${{github.workspace}}/dbexport/db_dump/characters.sql | sqlite3 ${{github.workspace}}/dbexport/sqlite_dump/characters.sqlite - - - - name: Create New tables - run: | - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS realmd2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS characters2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS mangos2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - docker exec mysqldb sh -c 'exec mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS logs2 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"' - - - name: Import data back in to verify the dump data - run: | - docker exec -i mysqldb sh -c 'exec mysql -u root -proot realmd2' < ${{github.workspace}}/dbexport/db_dump/logon.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot logs2' < ${{github.workspace}}/dbexport/db_dump/logs.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot mangos2' < ${{github.workspace}}/dbexport/db_dump/mangos.sql - docker exec -i mysqldb sh -c 'exec mysql -u root -proot characters2' < ${{github.workspace}}/dbexport/db_dump/characters.sql - - - name: Set sha short outputs - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Archive files - run: | - cd ${{github.workspace}}/dbexport - 7z a -tzip db-${{steps.vars.outputs.sha_short}}.zip db_dump - 7z a -tzip db-sqlite-${{steps.vars.outputs.sha_short}}.zip sqlite_dump - - - name: Archive SQL artifact - uses: actions/upload-artifact@v4 - with: - name: snapshot-db-dump - path: "${{github.workspace}}/dbexport/db-${{steps.vars.outputs.sha_short}}.zip" - - - name: Archive SQLite artifact - uses: actions/upload-artifact@v4 - with: - name: snapshot-db-sqlite-dump - path: "${{github.workspace}}/dbexport/db-sqlite-${{steps.vars.outputs.sha_short}}.zip" - - publish: - needs: build - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Download artifact snapshot-db-dump - uses: actions/download-artifact@v4 - with: - name: snapshot-db-dump - path: all_snapshots - - - name: Download artifact snapshot-db-sqlite-dump - uses: actions/download-artifact@v4 - with: - name: snapshot-db-sqlite-dump - path: all_snapshots - - - name: Get current date - id: date - uses: Kaven-Universe/github-action-current-date-time@v1 - with: - format: "YYYY-MM-DD" - - - name: Upload snapshot - uses: "crowbarmaster/GH-Automatic-Releases@latest" - with: - repo_token: "${{ github.token }}" - automatic_release_tag: "db_latest" - prerelease: true - title: "Development DB Dump(${{ steps.date.outputs.time }})" - files: all_snapshots diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml deleted file mode 100644 index 4c9653bbf..000000000 --- a/.github/workflows/dev-release.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: Windows Development Release - -on: - push: - branches: - - development - paths-ignore: - - '.github/ISSUE_TEMPLATE/**' - - '.github/ISSUE_TEMPLATE.md' - - '.github/PULL_REQUEST_TEMPLATE.md' - - '.github/workflows/db_check.yml' - - '.github/workflows/db_dump.yml' - - 'sql/**' - - 'README.md' - - 'LICENSE' - - '.gitignore' - - 'CONTRIBUTING.md' - -jobs: - build: - runs-on: windows-2022 - permissions: - contents: read - - steps: - #git checkout - - uses: actions/checkout@v4 - - - name: windows dependencies - #Sets versions for TBB - env: - TBB_VERSION: 2020.3 - - run: | - # Setup TBB - export TBB_ROOT_DIR=$GITHUB_WORKSPACE/tbb - curl -LOJ https://github.com/oneapi-src/oneTBB/releases/download/v$TBB_VERSION/tbb-$TBB_VERSION-win.zip - unzip tbb-$TBB_VERSION-win.zip - rm tbb-$TBB_VERSION-win.zip - #git bash shell - shell: bash - - #build and install - - name: windows build & install - run: | - # Setup TBB - mkdir build - cd build - cmake -D TBB_ROOT_DIR=$GITHUB_WORKSPACE/tbb -DWITH_WARNINGS=0 -DUSE_EXTRACTORS=1 -G "Visual Studio 17 2022" -A x64 .. - /c/Program\ Files/Microsoft\ Visual\ Studio/2022/Enterprise/MSBuild/Current/Bin/MSBuild.exe "MaNGOS.sln" //p:Platform=x64 //p:Configuration=Release //m:2 - #git bash shell - shell: bash - - name: Create Upload File Name - run: | - echo "ARCHIVE_FILENAME=dev-$(git rev-parse --short HEAD).zip" >> $env:GITHUB_ENV - - name: Archive files - run: | - #data is in Release folder - cd ${{github.workspace}}/bin - copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbb.dll ${{github.workspace}}/bin/Release/tbb.dll - copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbb_debug.dll ${{github.workspace}}/bin/Release/tbb_debug.dll - copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbb_preview.dll ${{github.workspace}}/bin/Release/tbb_preview.dll - copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbb_preview_debug.dll ${{github.workspace}}/bin/Release/tbb_preview_debug.dll - copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbbmalloc.dll ${{github.workspace}}/bin/Release/tbbmalloc.dll - copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbbmalloc_debug.dll ${{github.workspace}}/bin/Release/tbbmalloc_debug.dll - copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbbmalloc_proxy.dll ${{github.workspace}}/bin/Release/tbbmalloc_proxy.dll - copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbbmalloc_proxy_debug.dll ${{github.workspace}}/bin/Release/tbbmalloc_proxy_debug.dll - - copy ${{github.workspace}}/dep/windows/lib/x64_release/libmySQL.dll ${{github.workspace}}/bin/Release/libmySQL.dll - # copy "c:/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" ${{github.workspace}}/bin/Release/libssl-1_1-x64.dll - # copy "c:/Program Files/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll" ${{github.workspace}}/bin/Release/libcrypto-1_1-x64.dll - copy ${{github.workspace}}/dep/windows/lib/x64_release/libeay32.dll ${{github.workspace}}/bin/Release/libeay32.dll - - 7z a -tzip ${{env.ARCHIVE_FILENAME}} Release - - name: Archive this artefact - uses: actions/upload-artifact@v4 - with: - name: snapshot-devbuild - path: "${{github.workspace}}/bin/${{env.ARCHIVE_FILENAME}}" - - publish: - needs: build - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Download artifact snapshot-Release - uses: actions/download-artifact@v4 - with: - pattern: snapshot-devbuild - merge-multiple: true - path: all_snapshots - - - name: Get current date - id: date - uses: Kaven-Universe/github-action-current-date-time@v1 - with: - format: "YYYY-MM-DD" - - - name: Upload snapshot - uses: "crowbarmaster/GH-Automatic-Releases@latest" - with: - repo_token: "${{ github.token }}" - automatic_release_tag: "latest" - prerelease: true - title: "Development Build(${{ steps.date.outputs.time }})" - files: all_snapshots diff --git a/.github/workflows/development-db-dump.yaml b/.github/workflows/development-db-dump.yaml new file mode 100644 index 000000000..1c6c46e9d --- /dev/null +++ b/.github/workflows/development-db-dump.yaml @@ -0,0 +1,112 @@ +# Validate SQL changes and publish database dumps on pushes to development. +name: Development Database Dump + +on: + push: + branches: + - development + paths: + - '.github/scripts/export-and-verify-sql-dumps.sh' + - '.github/scripts/prepare-sql-test-environment.sh' + - '.github/scripts/publish-moving-release.sh' + - '.github/workflows/development-db-dump.yaml' + - '**/*.sql' + +env: + WORLD_DB_ARCHIVE: world_full_14_june_2021 + +concurrency: + group: development-db-dump-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build database dump artifacts + runs-on: ubuntu-24.04 + permissions: + contents: read + + steps: + - name: Check out repository + uses: actions/checkout@v6 + + - name: Prepare SQL test environment + run: ./.github/scripts/prepare-sql-test-environment.sh "${{ env.WORLD_DB_ARCHIVE }}" + + - name: Export and verify MySQL dumps + run: ./.github/scripts/export-and-verify-sql-dumps.sh "${{ github.workspace }}/database-artifacts" + + - name: Install SQLite conversion tools + run: | + set -euo pipefail + sudo apt update + sudo apt install -y --no-install-recommends mawk sqlite3 + git clone --depth 1 "https://github.com/dumblob/mysql2sqlite" "${{ github.workspace }}/mysql2sqlite" + chmod +x "${{ github.workspace }}/mysql2sqlite/mysql2sqlite" + + - name: Convert MySQL dumps to SQLite + run: | + set -euo pipefail + workspace="${{ github.workspace }}" + converter="$workspace/mysql2sqlite/mysql2sqlite" + dump_dir="$workspace/database-artifacts/mysql-dump" + sqlite_dir="$workspace/database-artifacts/sqlite-dump" + + mkdir -p "$sqlite_dir" + "$converter" "$dump_dir/mangos.sql" | sqlite3 "$sqlite_dir/mangos.sqlite" + "$converter" "$dump_dir/logon.sql" | sqlite3 "$sqlite_dir/logon.sqlite" + "$converter" "$dump_dir/logs.sql" | sqlite3 "$sqlite_dir/logs.sqlite" + "$converter" "$dump_dir/characters.sql" | sqlite3 "$sqlite_dir/characters.sqlite" + + - name: Set archive file suffix + id: git_info + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Create database archives + run: | + set -euo pipefail + cd "${{ github.workspace }}/database-artifacts" + 7z a -tzip db-${{ steps.git_info.outputs.sha_short }}.zip mysql-dump + 7z a -tzip db-sqlite-${{ steps.git_info.outputs.sha_short }}.zip sqlite-dump + + - name: Upload MySQL dump artifact + uses: actions/upload-artifact@v7 + with: + name: development-mysql-dump + path: "${{ github.workspace }}/database-artifacts/db-${{ steps.git_info.outputs.sha_short }}.zip" + + - name: Upload SQLite dump artifact + uses: actions/upload-artifact@v7 + with: + name: development-sqlite-dump + path: "${{ github.workspace }}/database-artifacts/db-sqlite-${{ steps.git_info.outputs.sha_short }}.zip" + + publish: + name: Publish database dump release + needs: build + runs-on: ubuntu-24.04 + permissions: + contents: write + + steps: + - name: Check out repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Download MySQL dump artifact + uses: actions/download-artifact@v8 + with: + name: development-mysql-dump + path: release-assets + + - name: Download SQLite dump artifact + uses: actions/download-artifact@v8 + with: + name: development-sqlite-dump + path: release-assets + + - name: Publish release snapshot + env: + GH_TOKEN: ${{ github.token }} + run: ./.github/scripts/publish-moving-release.sh db_latest "Development DB Dump" release-assets diff --git a/.github/workflows/pr-sql-check.yaml b/.github/workflows/pr-sql-check.yaml new file mode 100644 index 000000000..0aef5ea70 --- /dev/null +++ b/.github/workflows/pr-sql-check.yaml @@ -0,0 +1,30 @@ +# Validate SQL changes on pull requests. +name: Pull Request SQL Check + +on: + pull_request: + paths: + - '.github/scripts/export-and-verify-sql-dumps.sh' + - '.github/scripts/prepare-sql-test-environment.sh' + - '.github/workflows/pr-sql-check.yaml' + - '**/*.sql' + +env: + WORLD_DB_ARCHIVE: world_full_14_june_2021 + +jobs: + build: + name: Validate SQL changes + runs-on: ubuntu-24.04 + permissions: + contents: read + + steps: + - name: Check out repository + uses: actions/checkout@v6 + + - name: Prepare SQL test environment + run: ./.github/scripts/prepare-sql-test-environment.sh "${{ env.WORLD_DB_ARCHIVE }}" + + - name: Export and verify migrated databases + run: ./.github/scripts/export-and-verify-sql-dumps.sh "${{ github.workspace }}/database-artifacts" diff --git a/.github/workflows/vmangos.yml b/.github/workflows/vmangos.yml deleted file mode 100644 index c891cea18..000000000 --- a/.github/workflows/vmangos.yml +++ /dev/null @@ -1,102 +0,0 @@ -#3 build types -# - gcc under Ubuntu -# - clang under Ubuntu -# - visual studio under Windows -# -# Builds are set to use 2 threads per type -name: vmangos CI build - -on: - push: - paths-ignore: - - '.github/ISSUE_TEMPLATE/**' - - '.github/ISSUE_TEMPLATE.md' - - '.github/PULL_REQUEST_TEMPLATE.md' - - '.github/workflows/db_check.yml' - - '.github/workflows/db_dump.yml' - - 'sql/**' - - 'README.md' - - 'LICENSE' - - '.gitignore' - - 'CONTRIBUTING.md' - - pull_request: - paths-ignore: - - '.github/ISSUE_TEMPLATE/**' - - '.github/ISSUE_TEMPLATE.md' - - '.github/PULL_REQUEST_TEMPLATE.md' - - '.github/workflows/db_check.yml' - - '.github/workflows/db_dump.yml' - - 'sql/**' - - 'README.md' - - 'LICENSE' - - '.gitignore' - - 'CONTRIBUTING.md' - -jobs: - build: - runs-on: ${{ matrix.os }} - permissions: - contents: read - strategy: - #matrix declaration - matrix: - os: [ubuntu-latest] - compiler: [gcc, clang] - include: - - os: windows-2022 - - steps: - - #git checkout - - uses: actions/checkout@v4 - - #before install dependencies - - name: ubuntu dependencies - #ubuntu dependencies - if: matrix.os == 'ubuntu-latest' - run: | - sudo apt-get -qq update - sudo apt-get -qq install build-essential cmake libmysql++-dev libtbb-dev libcurl4-openssl-dev openssl - #windows dependencies - - name: windows dependencies - if: matrix.os == 'windows-2022' - #Sets versions TBB - env: - TBB_VERSION: 2020.3 - - run: | - # Setup TBB - export TBB_ROOT_DIR=$GITHUB_WORKSPACE/tbb - curl -LOJ https://github.com/oneapi-src/oneTBB/releases/download/v$TBB_VERSION/tbb-$TBB_VERSION-win.zip - unzip tbb-$TBB_VERSION-win.zip - rm tbb-$TBB_VERSION-win.zip - #git bash shell - shell: bash - - #build and install - #ubuntu - - name: ubuntu build & install - if: matrix.os == 'ubuntu-latest' - run: | - mkdir build - mkdir _install - cd build - cmake ../ -DCMAKE_INSTALL_PREFIX=../_install -DWITH_WARNINGS=0 -DUSE_EXTRACTORS=1 -DENABLE_MAILSENDER=1 - make -j2 - make install - #windows - - name: windows build & install - if: matrix.os == 'windows-2022' - run: | - # Build CURL - cd $GITHUB_WORKSPACE/dep/windows/optional_dependencies/ - ./curl_download_and_build.bat - # Build actual project - cd $GITHUB_WORKSPACE - mkdir build - cd build - cmake -D TBB_ROOT_DIR=$GITHUB_WORKSPACE/tbb -DWITH_WARNINGS=0 -DUSE_EXTRACTORS=1 -DENABLE_MAILSENDER=1 -G "Visual Studio 17 2022" -A x64 .. - /c/Program\ Files/Microsoft\ Visual\ Studio/2022/Enterprise/MSBuild/Current/Bin/MSBuild.exe "MaNGOS.sln" //p:Platform=x64 //p:Configuration=Release //m:2 - #git bash shell - shell: bash diff --git a/.github/workflows/windows-development-release.yaml b/.github/workflows/windows-development-release.yaml new file mode 100644 index 000000000..96614cf5b --- /dev/null +++ b/.github/workflows/windows-development-release.yaml @@ -0,0 +1,86 @@ +# Build and publish the Windows development release on pushes to development. +name: Windows Development Release + +on: + push: + branches: + - development + paths-ignore: + - '.github/ISSUE_TEMPLATE.md' + - '.github/ISSUE_TEMPLATE/**' + - '.github/PULL_REQUEST_TEMPLATE.md' + - '.github/workflows/development-db-dump.yaml' + - '.github/workflows/pr-sql-check.yaml' + - '.gitignore' + - 'CONTRIBUTING.md' + - 'LICENSE' + - 'README.md' + - 'sql/**' + +concurrency: + group: windows-development-release-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build Windows development release + runs-on: windows-2022 + permissions: + contents: read + + steps: + - name: Check out repository + uses: actions/checkout@v6 + + - name: Build release binaries + shell: bash # Windows runners default to PowerShell. + run: | + set -euo pipefail + mkdir -p build + cd build + cmake -DUSE_EXTRACTORS=1 -G "Visual Studio 17 2022" -A x64 .. + "/c/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/MSBuild.exe" "MaNGOS.sln" //p:Platform=x64 //p:Configuration=Release //m + + - name: Set release archive filename + run: | + echo "ARCHIVE_FILENAME=dev-$(git rev-parse --short HEAD).zip" >> $env:GITHUB_ENV + + - name: Create release archive + run: | + Set-StrictMode -Version Latest + Set-Location "${{ github.workspace }}/bin" + Copy-Item -Force "${{ github.workspace }}/dep/windows/lib/x64_release/libmySQL.dll" "${{ github.workspace }}/bin/Release/libmySQL.dll" + Copy-Item -Force "${{ github.workspace }}/dep/windows/lib/x64_release/libeay32.dll" "${{ github.workspace }}/bin/Release/libeay32.dll" + + 7z a -tzip "${{ env.ARCHIVE_FILENAME }}" Release + + - name: Upload release artifact + uses: actions/upload-artifact@v7 + with: + name: windows-development-build + path: "${{ github.workspace }}/bin/${{ env.ARCHIVE_FILENAME }}" + + publish: + name: Publish Windows development release + needs: build + runs-on: ubuntu-24.04 + permissions: + contents: write + + steps: + - name: Check out repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Download release artifact + uses: actions/download-artifact@v8 + with: + pattern: windows-development-build + merge-multiple: true + path: release-assets + + - name: Publish release snapshot + env: + GH_TOKEN: ${{ github.token }} + run: ./.github/scripts/publish-moving-release.sh latest "Development Build" release-assets diff --git a/README.md b/README.md index f00ffc8d8..c54f1ba36 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![vmangos CI build](https://github.com/vmangos/core/actions/workflows/vmangos.yml/badge.svg)](https://github.com/vmangos/core/actions/workflows/vmangos.yml) +[![CI Build](https://github.com/vmangos/core/actions/workflows/ci-build.yaml/badge.svg)](https://github.com/vmangos/core/actions/workflows/ci-build.yaml) # Progressive Vanilla @@ -24,8 +24,8 @@ This project is an independent continuation of the Elysium / LightsHope codebase - Tools are great: Content creation should not require programming knowledge. We hope to eventually provide tools that allow for user-friendly editing of database scripts and content, with all data presented in human-readable form. ### Downloads -- [![vmangos CI build](https://github.com/vmangos/core/actions/workflows/dev-release.yml/badge.svg)](https://github.com/vmangos/core/releases/tag/latest) Latest development binary -- [![vmangos Development DB Dump](https://github.com/vmangos/core/actions/workflows/db_dump.yml/badge.svg)](https://github.com/vmangos/core/releases/tag/db_latest) mysql5.6 full dump, no update needed. +- [![Windows Development Release](https://github.com/vmangos/core/actions/workflows/windows-development-release.yaml/badge.svg)](https://github.com/vmangos/core/releases/tag/latest) Latest development binary +- [![Development Database Dump](https://github.com/vmangos/core/actions/workflows/development-db-dump.yaml/badge.svg)](https://github.com/vmangos/core/releases/tag/db_latest) mysql5.6 full dump, no update needed. ### Useful Links - [Wiki](https://github.com/vmangos/wiki)