ladybird/.github/actions/cache-restore/action.yml
Timothy Flynn ba36312864 CI: Remove outdated references to Serenity vs. toolchain ccache
The toolchain ccache no longer exists. Remove it and the "Serenity"
prefix from remaining ccache variables.
2024-08-27 19:24:39 -04:00

76 lines
2.6 KiB
YAML

name: 'Cache Restore Action'
description: 'Restores caches of downloaded files and build artifacts.'
author: 'Andrew Kaster <akaster@serenityos.org>'
inputs:
os:
description: 'Operating System to restore caches for'
required: true
default: 'Linux'
arch:
description: 'Target Architecture to restore caches for'
required: false
default: 'x86_64'
toolchain:
description: 'Toolchain to restore caches for (GNU or Clang)'
required: false
default: 'GNU'
cache_key_extra:
description: 'Code coverage setting, ON or OFF, or debug setting, ALL or NORMAL'
required: false
default: 'OFF'
ccache_version:
description: 'Increment this number if CI has trouble with ccache.'
required: false
default: '0'
ccache_path:
description: 'Path to the ccache directory'
required: false
default: ''
download_cache_path:
description: 'Path to the download cache directory'
required: false
default: 'caches'
outputs:
ccache_primary_key:
description: 'Primary ccache key'
value: ${{ steps.ccache.outputs.cache-primary-key }}
runs:
using: "composite"
steps:
- name: 'Date Stamp'
shell: bash
id: 'date-stamp'
run: |
echo "timestamp=$(date -u "+%Y%m%d%H%M_%S")" >> "$GITHUB_OUTPUT"
- name: 'Compiler Cache'
uses: actions/cache/restore@v4
id: 'ccache'
if: ${{ inputs.ccache_path != '' }}
with:
path: ${{ inputs.ccache_path }}
key: '"ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" | ${{ steps.date-stamp.outputs.timestamp }}'
restore-keys: |
"ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}"
- name: 'Configure Compiler Cache'
if: ${{ inputs.ccache_path != '' }}
shell: bash
run: |
CCACHE_DIR=${{ inputs.ccache_path }} 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
- name: Export vcpkg GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');