diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 5484e59596598..0522459804398 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -29,6 +29,7 @@ jobs: id: get-vars run: | echo "datetime=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT + echo "datetime-seconds=$(/bin/date +%s)" >> $GITHUB_OUTPUT echo "ccache-path=$(echo '~/.cache/ccache')" >> $GITHUB_OUTPUT - name: ccache cache files @@ -53,7 +54,7 @@ jobs: export EM_CONFIG=$EMSDK/.emscripten export CCACHE_COMPILERCHECK=string:3.1.51 ccache --zero-stats - ccache -M 5G + ccache -M 20G ccache --show-stats ./build-scripts/build-emscripten.sh @@ -63,7 +64,11 @@ jobs: emsdk activate ccache-git-emscripten-64bit export PATH="${PATH%%:*}/../../ccache/git-emscripten_64bit/bin":$PATH ccache --show-stats - ccache -M 5G + NOW=`/bin/date +%s` + DELTA=$(( $NOW - ${{ steps.get-vars.outputs.datetime-seconds }} )) + ccache --evict-older-than ${DELTA}s + ccache --show-stats + ccache -M 1G ccache -c ccache --show-stats diff --git a/.github/workflows/matrix.yml b/.github/workflows/matrix.yml index f3a4bc6a4c2ff..4e2b8867558db 100644 --- a/.github/workflows/matrix.yml +++ b/.github/workflows/matrix.yml @@ -94,7 +94,7 @@ jobs: dont_skip_data_only_changes: 1 mods: --mods=magiclysm title: Basic Build and Test (Clang 10, Ubuntu, Curses) - ccache_limit: 5G + ccache_limit: 4.5G ccache_key: linux-llvm-10-break1 - compiler: clang++ @@ -106,7 +106,7 @@ jobs: sound: 1 localize: 1 title: Clang 14, macOS 12, Tiles, Sound, x64 and arm64 Universal Binary - ccache_limit: 6G + ccache_limit: 10G ccache_key: macos-llvm-14-universal-break1 - compiler: g++-9 @@ -122,7 +122,7 @@ jobs: pch: 1 cxxflags: -gsplit-dwarf title: GCC 9, Curses, LTO - ccache_limit: 4.5G + ccache_limit: 7.5G ccache_key: linux-gcc-9-lto - compiler: clang++-12 @@ -137,7 +137,7 @@ jobs: cxxflags: --gcc-toolchain=/opt/mock-gcc-11 dont_skip_data_only_changes: 1 title: Clang 12, Ubuntu, Tiles, ASan - ccache_limit: 4.5G + ccache_limit: 6G ccache_key: linux-llvm-12-asan - compiler: g++-11 @@ -150,7 +150,7 @@ jobs: pch: 1 sanitize: address title: GCC 11, Ubuntu, Curses, ASan - ccache_limit: 6G + ccache_limit: 6.5G ccache_key: linux-gcc-11-asan - compiler: g++-9 @@ -162,7 +162,7 @@ jobs: native: linux64 pch: 1 title: GCC 9, Ubuntu, Tiles, Sound, CMake - ccache_limit: 3G + ccache_limit: 1G ccache_key: linux-gcc-9-cmake name: ${{ matrix.title }} @@ -221,11 +221,12 @@ jobs: if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && matrix.tiles == 1 }} run: | sudo apt-get install libflac-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libpulse-dev - - name: install recent ccache on ubuntu 20.04 - if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && matrix.os == 'ubuntu-20.04' }} + - name: install recent ccache on ubuntu + if: ${{ env.SKIP == 'false' && runner.os == 'Linux' }} run: | + ccache --version sudo apt-get remove --purge -y ccache - curl -sL https://github.com/ccache/ccache/releases/download/v4.8.3/ccache-4.8.3-linux-x86_64.tar.xz | sudo tar Jxvf - --strip-components 1 -C /usr/bin ccache-4.8.3-linux-x86_64/ccache + curl -sL https://github.com/ccache/ccache/releases/download/v4.10.2/ccache-4.10.2-linux-x86_64.tar.xz | sudo tar Jxvf - --strip-components 1 -C /usr/bin ccache-4.10.2-linux-x86_64/ccache ccache --version - name: install Clang 12 (Ubuntu) if: ${{ env.SKIP == 'false' && runner.os == 'Linux' && (matrix.compiler == 'clang++-12') }} @@ -264,6 +265,7 @@ jobs: if: ${{ env.SKIP == 'false' }} run: | echo "datetime=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT + echo "datetime-seconds=$(/bin/date +%s)" >> $GITHUB_OUTPUT echo "ccache-path=$([ "$RUNNER_OS" = "macOS" ] && echo '/Users/runner/Library/Caches/ccache' || echo '~/.cache/ccache')" >> $GITHUB_OUTPUT shell: bash - name: ccache cache files @@ -282,6 +284,10 @@ jobs: - name: post-build ccache manipulation if: ${{ env.SKIP == 'false' && !failure() && (runner.os == 'Linux' || runner.os == 'macOS') }} run: | + ccache --show-stats --verbose + NOW=`/bin/date +%s` + DELTA=$(( $NOW - ${{ steps.get-vars.outputs.datetime-seconds }} )) + ccache --evict-older-than ${DELTA}s ccache --show-stats --verbose ccache -M ${{ env.CCACHE_LIMIT }} ccache -c diff --git a/.github/workflows/msvc-full-features.yml b/.github/workflows/msvc-full-features.yml index bf9984490b30f..1f5740b59bc75 100644 --- a/.github/workflows/msvc-full-features.yml +++ b/.github/workflows/msvc-full-features.yml @@ -111,6 +111,7 @@ jobs: id: get-vars run: | echo "datetime=$(/bin/date -u "+%Y%m%d%H%M")" >> $GITHUB_OUTPUT + echo "datetime-seconds=$(/bin/date +%s)" >> $GITHUB_OUTPUT echo "ccache-path=$(echo "$APPDATA\\ccache")" >> $GITHUB_OUTPUT shell: bash @@ -138,9 +139,19 @@ jobs: run: | msbuild -m -p:Configuration=Release -p:Platform=x64 "-target:Cataclysm-vcpkg-static;Cataclysm-test-vcpkg-static;JsonFormatter-vcpkg-static" msvc-full-features/Cataclysm-vcpkg-static.sln + - name: Get ccache cache age cutoff + id: get-cache-age + run: | + NOW=`/bin/date +%s` + DELTA=$(( $NOW - ${{ steps.get-vars.outputs.datetime-seconds }} )) + echo "ccache-age=$(( $NOW - ${{ steps.get-vars.outputs.datetime-seconds }} ))" >> $GITHUB_OUTPUT + shell: bash + - name: Post-build ccache manipulation if: ${{ !failure() }} run: | + ${{ env.CDDA_CCACHE_PATH }}\ccache.exe -s -v + ${{ env.CDDA_CCACHE_PATH }}\ccache.exe --evict-older-than ${{ steps.get-ccache-age.outputs.ccache-age }} ${{ env.CDDA_CCACHE_PATH }}\ccache.exe -s -v ${{ env.CDDA_CCACHE_PATH }}\ccache.exe -M ${{ env.CCACHE_LIMIT }} ${{ env.CDDA_CCACHE_PATH }}\ccache.exe -c diff --git a/build-scripts/build.sh b/build-scripts/build.sh index abea7cd9c3cf0..6402d1cb4dbf4 100755 --- a/build-scripts/build.sh +++ b/build-scripts/build.sh @@ -40,7 +40,7 @@ fi ccache --zero-stats # Increase cache size because debug builds generate large object files -ccache -M 10G +ccache -M 20G ccache --show-stats --verbose function run_test diff --git a/build-scripts/gha_compile_only.sh b/build-scripts/gha_compile_only.sh index 5f28f14d34616..317fac6785485 100755 --- a/build-scripts/gha_compile_only.sh +++ b/build-scripts/gha_compile_only.sh @@ -40,7 +40,7 @@ fi ccache --zero-stats # Increase cache size because debug builds generate large object files -ccache -M 10G +ccache -M 20G ccache --show-stats --verbose if [ "$CMAKE" = "1" ]