cps-org / cps-config

A drop in replacement for pkg-config/pkgconf using cps files
MIT License
15 stars 7 forks source link

Re-enable ccache #78

Open lunacd opened 1 month ago

lunacd commented 1 month ago

Fixes #50

Review Requested

I used '**/*.cpp', '**/*.h', '**/meson.build', 'subprojects/*.wrap' as the ccache cache key. This list should include everything that could affect what is built and how it is built. Is that a complete a list? Should I include wrap files to this list?

Changes

Docker does not natively support exporting cache mounts, or saving it to some external cache storage like the GHA cache.

This commit uses a workaround described in [1] where the content in the cache mount is moved into a dumb container and then exported through its file system. To load recovered cache into the cache mount, another dumb container is built and its build process copies recovered cache into the cache mount.

This is very much a hack and shouldn't be necessary once docker natively supported by buildx.

Justification for not caching more build steps

dnf, apt, and pip can theoretically also be cached this way. However, if the list of dependencies have not been changed, the entire docker layer would be a cache hit and dnf/apt caches would not be beneficial. Considering that dependency changes should be rare, not caching them seems wise.

[1] https://github.com/moby/buildkit/issues/1512