Skip to content

Prune zephyr manifest #156

Prune zephyr manifest

Prune zephyr manifest #156

Workflow file for this run

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 project dependencies (fprime, fprime-zephyr, zephyr)
- name: Cache Project Dependencies
id: cache-submodules
uses: actions/cache@v4
with:
path: |
lib/fprime
lib/fprime-zephyr
lib/zephyr-workspace/zephyr
key: project-deps-${{ hashFiles('.gitmodules') }}-v3
restore-keys: |
project-deps-${{ hashFiles('.gitmodules') }}-
project-deps-
# 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 dependencies with robust cache handling
- name: Setup Dependencies (fprime, fprime-zephyr, zephyr)
run: |
echo "Setting up project dependencies..."
# Check if we have cached content
if [ "${{ steps.cache-submodules.outputs.cache-hit }}" == "true" ]; then
echo "✓ Dependencies restored from cache"
# Verify cached content is valid by checking for key files
valid_cache=true
if [ ! -f "lib/fprime/CMakeLists.txt" ]; then
echo "⚠️ fprime cache invalid, will re-download"
valid_cache=false
fi
if [ ! -f "lib/fprime-zephyr/CMakeLists.txt" ]; then
echo "⚠️ fprime-zephyr cache invalid, will re-download"
valid_cache=false
fi
if [ ! -f "lib/zephyr-workspace/zephyr/CMakeLists.txt" ]; then
echo "⚠️ zephyr cache invalid, will re-download"
valid_cache=false
fi
if [ "$valid_cache" = "true" ]; then
echo "✓ All cached dependencies are valid, skipping download"
exit 0
fi
fi
echo "Downloading dependencies manually..."
# Remove any existing directories
rm -rf lib/fprime lib/fprime-zephyr lib/zephyr-workspace/zephyr
# Clone submodules
make submodules
echo "✓ All dependencies downloaded successfully"
- 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: 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: artifacts
path: |
build-artifacts/zephyr.uf2
build-artifacts/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json
retention-days: 30