Skip to content

Commit e076a81

Browse files
enjoy-digitalclaude
andcommitted
ports/litex: CI — only skip litex_setup on *exact* cache hit, not file presence.
`build_boards (digilent_arty_full)` was failing on CI because: 1. The new variant's cache key didn't exist (new ci.sh hash). 2. actions/cache fell back via restore-keys to a 1-2-day-old partial cache. 3. `ci_litex_setup` checked only `~/.local/bin/litex_term` + `~/litex/litex` existence — both true after the partial restore — and skipped `./litex_setup.py --init --install`. 4. arty_full's flags (--with-spi-flash + --with-watchdog + ...) needed LiteX master as of this week; the cached install predated them; the SoC build tripped over newer-than-cache API surface and failed. Plumb `steps.cache-litex.outputs.cache-hit` through to the step as $LITEX_CACHE_HIT and require BOTH that flag being "true" *and* the files existing before skipping. Restore-keys fallback now counts as a miss → fresh install → current upstream master. Affects every build_* job. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bf46f5a commit e076a81

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

‎.github/workflows/ports_litex.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ jobs:
9090
soc-${{ matrix.cpu }}-${{ matrix.variant }}-
9191
- name: Install packages
9292
run: tools/ci.sh litex_setup
93+
env:
94+
LITEX_CACHE_HIT: ${{ steps.cache-litex.outputs.cache-hit }}
9395
- name: Build firmware and run sim tests (${{ matrix.cpu }} / ${{ matrix.variant }})
9496
run: tools/ci.sh litex_build_sim_${{ matrix.variant }}
9597
- name: Dump sim log on failure
@@ -131,5 +133,7 @@ jobs:
131133
board-${{ matrix.board }}-
132134
- name: Install packages
133135
run: tools/ci.sh litex_setup
136+
env:
137+
LITEX_CACHE_HIT: ${{ steps.cache-litex.outputs.cache-hit }}
134138
- name: Build firmware for ${{ matrix.board }}
135139
run: tools/ci.sh litex_build_board_${{ matrix.board }}

‎tools/ci.sh‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,18 @@ function ci_litex_setup {
365365
python3-pip
366366
# litex_setup.py clones LiteX + LiteX-Boards + cores into ~/litex and
367367
# pip-installs them into the user site (~/.local). Both directories
368-
# are cached by the workflow's actions/cache step, so on a warm
369-
# cache we just put ~/.local/bin back on $PATH and skip the slow
370-
# clone/install.
371-
if [ -x "$HOME/.local/bin/litex_term" ] && [ -d "$HOME/litex/litex" ]; then
372-
echo "ci_litex_setup: cache hit — skipping litex_setup.py"
368+
# are cached by the workflow's actions/cache step.
369+
#
370+
# Skip re-install only on an *exact* cache hit — the workflow sets
371+
# LITEX_CACHE_HIT from steps.cache-litex.outputs.cache-hit. A
372+
# restore-keys fallback (older partial match) counts as a miss, so
373+
# a fresh install re-runs litex_setup.py and picks up the current
374+
# upstream master — avoids the "arty_full fails because the cached
375+
# LiteX is weeks stale" class of bug.
376+
if [ "${LITEX_CACHE_HIT:-false}" = "true" ] \
377+
&& [ -x "$HOME/.local/bin/litex_term" ] \
378+
&& [ -d "$HOME/litex/litex" ]; then
379+
echo "ci_litex_setup: exact cache hit — skipping litex_setup.py"
373380
else
374381
mkdir -p $HOME/litex
375382
pushd $HOME/litex

0 commit comments

Comments
 (0)