Prune zephyr manifest #126
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Lint | |
| run: | | |
| make fmt | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: false # We'll handle submodules with smart caching | |
| fetch-depth: 0 | |
| # Cache git submodules content | |
| - name: Cache Git Submodules | |
| id: cache-submodules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| lib/fprime | |
| lib/fprime-zephyr | |
| lib/zephyr-workspace/zephyr | |
| key: git-submodules-${{ hashFiles('.gitmodules') }}-v2 | |
| restore-keys: | | |
| git-submodules-${{ hashFiles('.gitmodules') }}- | |
| git-submodules- | |
| # Cache Zephyr west modules and SDK (the slow parts) | |
| - name: Cache Zephyr workspace and SDK | |
| id: cache-zephyr | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| lib/zephyr-workspace/modules | |
| lib/zephyr-workspace/bootloader | |
| ~/zephyr-sdk-0.17.2 | |
| key: zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}-v3 | |
| restore-keys: | | |
| zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}- | |
| zephyr-minimal- | |
| # Initialize git submodules with cache restoration | |
| - name: Initialize Git Submodules | |
| run: | | |
| echo "Setting up git submodules..." | |
| # First, ensure git knows about the submodules | |
| git submodule init | |
| if [ "${{ steps.cache-submodules.outputs.cache-hit }}" == "true" ]; then | |
| echo "✓ Submodules restored from cache, syncing URLs and updating..." | |
| # Sync URLs in case they changed | |
| git submodule sync --recursive | |
| # Update with existing cached content | |
| git submodule update --recursive | |
| else | |
| echo "Cache miss - downloading submodules..." | |
| git submodule update --recursive | |
| fi | |
| # Verify submodules are working | |
| echo "Verifying submodules:" | |
| git submodule status | |
| - name: Setup minimal Zephyr environment | |
| if: steps.cache-zephyr.outputs.cache-hit != 'true' | |
| run: | | |
| make zephyr-setup | |
| env: | |
| PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
| PIP_NO_COMPILE: 1 | |
| - name: Verify Zephyr setup (from cache or fresh) | |
| run: | | |
| echo "=== Verification ===" | |
| echo "Git submodules status:" | |
| git submodule status | |
| echo "" | |
| echo "Zephyr workspace modules installed:" | |
| find lib/zephyr-workspace/modules lib/zephyr-workspace/bootloader -name '.git' -type d 2>/dev/null | wc -l || echo "0" | |
| echo "" | |
| echo "SDK toolchain:" | |
| if [ -f ~/zephyr-sdk-0.17.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc ]; then | |
| echo "✓ ARM toolchain installed" | |
| ls -lh ~/zephyr-sdk-0.17.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc | awk '{print "Size:", $5}' | |
| else | |
| echo "✗ ARM toolchain not found" | |
| fi | |
| - name: Display setup statistics | |
| run: | | |
| echo "=== Setup Statistics ===" | |
| echo "Git submodules cache hit: ${{ steps.cache-submodules.outputs.cache-hit }}" | |
| echo "Zephyr modules cache hit: ${{ steps.cache-zephyr.outputs.cache-hit }}" | |
| echo "" | |
| echo "Submodule sizes:" | |
| du -sh lib/fprime lib/fprime-zephyr lib/zephyr-workspace/zephyr 2>/dev/null || echo "Some submodules not found" | |
| echo "" | |
| 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')" | |
| echo "SDK size: $(du -sh ~/zephyr-sdk-0.17.2 2>/dev/null | cut -f1 || echo 'N/A')" | |
| echo "Total modules count: $(find lib/zephyr-workspace/modules lib/zephyr-workspace/bootloader -name '.git' -type d 2>/dev/null | wc -l)" | |
| - name: Build for PROVES Flight Control Board v5c | |
| run: | | |
| # Skip both zephyr-setup and submodules since we cached them separately | |
| make build -o zephyr-setup -o submodules | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: firmware-v5c | |
| path: | | |
| build-artifacts/zephyr.uf2 | |
| build-artifacts/zephyr.elf | |
| build-artifacts/zephyr.hex | |
| build-artifacts/zephyr.bin | |
| retention-days: 30 | |
| - name: Display build statistics | |
| if: success() | |
| run: | | |
| echo "=== Build Statistics ===" | |
| if [ -f build-artifacts/zephyr.uf2 ]; then | |
| echo "Firmware size: $(ls -lh build-artifacts/zephyr.uf2 | awk '{print $5}')" | |
| fi | |
| echo "" | |
| echo "Memory usage:" | |
| cat build-fprime-automatic-zephyr/zephyr/zephyr.stat 2>/dev/null || echo "Stats not available" |