Skip to content

Commit 0a06388

Browse files
committed
Attempting to Cache Submodules
1 parent 38e0890 commit 0a06388

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
- name: Checkout repository
2323
uses: actions/checkout@v4
2424
with:
25-
submodules: false # We'll handle submodules with caching
25+
submodules: false # We'll handle submodules with smart caching
2626
fetch-depth: 0
2727

28-
# Cache git submodules (fprime, fprime-zephyr, zephyr base)
28+
# Cache git submodules content
2929
- name: Cache Git Submodules
3030
id: cache-submodules
3131
uses: actions/cache@v4
@@ -34,12 +34,12 @@ jobs:
3434
lib/fprime
3535
lib/fprime-zephyr
3636
lib/zephyr-workspace/zephyr
37-
key: git-submodules-${{ hashFiles('.gitmodules') }}-${{ runner.os }}-v1
37+
key: git-submodules-${{ hashFiles('.gitmodules') }}-v2
3838
restore-keys: |
39-
git-submodules-${{ hashFiles('.gitmodules') }}-${{ runner.os }}-
39+
git-submodules-${{ hashFiles('.gitmodules') }}-
4040
git-submodules-
4141
42-
# Cache Zephyr west modules and SDK
42+
# Cache Zephyr west modules and SDK (the slow parts)
4343
- name: Cache Zephyr workspace and SDK
4444
id: cache-zephyr
4545
uses: actions/cache@v4
@@ -53,12 +53,22 @@ jobs:
5353
zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}-
5454
zephyr-minimal-
5555
56-
# Initialize git submodules if not cached
56+
# Initialize git submodules with cache restoration
5757
- name: Initialize Git Submodules
58-
if: steps.cache-submodules.outputs.cache-hit != 'true'
5958
run: |
60-
echo "Initializing git submodules (not found in cache)..."
61-
git submodule update --init --recursive
59+
if [ "${{ steps.cache-submodules.outputs.cache-hit }}" == "true" ]; then
60+
echo "✓ Submodules restored from cache, reinitializing git references..."
61+
# The cached directories exist but .git files have wrong paths
62+
# Force reinitialize to fix the .git file references
63+
git submodule update --init --recursive --force
64+
else
65+
echo "Cache miss - downloading submodules..."
66+
git submodule update --init --recursive
67+
fi
68+
69+
# Verify submodules are working
70+
echo "Verifying submodules:"
71+
git submodule status
6272
6373
- name: Setup minimal Zephyr environment
6474
if: steps.cache-zephyr.outputs.cache-hit != 'true'
@@ -87,17 +97,20 @@ jobs:
8797
8898
- name: Display setup statistics
8999
run: |
90-
echo "=== Zephyr Setup Statistics ==="
100+
echo "=== Setup Statistics ==="
91101
echo "Git submodules cache hit: ${{ steps.cache-submodules.outputs.cache-hit }}"
92102
echo "Zephyr modules cache hit: ${{ steps.cache-zephyr.outputs.cache-hit }}"
93-
echo "Git submodules size: $(du -sh lib/fprime lib/fprime-zephyr lib/zephyr-workspace/zephyr 2>/dev/null | awk '{total+=$1} END {print total}' || echo 'N/A')"
94-
echo "Zephyr modules size: $(du -sh lib/zephyr-workspace/modules lib/zephyr-workspace/bootloader 2>/dev/null | awk '{total+=$1} END {print total}' || echo 'N/A')"
103+
echo ""
104+
echo "Submodule sizes:"
105+
du -sh lib/fprime lib/fprime-zephyr lib/zephyr-workspace/zephyr 2>/dev/null || echo "Some submodules not found"
106+
echo ""
107+
echo "Zephyr modules size: $(du -sh lib/zephyr-workspace/modules lib/zephyr-workspace/bootloader 2>/dev/null | awk '{sum+=$1} END {print sum"M"}' || echo 'N/A')"
95108
echo "SDK size: $(du -sh ~/zephyr-sdk-0.17.2 2>/dev/null | cut -f1 || echo 'N/A')"
96109
echo "Total modules count: $(find lib/zephyr-workspace/modules lib/zephyr-workspace/bootloader -name '.git' -type d 2>/dev/null | wc -l)"
97110
98111
- name: Build for PROVES Flight Control Board v5c
99112
run: |
100-
# Skip submodule init since we cached it separately
113+
# Skip both zephyr-setup and submodules since we cached them separately
101114
make build -o zephyr-setup -o submodules
102115
103116
- name: Upload build artifacts

0 commit comments

Comments
 (0)