@@ -53,28 +53,51 @@ jobs:
5353 zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}-
5454 zephyr-minimal-
5555
56- # Initialize git submodules with cache restoration
56+ # Initialize git submodules with robust cache handling
5757 - name : Initialize Git Submodules
5858 run : |
5959 echo "Setting up git submodules..."
6060
61- # First, ensure git knows about the submodules
62- git submodule init
63-
61+ # Check if we have cached content
6462 if [ "${{ steps.cache-submodules.outputs.cache-hit }}" == "true" ]; then
65- echo "✓ Submodules restored from cache, syncing URLs and updating..."
66- # Sync URLs in case they changed
67- git submodule sync --recursive
68- # Update with existing cached content
69- git submodule update --recursive
63+ echo "✓ Submodules restored from cache"
64+
65+ # Verify cached content is valid by checking for key files
66+ valid_cache=true
67+
68+ if [ ! -f "lib/fprime/CMakeLists.txt" ]; then
69+ echo "⚠️ fprime cache invalid, will re-download"
70+ valid_cache=false
71+ fi
72+
73+ if [ ! -f "lib/fprime-zephyr/CMakeLists.txt" ]; then
74+ echo "⚠️ fprime-zephyr cache invalid, will re-download"
75+ valid_cache=false
76+ fi
77+
78+ if [ ! -f "lib/zephyr-workspace/zephyr/CMakeLists.txt" ]; then
79+ echo "⚠️ zephyr cache invalid, will re-download"
80+ valid_cache=false
81+ fi
82+
83+ if [ "$valid_cache" = "true" ]; then
84+ echo "✓ All cached submodules are valid"
85+ # Initialize git tracking for the cached content
86+ git submodule init || true
87+ git submodule sync || true
88+ else
89+ echo "Cached content invalid, clearing and re-downloading..."
90+ rm -rf lib/fprime lib/fprime-zephyr lib/zephyr-workspace/zephyr
91+ git submodule update --init --recursive
92+ fi
7093 else
7194 echo "Cache miss - downloading submodules..."
72- git submodule update --recursive
95+ git submodule update --init -- recursive
7396 fi
7497
7598 # Verify submodules are working
7699 echo "Verifying submodules:"
77- git submodule status
100+ git submodule status || echo "Submodule status check failed, but content should be available"
78101
79102 - name : Setup minimal Zephyr environment
80103 if : steps.cache-zephyr.outputs.cache-hit != 'true'
0 commit comments