[Perf] (CI): rewrite one rolling ccache entry per job on the default branch instead of saving one per run

This commit is contained in:
2026-08-12 01:56:17 -04:00
parent 205d837942
commit 64a0ea397c
2 changed files with 74 additions and 9 deletions
+27 -3
View File
@@ -11,6 +11,9 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
actions: write
contents: read
env: env:
CCACHE_BASEDIR: ${{ github.workspace }} CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_COMPRESS: "true" CCACHE_COMPRESS: "true"
@@ -41,12 +44,11 @@ jobs:
gradle-version: 8.10.2 gradle-version: 8.10.2
- name: Restore ccache - name: Restore ccache
uses: actions/cache@v5 uses: actions/cache/restore@v5
with: with:
path: .ccache path: .ccache
key: ${{ runner.os }}-apk-${{ github.job }}-ccache-${{ github.ref_name }}-${{ github.run_id }} key: ${{ runner.os }}-apk-${{ github.job }}-ccache-v1
restore-keys: | restore-keys: |
${{ runner.os }}-apk-${{ github.job }}-ccache-${{ github.ref_name }}-
${{ runner.os }}-apk-${{ github.job }}-ccache- ${{ runner.os }}-apk-${{ github.job }}-ccache-
- name: Install ccache - name: Install ccache
@@ -125,6 +127,28 @@ jobs:
if: always() if: always()
run: ccache --show-stats run: ccache --show-stats
# Rewrite one rolling entry per job on the default branch. The upload stays
# cumulative - it carries every object restored at the top of this run plus
# the few TUs that actually changed - but Actions cache keys are immutable,
# so the superseded blob has to be released before the same key can be
# re-uploaded. Running after the build means a failed build leaves the
# existing entry untouched. The other trigger branches restore this entry
# rather than each writing a ~4 GB one of their own.
- name: Release superseded ccache entry
if: github.ref_name == github.event.repository.default_branch
env:
GH_TOKEN: ${{ github.token }}
CACHE_KEY: ${{ runner.os }}-apk-${{ github.job }}-ccache-v1
run: gh cache delete "${CACHE_KEY}" || true
- name: Save ccache
if: github.ref_name == github.event.repository.default_branch
continue-on-error: true
uses: actions/cache/save@v5
with:
path: .ccache
key: ${{ runner.os }}-apk-${{ github.job }}-ccache-v1
- name: Verify APK metadata and packaging - name: Verify APK metadata and packaging
run: | run: |
AAPT2="$(find "$ANDROID_HOME/build-tools" -name aapt2 -type f | sort -V | tail -n 1)" AAPT2="$(find "$ANDROID_HOME/build-tools" -name aapt2 -type f | sort -V | tail -n 1)"
+47 -6
View File
@@ -11,6 +11,9 @@ on:
jobs: jobs:
build-linux: build-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
actions: write
contents: read
env: env:
BUILD_DIR: build-linux BUILD_DIR: build-linux
CCACHE_BASEDIR: ${{ github.workspace }} CCACHE_BASEDIR: ${{ github.workspace }}
@@ -34,12 +37,11 @@ jobs:
uses: lukka/get-cmake@v4.3.3 uses: lukka/get-cmake@v4.3.3
- name: Restore ccache - name: Restore ccache
uses: actions/cache@v5 uses: actions/cache/restore@v5
with: with:
path: .ccache path: .ccache
key: ${{ runner.os }}-test-${{ github.job }}-ccache-${{ github.ref_name }}-${{ github.run_id }} key: ${{ runner.os }}-test-${{ github.job }}-ccache-v1
restore-keys: | restore-keys: |
${{ runner.os }}-test-${{ github.job }}-ccache-${{ github.ref_name }}-
${{ runner.os }}-test-${{ github.job }}-ccache- ${{ runner.os }}-test-${{ github.job }}-ccache-
- name: Prepare Vulkan SDK - name: Prepare Vulkan SDK
@@ -97,6 +99,28 @@ jobs:
if: always() if: always()
run: ccache --show-stats run: ccache --show-stats
# Rewrite one rolling entry per job on the default branch. The upload stays
# cumulative - it carries every object restored at the top of this run plus
# the few TUs that actually changed - but Actions cache keys are immutable,
# so the superseded blob has to be released before the same key can be
# re-uploaded. Running after the build means a failed build leaves the
# existing entry untouched. The other trigger branches restore this entry
# rather than each writing one of their own.
- name: Release superseded ccache entry
if: github.ref_name == github.event.repository.default_branch
env:
GH_TOKEN: ${{ github.token }}
CACHE_KEY: ${{ runner.os }}-test-${{ github.job }}-ccache-v1
run: gh cache delete "${CACHE_KEY}" || true
- name: Save ccache
if: github.ref_name == github.event.repository.default_branch
continue-on-error: true
uses: actions/cache/save@v5
with:
path: .ccache
key: ${{ runner.os }}-test-${{ github.job }}-ccache-v1
- name: Package Linux runtime - name: Package Linux runtime
run: | run: |
mkdir -p ci-artifacts mkdir -p ci-artifacts
@@ -320,6 +344,9 @@ jobs:
- build-linux - build-linux
- test - test
- benchmark - benchmark
permissions:
actions: write
contents: read
env: env:
BUILD_DIR: build-retrace BUILD_DIR: build-retrace
CCACHE_BASEDIR: ${{ github.workspace }} CCACHE_BASEDIR: ${{ github.workspace }}
@@ -344,12 +371,11 @@ jobs:
uses: lukka/get-cmake@v4.3.3 uses: lukka/get-cmake@v4.3.3
- name: Restore ccache - name: Restore ccache
uses: actions/cache@v5 uses: actions/cache/restore@v5
with: with:
path: .ccache path: .ccache
key: ${{ runner.os }}-test-${{ github.job }}-ccache-${{ github.ref_name }}-${{ github.run_id }} key: ${{ runner.os }}-test-${{ github.job }}-ccache-v1
restore-keys: | restore-keys: |
${{ runner.os }}-test-${{ github.job }}-ccache-${{ github.ref_name }}-
${{ runner.os }}-test-${{ github.job }}-ccache- ${{ runner.os }}-test-${{ github.job }}-ccache-
- name: Prepare Vulkan SDK - name: Prepare Vulkan SDK
@@ -415,6 +441,21 @@ jobs:
if: always() if: always()
run: ccache --show-stats run: ccache --show-stats
- name: Release superseded ccache entry
if: github.ref_name == github.event.repository.default_branch
env:
GH_TOKEN: ${{ github.token }}
CACHE_KEY: ${{ runner.os }}-test-${{ github.job }}-ccache-v1
run: gh cache delete "${CACHE_KEY}" || true
- name: Save ccache
if: github.ref_name == github.event.repository.default_branch
continue-on-error: true
uses: actions/cache/save@v5
with:
path: .ccache
key: ${{ runner.os }}-test-${{ github.job }}-ccache-v1
- name: Normalize CTest command paths - name: Normalize CTest command paths
run: | run: |
python - <<'PY' python - <<'PY'