Skip to content

Commit 9907bdc

Browse files
committed
ci: optimize build cache strategies for better performance
- Simplify clcache keys to exclude source file hashes since clcache handles source changes internally - Update Nuitka cache keys to use dependency-based hashing instead of git SHA for better cache reuse - Remove redundant restore-key fallbacks to reduce cache lookup overhead - Add explanatory comments clarifying cache invalidation strategies Improves build performance by enabling more effective cache hits across builds while maintaining appropriate invalidation when dependencies change.
1 parent 6885a70 commit 9907bdc

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,15 @@ jobs:
140140
echo "CLCACHE_HARDLINK=1" >> $GITHUB_ENV # Use hardlinks to save space
141141
mkdir -p "${{ runner.temp }}/clcache"
142142
143-
# Cache clcache for Windows
143+
# Cache clcache for Windows (stable key per platform, clcache handles source changes internally)
144144
- name: Cache clcache (Windows)
145145
if: runner.os == 'Windows'
146146
uses: actions/cache@v4
147147
with:
148148
path: ${{ runner.temp }}/clcache
149-
key: clcache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('src/**/*.py', 'pyproject.toml') }}
149+
key: clcache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('pyproject.toml') }}
150150
restore-keys: |
151151
clcache-${{ matrix.os }}-${{ matrix.arch }}-
152-
clcache-${{ matrix.os }}-
153152
154153
# Configure Nuitka cache directories
155154
- name: Configure Nuitka environment
@@ -163,7 +162,7 @@ jobs:
163162
echo "NUITKA_CACHE_DIR_DLL_DEPENDENCIES=${{ runner.temp }}/nuitka-cache/dll-dependencies" >> $GITHUB_ENV
164163
mkdir -p "${{ runner.temp }}/nuitka-cache"
165164
166-
# Cache Nuitka build directory
165+
# Cache Nuitka build directory (stable key per platform, invalidates only when dependencies/config change)
167166
- name: Cache Nuitka build
168167
uses: actions/cache@v4
169168
with:
@@ -172,10 +171,9 @@ jobs:
172171
intune_manager.dist
173172
intune_manager.onefile-build
174173
${{ runner.temp }}/nuitka-cache
175-
key: nuitka-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }}
174+
key: nuitka-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('pyproject.toml', 'src/intune_manager/__main__.py') }}
176175
restore-keys: |
177176
nuitka-${{ matrix.os }}-${{ matrix.arch }}-
178-
nuitka-${{ matrix.os }}-
179177
180178
- name: Install dependencies
181179
run: uv sync --all-groups

.github/workflows/release.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,15 @@ jobs:
150150
# Increase PCH memory
151151
echo "_CL_=/Zm500" >> $GITHUB_ENV
152152
153-
# Cache clcache for Windows
153+
# Cache clcache for Windows (stable key per platform, clcache handles source changes internally)
154154
- name: Cache clcache (Windows)
155155
if: runner.os == 'Windows'
156156
uses: actions/cache@v4
157157
with:
158158
path: ${{ runner.temp }}/clcache
159-
key: clcache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('src/**/*.py', 'pyproject.toml') }}
159+
key: clcache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('pyproject.toml') }}
160160
restore-keys: |
161161
clcache-${{ matrix.os }}-${{ matrix.arch }}-
162-
clcache-${{ matrix.os }}-
163162
164163
# Configure Nuitka cache directories
165164
- name: Configure Nuitka environment
@@ -173,7 +172,7 @@ jobs:
173172
echo "NUITKA_CACHE_DIR_DLL_DEPENDENCIES=${{ runner.temp }}/nuitka-cache/dll-dependencies" >> $GITHUB_ENV
174173
mkdir -p "${{ runner.temp }}/nuitka-cache"
175174
176-
# Cache Nuitka build directory
175+
# Cache Nuitka build directory (stable key per platform, invalidates only when dependencies/config change)
177176
- name: Cache Nuitka build
178177
uses: actions/cache@v4
179178
with:
@@ -182,10 +181,9 @@ jobs:
182181
src/intune_manager.dist
183182
src/intune_manager.onefile-build
184183
${{ runner.temp }}/nuitka-cache
185-
key: nuitka-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }}
184+
key: nuitka-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('pyproject.toml', 'src/intune_manager/__main__.py') }}
186185
restore-keys: |
187186
nuitka-${{ matrix.os }}-${{ matrix.arch }}-
188-
nuitka-${{ matrix.os }}-
189187
190188
- name: Install dependencies
191189
run: uv sync --all-groups

0 commit comments

Comments
 (0)