diff --git a/.github/actions/docker-tag-and-build/action.yml b/.github/actions/docker-tag-and-build/action.yml index 436bf8fd4a..1a9cf8fb6c 100644 --- a/.github/actions/docker-tag-and-build/action.yml +++ b/.github/actions/docker-tag-and-build/action.yml @@ -37,7 +37,13 @@ runs: push: ${{ inputs.push }} tags: ${{ steps.meta.outputs.tags }} target: ${{ inputs.component-name }} + cache-from: type=gha,scope=acore-linux + cache-to: type=gha,scope=acore-linux,mode=max build-args: | USER_ID=1000 GROUP_ID=1000 DOCKER_USER=acore + CCACHE_COMPRESS=1 + CCACHE_COMPRESSLEVEL=9 + CCACHE_COMPILERCHECK=content + CCACHE_MAXSIZE=5G diff --git a/.github/actions/linux-build/action.yml b/.github/actions/linux-build/action.yml index 42938553f2..9be6129cb0 100644 --- a/.github/actions/linux-build/action.yml +++ b/.github/actions/linux-build/action.yml @@ -39,18 +39,12 @@ inputs: runs: using: composite steps: - - name: echo cache key - shell: bash - run: echo "Cache key -> ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }}" - - name: Cache uses: actions/cache@v4 with: path: ${{ github.workspace }}/var/ccache - key: ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }}:${{ github.ref_name }} + key: ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ github.ref_name }} restore-keys: | - ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }}:pch=${{ inputs.pch }} - ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }}:${{ inputs.modules }} ccache:${{ runner.os }}:${{ inputs.CC }}_${{ inputs.CXX }} # This script moves sql files from "data/sql/updates/pending_$DB" to the diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index c01e3ff3cb..731bd37943 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -22,6 +22,13 @@ jobs: name: ${{ matrix.os }} env: BOOST_ROOT: C:\local\boost_1_82_0 + AC_CCACHE: true + CCACHE_DIR: ${{ github.workspace }}/var/ccache + CCACHE_BASEDIR: ${{ github.workspace }} + CCACHE_HASHDIR: 1 + CCACHE_COMPRESS: 1 + CCACHE_COMPRESSLEVEL: 9 + CCACHE_COMPILERCHECK: content if: | github.repository == 'azerothcore/azerothcore-wotlk' && !github.event.pull_request.draft @@ -30,14 +37,34 @@ jobs: - uses: actions/checkout@v4 - name: ccache uses: hendrikmuhs/ccache-action@v1.2.13 + with: + key: windows:${{ github.ref_name }} + max-size: 5G + - name: Prepare ccache directory + shell: bash + run: | + mkdir -p "${CCACHE_DIR}" "${CCACHE_DIR}/tmp" - name: Configure OS shell: bash env: CONTINUOUS_INTEGRATION: true run: | ./acore.sh install-deps + - name: ccache config snapshot + shell: bash + run: | + echo "==== Effective ccache configuration ====" + ccache -p | egrep 'base_dir|hash_dir|compiler_check|sloppiness|max_size' || true + + echo + echo "==== Previous cache stats ====" + ccache -s || true - name: Build shell: bash run: | + set -x export CTOOLS_BUILD=all ./acore.sh compiler build + - name: ccache stats + shell: bash + run: ccache -s || true diff --git a/apps/compiler/includes/functions.sh b/apps/compiler/includes/functions.sh index 4428f9132f..14d686769d 100644 --- a/apps/compiler/includes/functions.sh +++ b/apps/compiler/includes/functions.sh @@ -25,6 +25,14 @@ function comp_clean() { function comp_ccacheEnable() { [ "$AC_CCACHE" != true ] && return + local default_ccache_dir="${CCACHE_DIR:-"$AC_PATH_VAR/ccache"}" + + mkdir -p "$default_ccache_dir" "$default_ccache_dir/tmp" + + export CCACHE_DIR="$default_ccache_dir" + export CCACHE_TEMPDIR=${CCACHE_TEMPDIR:-"$default_ccache_dir/tmp"} + export CCACHE_BASEDIR=${CCACHE_BASEDIR:-"$AC_PATH_ROOT"} + export CCACHE_HASHDIR=${CCACHE_HASHDIR:-1} export CCACHE_MAXSIZE=${CCACHE_MAXSIZE:-'1000MB'} #export CCACHE_DEPEND=true export CCACHE_SLOPPINESS=${CCACHE_SLOPPINESS:-pch_defines,time_macros,include_file_mtime} diff --git a/apps/docker/Dockerfile b/apps/docker/Dockerfile index 0fdee45ceb..0461d32864 100644 --- a/apps/docker/Dockerfile +++ b/apps/docker/Dockerfile @@ -61,6 +61,20 @@ ARG CCACHE_COMPRESS="" ARG CCACHE_COMPRESSLEVEL="9" ARG CCACHE_COMPILERCHECK="content" ARG CCACHE_LOGFILE="" +ARG CCACHE_BASEDIR="/azerothcore" +ARG CCACHE_HASHDIR="1" + +ENV CCACHE_DIR="$CCACHE_DIR" \ + CCACHE_TEMPDIR="$CCACHE_DIR/tmp" \ + CCACHE_BASEDIR="$CCACHE_BASEDIR" \ + CCACHE_HASHDIR="$CCACHE_HASHDIR" \ + CCACHE_CPP2="$CCACHE_CPP2" \ + CCACHE_MAXSIZE="$CCACHE_MAXSIZE" \ + CCACHE_SLOPPINESS="$CCACHE_SLOPPINESS" \ + CCACHE_COMPRESS="$CCACHE_COMPRESS" \ + CCACHE_COMPRESSLEVEL="$CCACHE_COMPRESSLEVEL" \ + CCACHE_COMPILERCHECK="$CCACHE_COMPILERCHECK" \ + CCACHE_LOGFILE="$CCACHE_LOGFILE" RUN apt-get update \ && apt-get install -y --no-install-recommends \ @@ -88,6 +102,7 @@ RUN --mount=type=cache,target=/ccache,sharing=locked \ # of git repo into the container. --mount=type=bind,target=/azerothcore/.git,source=.git \ git config --global --add safe.directory /azerothcore \ + && mkdir -p "$CCACHE_DIR" "$CCACHE_TEMPDIR" \ && cmake /azerothcore \ -DCMAKE_INSTALL_PREFIX="/azerothcore/env/dist" \ -DAPPS_BUILD="all" \ diff --git a/apps/installer/includes/os_configs/windows.sh b/apps/installer/includes/os_configs/windows.sh index cdba50c27f..e387237bfe 100644 --- a/apps/installer/includes/os_configs/windows.sh +++ b/apps/installer/includes/os_configs/windows.sh @@ -27,3 +27,4 @@ choco install -y --skip-checksums "${INSTALL_ARGS[@]}" visualstudio2022-workloa choco install -y --skip-checksums "${INSTALL_ARGS[@]}" openssl --force --version=3.5.4 choco install -y --skip-checksums "${INSTALL_ARGS[@]}" boost-msvc-14.3 --force --version=1.87.0 choco install -y --skip-checksums "${INSTALL_ARGS[@]}" mysql --force --version=8.4.6 +choco install -y --skip-checksums "${INSTALL_ARGS[@]}" ccache