CI: Enable compiler cache for Windows

This commit is contained in:
ayeteadoe 2025-08-03 16:57:18 -07:00 committed by Jelle Raaijmakers
commit da2969008b
Notes: github-actions[bot] 2025-08-04 20:07:14 +00:00
3 changed files with 32 additions and 9 deletions

View file

@ -67,16 +67,35 @@ runs:
"ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}"
- name: 'Configure Compiler Cache'
if: ${{ inputs.ccache_path != '' }}
if: ${{ inputs.os != 'Windows' && inputs.ccache_path != '' }}
shell: bash
env:
CCACHE_DIR: ${{ inputs.ccache_path }}
run: |
CCACHE_DIR=${{ inputs.ccache_path }} ccache -M 0
ccache -M 0
# Reset all ccache modification dates to a known epoch. This provides a baseline that we can prune against.
find ${{ inputs.ccache_path }} | tac | xargs touch -a -m -d "2018-10-10T09:53:07Z"
CCACHE_DIR=${{ inputs.ccache_path }} ccache -s
CCACHE_DIR=${{ inputs.ccache_path }} ccache -z
ccache -s
ccache -z
- name: 'Configure Compiler Cache (Windows)'
if: ${{ inputs.os == 'Windows' && inputs.ccache_path != '' }}
shell: pwsh
env:
CCACHE_DIR: ${{ inputs.ccache_path }}
run: |
ccache -M 0
# Reset all ccache modification dates to a known epoch. This provides a baseline that we can prune against.
Get-ChildItem -Path "${{ inputs.ccache_path }}" -Recurse | Sort-Object FullName -Descending | ForEach-Object {
$_.LastWriteTime = [DateTime]::Parse("2018-10-10T09:53:07Z")
$_.LastAccessTime = [DateTime]::Parse("2018-10-10T09:53:07Z")
}
ccache -s
ccache -z
- name: 'Restore vcpkg cache'
uses: actions/cache/restore@v4

View file

@ -32,9 +32,11 @@ runs:
steps:
- name: 'Prune obsolete ccache files'
shell: bash
env:
CCACHE_DIR: ${{ inputs.ccache_path }}
if: ${{ inputs.ccache_path != '' }}
run: |
CCACHE_DIR=${{ inputs.ccache_path }} ccache --evict-older-than=1d
ccache --evict-older-than=1d
- name: 'Compiler Cache'
uses: actions/cache/save@v4
@ -45,9 +47,11 @@ runs:
- name: 'Cache Stats'
shell: bash
env:
CCACHE_DIR: ${{ inputs.ccache_path }}
if: ${{ inputs.ccache_path != '' }}
run: |
CCACHE_DIR=${{ inputs.ccache_path }} ccache -s
ccache -s
- name: 'vcpkg binary cache'
uses: actions/cache/save@v4

View file

@ -28,7 +28,7 @@ env:
# github.workspace = /home/runner/work/ladybird/ladybird
LADYBIRD_SOURCE_DIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
VCPKG_ROOT: ${{ github.workspace }}/Build/vcpkg
VCPKG_ROOT: ${{ github.workspace }}/Build/vcpkg
# Use the compiler version for the ccache compiler hash. Otherwise, if plugins are enabled, the plugin .so files
# are included in the hash. This results in clean builds on every run as the .so files are rebuilt.
@ -109,7 +109,7 @@ jobs:
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
cache_key_extra: ${{ inputs.os_name == 'Windows' && inputs.build_preset || steps.build-parameters.outputs.ccache_key }}
ccache_path: ${{ inputs.os_name != 'Windows' && env.CCACHE_DIR }}
ccache_path: ${{ env.CCACHE_DIR }}
download_cache_path: ${{ github.workspace }}/Build/caches
vcpkg_cache_path: ${{ github.workspace }}/Build/caches/vcpkg-binary-cache
@ -189,7 +189,7 @@ jobs:
with:
runner_labels: ${{ inputs.runner_labels }}
arch: ${{ inputs.arch }}
ccache_path: ${{ inputs.os_name != 'Windows' && env.CCACHE_DIR }}
ccache_path: ${{ env.CCACHE_DIR }}
ccache_primary_key: ${{ steps.cache-restore.outputs.ccache_primary_key }}
vcpkg_cache_path: ${{ github.workspace }}/Build/caches/vcpkg-binary-cache
vcpkg_cache_primary_key: ${{ steps.cache-restore.outputs.vcpkg_cache_primary_key }}