Skip to content

Commit 38e0890

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

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

.github/workflows/ci.yaml

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

28-
# Cache both workspace AND SDK together
28+
# Cache git submodules (fprime, fprime-zephyr, zephyr base)
29+
- name: Cache Git Submodules
30+
id: cache-submodules
31+
uses: actions/cache@v4
32+
with:
33+
path: |
34+
lib/fprime
35+
lib/fprime-zephyr
36+
lib/zephyr-workspace/zephyr
37+
key: git-submodules-${{ hashFiles('.gitmodules') }}-${{ runner.os }}-v1
38+
restore-keys: |
39+
git-submodules-${{ hashFiles('.gitmodules') }}-${{ runner.os }}-
40+
git-submodules-
41+
42+
# Cache Zephyr west modules and SDK
2943
- name: Cache Zephyr workspace and SDK
3044
id: cache-zephyr
3145
uses: actions/cache@v4
3246
with:
3347
path: |
34-
lib/zephyr-workspace
48+
lib/zephyr-workspace/modules
49+
lib/zephyr-workspace/bootloader
3550
~/zephyr-sdk-0.17.2
36-
key: zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}-v2
51+
key: zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}-v3
3752
restore-keys: |
3853
zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}-
3954
zephyr-minimal-
4055
56+
# Initialize git submodules if not cached
57+
- name: Initialize Git Submodules
58+
if: steps.cache-submodules.outputs.cache-hit != 'true'
59+
run: |
60+
echo "Initializing git submodules (not found in cache)..."
61+
git submodule update --init --recursive
62+
4163
- name: Setup minimal Zephyr environment
4264
if: steps.cache-zephyr.outputs.cache-hit != 'true'
4365
run: |
@@ -49,7 +71,10 @@ jobs:
4971
- name: Verify Zephyr setup (from cache or fresh)
5072
run: |
5173
echo "=== Verification ==="
52-
echo "Workspace modules installed:"
74+
echo "Git submodules status:"
75+
git submodule status
76+
echo ""
77+
echo "Zephyr workspace modules installed:"
5378
find lib/zephyr-workspace/modules lib/zephyr-workspace/bootloader -name '.git' -type d 2>/dev/null | wc -l || echo "0"
5479
echo ""
5580
echo "SDK toolchain:"
@@ -63,14 +88,17 @@ jobs:
6388
- name: Display setup statistics
6489
run: |
6590
echo "=== Zephyr Setup Statistics ==="
66-
echo "Cache hit: ${{ steps.cache-zephyr.outputs.cache-hit }}"
67-
echo "Workspace size: $(du -sh lib/zephyr-workspace 2>/dev/null | cut -f1 || echo 'N/A')"
91+
echo "Git submodules cache hit: ${{ steps.cache-submodules.outputs.cache-hit }}"
92+
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')"
6895
echo "SDK size: $(du -sh ~/zephyr-sdk-0.17.2 2>/dev/null | cut -f1 || echo 'N/A')"
69-
echo "Modules count: $(find lib/zephyr-workspace/modules lib/zephyr-workspace/bootloader -name '.git' -type d 2>/dev/null | wc -l)"
96+
echo "Total modules count: $(find lib/zephyr-workspace/modules lib/zephyr-workspace/bootloader -name '.git' -type d 2>/dev/null | wc -l)"
7097
7198
- name: Build for PROVES Flight Control Board v5c
7299
run: |
73-
make build -o zephyr-setup
100+
# Skip submodule init since we cached it separately
101+
make build -o zephyr-setup -o submodules
74102
75103
- name: Upload build artifacts
76104
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)