Repository navigation
ci: enable ccache persistence across CI workflow runs - #20580
Merged
Merged
Conversation
Swatantra-66
requested review from
btashton,
lupyuen,
raiden00pl,
simbit18 and
xiaoxiang781216
as code owners
October 10, 2026 19:22
|
xiaoxiang781216
approved these changes
Oct 11, 2026
Currently, Linux matrix jobs in .github/workflows/build.yml pass '-c' to cibuild.sh to enable ccache inside the Docker container, but the cache directory (sources/tools/ccache) is discarded upon container exit and runner teardown. This change enables persistent ccache caching across GitHub Actions workflow runs: 1. Add an actions/cache@v6 step in build.yml to restore and save sources/tools/ccache per board matrix job. 2. Add a post-build permission adjustment step so the runner user can archive Docker-created cache files without permission issues. 3. Configure CCACHE_MAXSIZE (defaulting to 1G per board matrix job) in cibuild.sh to prevent unbounded repository cache consumption. 4. Add the ccache wrapper directory to PATH in tools/ci/platforms/ubuntu.sh. Addresses apache#20483. Signed-off-by: Swatantra Yadav <maverickswatantra@gmail.com>
Swatantra-66
force-pushed
the
ci/enable-ccache
branch
from
October 11, 2026 15:23
c6691b7 to
2ae45d1
Compare
acassis
approved these changes
Oct 11, 2026
1 task done
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Following the discussion in #20483 with @acassis and the suggestion from @casaroli, this PR implements the first phase of CI optimization: enabling persistent
ccachecaching across GitHub Actions workflow runs.Background & Problem
In
.github/workflows/build.yml, Linux matrix jobs already pass-cto./cibuild.sh, which configuresccachewrappers and tools inside theghcr.io/apache/nuttx/apache-nuttx-ci-linuxDocker container. However, because GitHub Actions did not configureactions/cachefor the ccache directory (sources/tools/ccache), the entire cache was destroyed upon container teardown. As a result, every CI job compiled from scratch with an empty cache.Key Changes
actions/cache@v6in.github/workflows/build.ymlfor each board matrix job (sources/tools/ccache).${{ runner.os }}-${{ matrix.boards }}-ccache-${{ github.sha }}with fallbackrestore-keys: ${{ runner.os }}-${{ matrix.boards }}-ccache-so matrix partitions (e.g.arm-01,risc-v-01,sim-01) maintain isolated, non-conflicting compiler caches.sudo chmod -R a+rwX sources/tools/ccache) withif: always()so the non-root runner user can archive Docker-created cache directories without permission errors.export CCACHE_MAXSIZE="${CCACHE_MAXSIZE:-1G}"intools/ci/cibuild.shto cap disk usage per matrix job, preventing eviction from GitHub's 10GB repository cache limit.add_path "${NUTTXTOOLS}"/ccache/binintools/ci/platforms/ubuntu.shfor parity withmsys2.sh.Addresses #20483 (Phase 1).
Impact
Testing
tools/checkpatch.sh(0 warnings, 0 errors)..github/workflows/build.yml.CIWORKSPACE(/github/workspace/sources) inside Docker maps directly to host runner pathsources/tools/ccache.