Skip to content

Commit 1faf47e

Browse files
committed
Improving CI with Caching
1 parent dd30334 commit 1faf47e

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

.github/workflows/ci.yaml

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,47 +25,64 @@ jobs:
2525
submodules: recursive
2626
fetch-depth: 0
2727

28-
- name: Install system dependencies
28+
# Install only packages NOT pre-installed on ubuntu-latest
29+
# Pre-installed: git, cmake, make, gcc, g++, wget, file, python3
30+
# See: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md
31+
- name: Install minimal Zephyr dependencies
2932
run: |
30-
sudo apt-get update
31-
sudo apt-get install -y \
32-
git cmake ninja-build gperf ccache dfu-util \
33-
device-tree-compiler wget xz-utils file make gcc \
34-
gcc-multilib g++-multilib libsdl2-dev libmagic1
33+
sudo apt-get update -qq
34+
sudo apt-get install -y --no-install-recommends \
35+
ninja-build \
36+
gperf \
37+
ccache \
38+
device-tree-compiler \
39+
xz-utils \
40+
libmagic1
41+
env:
42+
DEBIAN_FRONTEND: noninteractive
3543

3644
- name: Set up Python
3745
uses: actions/setup-python@v5
3846
with:
3947
python-version: '3.11'
4048
cache: 'pip'
49+
cache-dependency-path: 'requirements.txt'
4150

42-
- name: Cache Zephyr workspace
51+
# Cache both workspace AND SDK together
52+
- name: Cache Zephyr workspace and SDK
4353
id: cache-zephyr
4454
uses: actions/cache@v4
4555
with:
4656
path: |
4757
lib/zephyr-workspace
4858
~/zephyr-sdk-0.17.2
49-
key: zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}
59+
key: zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}-v2
5060
restore-keys: |
51-
zephyr-minimal-${{ hashFiles('west.yml') }}-
61+
zephyr-minimal-${{ hashFiles('west.yml') }}-${{ runner.os }}-
5262
zephyr-minimal-
5363
5464
- name: Setup minimal Zephyr environment
65+
if: steps.cache-zephyr.outputs.cache-hit != 'true'
5566
run: |
5667
make zephyr-setup
5768
env:
58-
# Speed up pip installs
5969
PIP_DISABLE_PIP_VERSION_CHECK: 1
6070
PIP_NO_COMPILE: 1
6171

72+
- name: Verify Zephyr setup (from cache or fresh)
73+
run: |
74+
west --version
75+
echo "Workspace modules:"
76+
west list | wc -l
77+
echo "SDK toolchain:"
78+
ls -la ~/zephyr-sdk-0.17.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc || echo "Not found"
79+
6280
- name: Display setup statistics
6381
run: |
6482
echo "=== Zephyr Setup Statistics ==="
65-
echo "Workspace size: $(du -sh lib/zephyr-workspace 2>/dev/null || echo 'N/A')"
66-
echo "SDK size: $(du -sh ~/zephyr-sdk-0.17.2 2>/dev/null || echo 'N/A')"
67-
echo "Modules installed:"
68-
west list 2>/dev/null || echo "West not initialized"
83+
echo "Cache hit: ${{ steps.cache-zephyr.outputs.cache-hit }}"
84+
echo "Workspace size: $(du -sh lib/zephyr-workspace 2>/dev/null | cut -f1 || echo 'N/A')"
85+
echo "SDK size: $(du -sh ~/zephyr-sdk-0.17.2 2>/dev/null | cut -f1 || echo 'N/A')"
6986
7087
- name: Build for PROVES Flight Control Board v5c
7188
run: |
@@ -89,8 +106,6 @@ jobs:
89106
if [ -f build-artifacts/zephyr.uf2 ]; then
90107
echo "Firmware size: $(ls -lh build-artifacts/zephyr.uf2 | awk '{print $5}')"
91108
fi
92-
if [ -f build-fprime-automatic-zephyr/zephyr/zephyr.stat ]; then
93-
echo ""
94-
echo "Memory usage:"
95-
cat build-fprime-automatic-zephyr/zephyr/zephyr.stat || true
96-
fi
109+
echo ""
110+
echo "Memory usage:"
111+
cat build-fprime-automatic-zephyr/zephyr/zephyr.stat 2>/dev/null || echo "Stats not available"

0 commit comments

Comments
 (0)