Skip to content

Commit 68d6daf

Browse files
Use separate cache restore/save with unique keys per run
1 parent bd90ae8 commit 68d6daf

File tree

1 file changed

+67
-11
lines changed

1 file changed

+67
-11
lines changed

β€Ž.github/workflows/dev-release.ymlβ€Ž

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,39 @@ jobs:
4444
git submodule update --init --recursive
4545
echo "βœ… Submodules checked out"
4646
47-
- name: Cache downloads
48-
uses: actions/cache@v4
47+
# Try to restore downloads cache
48+
- name: Restore downloads cache
49+
id: cache-downloads-restore
50+
uses: actions/cache/restore@v4
4951
with:
5052
path: build/download
51-
key: lithosphere-downloads-${{ hashFiles('.gitmodules') }}
53+
key: downloads-${{ hashFiles('.gitmodules') }}
5254
restore-keys: |
53-
lithosphere-downloads-
54-
enableCrossOsArchive: true
55+
downloads-
5556
56-
- name: Cache ccache (armv7)
57-
uses: actions/cache@v4
57+
# Try to restore ccache
58+
- name: Restore ccache
59+
id: cache-ccache-restore
60+
uses: actions/cache/restore@v4
5861
with:
5962
path: build/ccache
60-
key: lithosphere-ccache-armv7-${{ hashFiles('.gitmodules') }}
63+
key: ccache-armv7-${{ hashFiles('.gitmodules') }}
6164
restore-keys: |
62-
lithosphere-ccache-armv7-
63-
enableCrossOsArchive: true
64-
65+
ccache-armv7-
66+
67+
- name: Cache status
68+
run: |
69+
echo "πŸ“Š Cache Restore Status:"
70+
echo "Downloads cache hit: ${{ steps.cache-downloads-restore.outputs.cache-hit }}"
71+
echo "Downloads cache key: ${{ steps.cache-downloads-restore.outputs.cache-matched-key || 'none' }}"
72+
echo "ccache hit: ${{ steps.cache-ccache-restore.outputs.cache-hit }}"
73+
echo "ccache key: ${{ steps.cache-ccache-restore.outputs.cache-matched-key || 'none' }}"
74+
echo ""
75+
echo "πŸ“ Checking directories:"
76+
ls -lah build/ 2>/dev/null || echo "build/ doesn't exist"
77+
du -sh build/download 2>/dev/null || echo "build/download doesn't exist"
78+
du -sh build/ccache 2>/dev/null || echo "build/ccache doesn't exist"
79+
6580
- name: Install dependencies
6681
run: |
6782
sudo apt-get -qq update
@@ -106,6 +121,11 @@ jobs:
106121
time make -C build/$CONFIG_NAME source
107122
108123
echo "βœ… Package download complete"
124+
echo ""
125+
echo "πŸ“Š Download cache size:"
126+
du -sh build/download
127+
echo "Files in download cache:"
128+
find build/download -type f | wc -l
109129
110130
- name: Build ${{ env.CONFIG_NAME }}
111131
run: |
@@ -127,6 +147,9 @@ jobs:
127147
time make -C build/$CONFIG_NAME
128148
129149
echo "βœ… Build completed at $(date)"
150+
echo ""
151+
echo "πŸ“Š ccache size:"
152+
du -sh build/ccache
130153
131154
- name: Show build artifacts
132155
run: |
@@ -138,6 +161,35 @@ jobs:
138161
echo "πŸ“Š ccache Statistics:"
139162
./build/$CONFIG_NAME/host/usr/bin/ccache -s
140163
164+
- name: Final cache sizes
165+
run: |
166+
echo "πŸ“Š Final cache directory sizes before saving:"
167+
echo ""
168+
echo "Downloads cache:"
169+
du -sh build/download
170+
echo ""
171+
echo "ccache:"
172+
du -sh build/ccache
173+
echo ""
174+
echo "Total build directory:"
175+
du -sh build/
176+
177+
# Save downloads cache (always, even if it existed)
178+
- name: Save downloads cache
179+
uses: actions/cache/save@v4
180+
if: always()
181+
with:
182+
path: build/download
183+
key: downloads-${{ hashFiles('.gitmodules') }}-${{ github.run_id }}
184+
185+
# Save ccache (always, even if it existed)
186+
- name: Save ccache
187+
uses: actions/cache/save@v4
188+
if: always()
189+
with:
190+
path: build/ccache
191+
key: ccache-armv7-${{ hashFiles('.gitmodules') }}-${{ github.run_id }}
192+
141193
- name: Compress image
142194
run: |
143195
echo "πŸ—œοΈ Compressing image at $(date)..."
@@ -225,4 +277,8 @@ jobs:
225277
echo "πŸ“¦ Artifact: ${CONFIG_NAME}-${{ steps.ref.outputs.ref }}-sdcard.img.xz"
226278
echo "πŸ”— Release: https://github.com/WebPlatformForEmbedded/lithosphere/releases/tag/${{ github.ref_name }}"
227279
echo ""
280+
echo "πŸ“Š Cache Status:"
281+
echo "Downloads: ${{ steps.cache-downloads-restore.outputs.cache-hit == 'true' && 'βœ… HIT' || '❌ MISS' }}"
282+
echo "ccache: ${{ steps.cache-ccache-restore.outputs.cache-hit == 'true' && 'βœ… HIT' || '❌ MISS' }}"
283+
echo ""
228284
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

0 commit comments

Comments
Β (0)