fix(ci): use fixed path for ccache dir to survive workspace changes
The Gitea runner assigns a different workspace directory hash on each
run (e.g. /var/lib/gitea-runner/.cache/act/<hash>/hostexecutor/). When
CCACHE_DIR was set to ${{ github.workspace }}/.ccache, the actions/cache
save and restore operated on a path that changed every run, making the
restored cache land in the wrong location. This caused 0% hit rate on
the second build despite the cache being saved successfully.
Fix by using a fixed path (/tmp/ccache-kindred-create) for CCACHE_DIR
and the cache action path. CCACHE_BASEDIR remains set to the workspace
so ccache stores relative source paths, making cache entries portable
across different workspace directories.
This commit is contained in:
@@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: app-builder
|
||||
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_DIR: /tmp/ccache-kindred-create
|
||||
CCACHE_COMPRESS: "true"
|
||||
CCACHE_COMPRESSLEVEL: "6"
|
||||
CCACHE_MAXSIZE: "4G"
|
||||
@@ -69,7 +69,7 @@ jobs:
|
||||
id: ccache-restore
|
||||
uses: https://github.com/actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache
|
||||
path: /tmp/ccache-kindred-create
|
||||
key: ccache-build-${{ github.ref_name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
ccache-build-${{ github.ref_name }}-
|
||||
@@ -107,7 +107,7 @@ jobs:
|
||||
if: always()
|
||||
uses: https://github.com/actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache
|
||||
path: /tmp/ccache-kindred-create
|
||||
key: ccache-build-${{ github.ref_name }}-${{ github.sha }}
|
||||
|
||||
- name: Run C++ unit tests
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
runs-on: app-builder
|
||||
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_DIR: /tmp/ccache-kindred-create
|
||||
CCACHE_COMPRESS: "true"
|
||||
CCACHE_COMPRESSLEVEL: "6"
|
||||
CCACHE_MAXSIZE: "4G"
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
id: ccache-restore
|
||||
uses: https://github.com/actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache
|
||||
path: /tmp/ccache-kindred-create
|
||||
key: ccache-release-${{ github.ref_name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
ccache-release-
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
if: always()
|
||||
uses: https://github.com/actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache
|
||||
path: /tmp/ccache-kindred-create
|
||||
key: ccache-release-${{ github.ref_name }}-${{ github.sha }}
|
||||
|
||||
- name: Build .deb package
|
||||
|
||||
Reference in New Issue
Block a user