From 966c8e652b7ec95a8799c303aadc6b18d4a3e3d9 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Fri, 26 Jul 2024 12:45:24 +0800 Subject: [PATCH 1/4] [Crash fix] Fix format item crash --- src/ChatHelper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ChatHelper.cpp b/src/ChatHelper.cpp index a181ac89..630bfca9 100644 --- a/src/ChatHelper.cpp +++ b/src/ChatHelper.cpp @@ -336,11 +336,11 @@ std::string const ChatHelper::FormatItem(ItemTemplate const* proto, uint32 count char color[32]; sprintf(color, "%x", ItemQualityColors[proto->Quality]); - const std::string &name = sObjectMgr->GetItemLocale(proto->ItemId)->Name[sWorld->GetDefaultDbcLocale()]; + // const std::string &name = sObjectMgr->GetItemLocale(proto->ItemId)->Name[sWorld->GetDefaultDbcLocale()]; std::ostringstream out; out << "|c" << color << "|Hitem:" << proto->ItemId - << ":0:0:0:0:0:0:0" << "|h[" << name + << ":0:0:0:0:0:0:0" << "|h[" << proto->Name1 << "]|h|r"; if (count > 1) From b2c5885050d0c67ab196b55b6548cd772c5d625d Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Fri, 26 Jul 2024 13:07:31 +0800 Subject: [PATCH 2/4] [CI] CI cache --- .github/workflows/core_build.yml | 9 ++++----- .github/workflows/windows_build.yml | 10 ++-------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index fe4802e5..b0f272f7 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -50,13 +50,12 @@ jobs: path: 'modules/mod-playerbots' - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: - path: | - /var/cache/apt - /var/lib/apt - key: ccache:${{ matrix.os }}:${{ github.ref }}:${{ github.sha }} + path: ${{ github.workspace }}/var/ccache + key: ccache:${{ matrix.os }}:${{ github.ref }}:${{ matrix.c_compiler }}:${{ github.sha }} restore-keys: | + ccache:${{ matrix.os }}:${{ github.ref }}:${{ matrix.c_compiler }} ccache:${{ matrix.os }}:${{ github.ref }} ccache:${{ matrix.os }} diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index d6829895..48d33ba2 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -26,14 +26,8 @@ jobs: with: repository: 'liyunfan1223/mod-playerbots' path: 'modules/mod-playerbots' - - name: Cache - uses: actions/cache@v3 - with: - path: C:\ProgramData\chocolatey\cache - key: ccache:${{ matrix.os }}:${{ github.ref }}:${{ github.sha }} - restore-keys: | - ccache:${{ matrix.os }}:${{ github.ref }} - ccache:${{ matrix.os }} + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2.13 - name: Configure OS shell: bash env: From 278a48260f7067edaa67f73e8ce59a739ce53303 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Fri, 26 Jul 2024 15:00:37 +0800 Subject: [PATCH 3/4] [CI] core_build key order --- .github/workflows/core_build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index b0f272f7..806ee7df 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -53,10 +53,10 @@ jobs: uses: actions/cache@v4 with: path: ${{ github.workspace }}/var/ccache - key: ccache:${{ matrix.os }}:${{ github.ref }}:${{ matrix.c_compiler }}:${{ github.sha }} + key: ccache:${{ matrix.os }}:${{ matrix.c_compiler }}:${{ github.ref }}:${{ github.sha }} restore-keys: | - ccache:${{ matrix.os }}:${{ github.ref }}:${{ matrix.c_compiler }} - ccache:${{ matrix.os }}:${{ github.ref }} + ccache:${{ matrix.os }}:${{ matrix.c_compiler }}:${{ github.ref }} + ccache:${{ matrix.os }}:${{ matrix.c_compiler }} ccache:${{ matrix.os }} - name: Install Requirements From d78eb72b67d142d26ba99dc46ec3e68730d7f194 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Fri, 26 Jul 2024 17:17:05 +0800 Subject: [PATCH 4/4] [CI] ccache for linux build --- .github/workflows/core_build.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index 806ee7df..45de9b47 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -60,7 +60,25 @@ jobs: ccache:${{ matrix.os }} - name: Install Requirements - run: sudo apt-get update && sudo apt-get install git cmake make gcc g++ clang libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev mysql-server libboost-all-dev + run: sudo apt-get update && sudo apt-get install ccache git cmake make gcc g++ clang libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev mysql-server libboost-all-dev + + - name: setup ccache + shell: bash + env: + CCACHE_DIR: $GITHUB_WORKSPACE/var/ccache + run: | + cat <> $GITHUB_ENV + CCACHE_DIR=${{ env.CCACHE_DIR }} + CCACHE_MAXSIZE=1000MB + CCACHE_SLOPPINESS=pch_defines,time_macros,include_file_mtime + CCACHE_CPP2=true + CCACHE_COMPRESS=1 + CCACHE_COMPRESSLEVEL=9 + CCACHE_COMPILERCHECK=content + CCACHE_LOGFILE=$CCACHE_DIR/cache.debug + CC=${{ inputs.CC }} + CXX=${{ inputs.CXX }} + EOF - name: Configure CMake run: > @@ -68,6 +86,8 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" + -DCMAKE_C_COMPILER_LAUNCHER="ccache" -S ${{ github.workspace }} - name: Build