MochiLibraries / ClangSharp.Pathogen

C# bindings for libclang Pathogen Extensions and other utilities for working with ClangSharp.
MIT License
2 stars 1 forks source link

Investigate bypassing the CI cache's branch scoping #5

Open PathogenDavid opened 3 years ago

PathogenDavid commented 3 years ago

The GitHub Actions cache is scoped to the specific branch which triggered the CI run, except for the main branch which is shared with all child branches. From the documentation:

The cache is scoped to the key and branch. The default branch cache is available to other branches.

There's a few issues covering this: https://github.com/actions/cache/issues/79 https://github.com/actions/cache/issues/183

Unfortunately this is done for security reasons so it's probably not super likely to change soon. Basically it ensures a rogue PR can't poison the cache and negatively affect other branches, which is pretty sensible.

What I do wish they did is make it so feature branches and maybe/optionally PRs from authorized developers weren't affected by this restriction.

I do not see anything in the action its self or the GHA toolkit that enforces this, I bet it's hiding in this URL which probably means we can't manipulate it: https://github.com/actions/toolkit/blob/f0b00fd201c7ddf14e1572a10d5fb4577c4bd6a2/packages/cache/src/internal/cacheHttpClient.ts#L36

Might be worth implementing our own caching instead.

Looking at a recent run, it looks like our cached artifacts total ~208 MB after compression:

Artifact Platform Size
LLVM build outputs Windows 23 MB
LLVM build outputs Linux 31 MB
LLVM sccache Windows 94 MB
LLVM sccache Linux 60 MB

*Oops, that's not right. Looks like it's only getting the symlink. Assumed it's about the same as Windows when compressed for that 200 MB figure. Fixed

At the very least we should be saving the build outputs so we don't bother rebuilding LLVM when it doesn't change.