From 4e068e4c46c6ea2f87621fdbe01a6a487a20715e Mon Sep 17 00:00:00 2001 From: iThorgrim <125808072+iThorgrim@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:28:57 +0100 Subject: [PATCH] chore: Switch re-usable for specific action (#220) --- .github/workflows/build-lua52.yml | 14 +++++ .github/workflows/build-luajit.yml | 14 +++++ .github/workflows/core-build-base.yml | 81 +++++++++++++++++++++++++++ .github/workflows/core_build.yml | 12 ---- 4 files changed, 109 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build-lua52.yml create mode 100644 .github/workflows/build-luajit.yml create mode 100644 .github/workflows/core-build-base.yml delete mode 100644 .github/workflows/core_build.yml diff --git a/.github/workflows/build-lua52.yml b/.github/workflows/build-lua52.yml new file mode 100644 index 0000000000..5fdc1b8ce2 --- /dev/null +++ b/.github/workflows/build-lua52.yml @@ -0,0 +1,14 @@ +name: Build mod-eluna with Lua52 🌙 + +on: + push: + branches: + - 'master' + - 'action' + pull_request: + +jobs: + build_lua52: + uses: ./.github/workflows/core-build-base.yml + with: + lua_version: 'lua52' diff --git a/.github/workflows/build-luajit.yml b/.github/workflows/build-luajit.yml new file mode 100644 index 0000000000..5f19b7625d --- /dev/null +++ b/.github/workflows/build-luajit.yml @@ -0,0 +1,14 @@ +name: Build mod-eluna with LuaJIT 🌙 + +on: + push: + branches: + - 'master' + - 'action' + pull_request: + +jobs: + build_luajit: + uses: ./.github/workflows/core-build-base.yml + with: + lua_version: 'luajit' diff --git a/.github/workflows/core-build-base.yml b/.github/workflows/core-build-base.yml new file mode 100644 index 0000000000..640dec6204 --- /dev/null +++ b/.github/workflows/core-build-base.yml @@ -0,0 +1,81 @@ +name: Build mod-eluna base 🛠️ + +on: + workflow_call: + inputs: + lua_version: + required: true + type: string + +jobs: + install_and_build: + runs-on: ubuntu-24.04 + steps: + - name: Check out AzerothCore 🧑‍💻 + uses: actions/checkout@v4 + with: + repository: 'azerothcore/azerothcore-wotlk' + ref: 'master' + submodules: 'recursive' + + - name: Check out module repository 📂 + uses: actions/checkout@v4 + with: + submodules: 'recursive' + path: 'modules/${{ github.event.repository.name }}' + ref: ${{ github.ref_name }} + + - name: Cache compilation artifacts 💾 + uses: actions/cache@v4 + with: + path: var/ccache + key: ccache:${{ matrix.compiler.CC }}:${{ github.ref }}:${{ github.sha }} + restore-keys: | + ccache:clang-18:${{ github.ref }} + ccache:clang-18 + + - name: Install build dependencies 🧰 + shell: bash + run: | + sudo apt update + sudo apt-get -y install ccache clang cmake curl google-perftools \ + libmysqlclient-dev make unzip build-essential cmake-data \ + libboost-all-dev libbz2-dev libncurses5-dev libmysql++-dev \ + libreadline6-dev libssl-dev libtool openssl zlib1g-dev + + - name: Build mod-eluna with ${{ inputs.lua_version }} 🏗️ + run: | + rm -rf build + mkdir build && cd build + cmake .. \ + -DCMAKE_C_COMPILER=clang-18 \ + -DCMAKE_CXX_COMPILER=clang++-18 \ + -DSCRIPTS="static" \ + -DMODULES="static" \ + -DWITH_WARNINGS="ON" \ + -DCMAKE_BUILD_TYPE="Release" \ + -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ + -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ + -DLUA_VERSION=${{ inputs.lua_version }} + make -j$(nproc) + cd .. + + - name: Run Cppcheck for static code analysis 🔍 + run: | + sudo apt update -y + sudo apt install -y cppcheck + cd modules/${{ github.event.repository.name }} + cppcheck -j$(nproc) --force --inline-suppr \ + -I src/LuaEngine/ \ + -I src/ \ + --suppress=*:src/lualib/* \ + --suppress=*:src/LuaEngine/libs/* \ + --output-file=report.txt \ + . + if [ -s report.txt ]; then + echo "Cppcheck detected issues 🚨:" + cat report.txt + exit 1 + else + echo "No issues detected by cppcheck ✅." + fi diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml deleted file mode 100644 index 921c9eb4e4..0000000000 --- a/.github/workflows/core_build.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: core-build -on: - push: - branches: - - 'master' - pull_request: - -jobs: - build: - uses: azerothcore/reusable-workflows/.github/workflows/core_build_modules.yml@main - with: - module_repo: ${{ github.event.repository.name }}