Skip to content

Fix ccache never being saved in container CI jobs#49

Merged
ltowarek merged 2 commits into
mainfrom
fix/ccache-workspace-path
May 16, 2026
Merged

Fix ccache never being saved in container CI jobs#49
ltowarek merged 2 commits into
mainfrom
fix/ccache-workspace-path

Conversation

@ltowarek
Copy link
Copy Markdown
Owner

Summary

  • actions/cache POST step (save) runs on the host runner after the container is stopped, not inside the container
  • At that point ~ expands to /home/runner (host home), but ccache ran inside the container and wrote to /github/home/.ccache — a completely different path
  • Confirmed via the GitHub cache API: no ccache entry was ever saved, only Bun caches exist

The fix is to use ${{ github.workspace }}/.ccache for both the cache path and CCACHE_DIR. The workspace directory is bind-mounted, so it resolves to the same physical path inside the container (/__w/.../esp-opentelemetry-cpp/.ccache) and on the host when the post step saves the cache.

Also includes the Dockerfile key path fix from #48 (already merged to main).

Test plan

  • Verify the CI run for this PR shows a cache save step completing successfully
  • On a second run, verify Cache restored from key: ccache-Linux-idf-... appears
  • Confirm build time decreases on the second run

🤖 Generated with Claude Code

@ltowarek ltowarek force-pushed the fix/ccache-workspace-path branch 2 times, most recently from 54c1b9f to 19fcdb6 Compare May 16, 2026 18:42
ltowarek and others added 2 commits May 16, 2026 18:44
actions/cache post step runs on the HOST after the container is removed,
so ~/ expands to /home/runner (host runner home) rather than /github/home
where ccache actually writes inside the container. The cache path was
always empty at save time, so no cache entry was ever uploaded.

Use github.workspace-relative path for both the cache path and CCACHE_DIR
so the same physical directory is used inside the container and when the
host-side post step uploads the cache.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Makes the cache directory explicit rather than relying on HOME resolution,
consistent with how CI sets CCACHE_DIR via the workflow environment.
The value matches the volume mount in devcontainer.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ltowarek ltowarek force-pushed the fix/ccache-workspace-path branch from 19fcdb6 to 2eb0f31 Compare May 16, 2026 18:44
@ltowarek ltowarek enabled auto-merge (squash) May 16, 2026 18:45
@ltowarek ltowarek merged commit 00acebc into main May 16, 2026
5 checks passed
@ltowarek ltowarek deleted the fix/ccache-workspace-path branch May 16, 2026 19:03
ltowarek added a commit to ltowarek/dust-mite that referenced this pull request May 16, 2026
* Explicitly set CCACHE_DIR in devcontainer Dockerfile

Makes the cache directory explicit rather than relying on HOME resolution,
consistent with how CI sets CCACHE_DIR. The value matches the ccache
volume mount in devcontainer.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix ccache never being saved in container CI job

Same root cause as ltowarek/esp-opentelemetry-cpp#49: actions/cache POST
step runs on the host after the container is removed, so ~/.ccache expands
to /home/runner (host home) while ccache wrote to /github/home inside the
container — the cache path was always empty, so nothing was ever uploaded.

Use github.workspace-relative path for both the cache path and CCACHE_DIR
so the same physical directory is used inside the container and when the
host-side post step uploads the cache.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant