serenity/Meta/Azure/Caches.yml
Timothy Flynn 891c4ac68e CI: Bust the toolchain ccache when the toolchain's major version changes
The build will be entirely clean anyways, so no need to preserve the
previous version's ccache.
2024-04-24 16:49:50 -04:00

100 lines
4.4 KiB
YAML

parameters:
os: 'Linux'
arch: 'x86_64'
toolchain: 'gcc'
coverage: 'OFF'
download_cache_path: ''
ccache_version: 1 # Increment this number if CI has trouble with ccache.
serenity_ccache_path: ''
toolchain_ccache_path: ''
with_remote_data_caches: true
steps:
- script: |
echo "##vso[task.setvariable variable=timestamp]$(date -u +"%Y%m%d%H%M_%S")"
displayName: 'Stamps'
- ${{ if ne(parameters.arch, 'Lagom') }}:
- ${{ if eq(parameters.toolchain, 'clang') }}:
- task: Cache@2
inputs:
key: '"toolchain" | "x86_64" | Toolchain/BuildClang.sh | Toolchain/Patches/llvm/*.patch | Toolchain/CMake/*.cmake | Userland/Libraries/LibC/**/*.h'
path: $(Build.SourcesDirectory)/Toolchain/Cache
displayName: 'Toolchain Prebuilt Cache'
- script: |
source $(Build.SourcesDirectory)/Ports/llvm/package.sh
echo "##vso[task.setvariable variable=toolchain_version]$(echo ${version} | cut -d'.' -f1)"
displayName: 'Toolchain Version'
- ${{ if eq(parameters.toolchain, 'gcc') }}:
- task: Cache@2
inputs:
key: '"toolchain" | "${{ parameters.arch }}" | Toolchain/BuildGNU.sh | Toolchain/Patches/binutils/*.patch | Toolchain/Patches/gcc/*.patch | Userland/Libraries/LibC/**/*.h'
path: $(Build.SourcesDirectory)/Toolchain/Cache
displayName: 'Toolchain Prebuilt Cache'
- script: |
source $(Build.SourcesDirectory)/Ports/gcc/package.sh
echo "##vso[task.setvariable variable=toolchain_version]$(echo ${version} | cut -d'.' -f1)"
displayName: 'Toolchain Version'
- ${{ if ne(parameters.toolchain_ccache_path, '') }}:
- task: Cache@2
inputs:
key: '"toolchain ccache" | "x86_64" | "${{ parameters.toolchain }}" | "$(toolchain_version)" | "${{ parameters.ccache_version }}" | "$(timestamp)"'
restoreKeys: |
"toolchain ccache" | "x86_64" | "${{ parameters.toolchain }}" | "$(toolchain_version)" | "${{ parameters.ccache_version }}"
path: ${{ parameters.toolchain_ccache_path }}
displayName: 'Toolchain Compiler Cache'
- script: |
CCACHE_DIR=${{ parameters.toolchain_ccache_path }} ccache -M 0
CCACHE_DIR=${{ parameters.toolchain_ccache_path }} ccache -s
CCACHE_DIR=${{ parameters.toolchain_ccache_path }} ccache -z
displayName: 'Configure Toolchain ccache'
- ${{ if ne(parameters.serenity_ccache_path, '') }}:
- task: Cache@2
inputs:
key: '"ccache" | "${{ parameters.os }}" | "${{ parameters.arch }}" | "${{ parameters.toolchain }}" | "${{ parameters.coverage }}" | "${{ parameters.ccache_version }}" | "$(timestamp)"'
restoreKeys: |
"ccache" | "${{ parameters.os }}" | "${{ parameters.arch }}" | "${{ parameters.toolchain }}" | "${{ parameters.coverage }}" | "${{ parameters.ccache_version }}"
path: ${{ parameters.serenity_ccache_path }}
displayName: 'Serenity Compiler Cache'
- script: |
CCACHE_DIR=${{ parameters.serenity_ccache_path }} ccache -M 0
# Reset all ccache modification dates to a known epoch. This provides a baseline that we can prune against.
find ${{ parameters.serenity_ccache_path }} | tac | xargs touch -a -m -d "2018-10-10T09:53:07Z"
CCACHE_DIR=${{ parameters.serenity_ccache_path }} ccache -s
CCACHE_DIR=${{ parameters.serenity_ccache_path }} ccache -z
displayName: 'Configure Serenity ccache'
- ${{ if eq(parameters.with_remote_data_caches, true) }}:
- task: Cache@2
inputs:
key: '"time_zone_data" | Meta/CMake/time_zone_data.cmake | "$(timestamp)"'
restoreKeys: |
"time_zone_data" | Meta/CMake/time_zone_data.cmake
path: $(Build.SourcesDirectory)/${{ parameters.download_cache_path }}/TZDB
displayName: 'TimeZoneData Cache'
- task: Cache@2
inputs:
key: '"unicode_data" | Meta/CMake/unicode_data.cmake | "$(timestamp)"'
restoreKeys: |
"unicode_data" | Meta/CMake/unicode_data.cmake
path: $(Build.SourcesDirectory)/${{ parameters.download_cache_path }}/UCD
displayName: 'UnicodeData Cache'
- task: Cache@2
inputs:
key: '"unicode_locale" | Meta/CMake/locale_data.cmake | "$(timestamp)"'
restoreKeys: |
"unicode_locale" | Meta/CMake/locale_data.cmake
path: $(Build.SourcesDirectory)/${{ parameters.download_cache_path }}/CLDR
displayName: 'UnicodeLocale Cache'