Skip to content
This repository was archived by the owner on Nov 1, 2025. It is now read-only.

Commit c2d11d8

Browse files
committed
ci(build): fix cache ccache logic
1 parent 24ccb49 commit c2d11d8

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,19 @@ jobs:
176176
ccache --set-config=hash_dir=false
177177
ccache --set-config=sloppiness=file_macro,include_file_ctime,include_file_mtime,time_macros
178178
ccache --set-config=direct_mode=true
179-
ccache --set-config=max_size=5G
179+
ccache --set-config=max_size=7G
180180
ccache --zero-stats
181181
ccache --show-config
182+
echo "clang_hash=$(clang --version | sha256sum | cut -c1-10 || echo none)" >> "$GITHUB_ENV"
182183
183184
- name: Restore ccache
184-
uses: actions/cache@v4
185+
id: restore-ccache
186+
uses: actions/cache/restore@v4
185187
with:
186188
path: ${{ env.CCACHE_DIR }}
187-
key: ccache-${{ runner.os }}-${{ github.ref_name }}-${{ github.run_id }}
189+
key: ccache-${{ runner.os }}-${{ env.clang_hash }}-${{ inputs.KSU }}-${{ inputs.SUSFS }}-${{ inputs.LXC }}
188190
restore-keys: |
189-
ccache-${{ runner.os }}-${{ github.ref_name }}-
190-
ccache-${{ runner.os }}-
191+
ccache-${{ runner.os }}-${{ env.clang_hash }}-
191192
192193
- name: Build
193194
env:
@@ -199,12 +200,12 @@ jobs:
199200
./cli.sh build
200201
201202
- name: Save ccache
202-
if: always()
203+
if: ${{ always() && steps.restore_ccache.outputs.cache-hit != 'true' }}
203204
uses: actions/cache/save@v4
204205
with:
205206
path: ${{ env.CCACHE_DIR }}
206-
key: ccache-${{ runner.os }}-${{ github.ref_name }}-${{ github.run_id }}-${{ inputs.KSU }}-${{ inputs.SUSFS }}-${{ inputs.LXC }}
207-
207+
key: ccache-${{ runner.os }}-${{ env.clang_hash }}-${{ inputs.KSU }}-${{ inputs.SUSFS }}-${{ inputs.LXC }}
208+
208209
- name: Import exported environment
209210
id: import_env
210211
run: |

0 commit comments

Comments
 (0)