The template defined in this repository and the corresponding GitHub actions configuration configure a --repository_cache to be cached with the GitHub actions cache. However, in my experience, fetching artifacts from the GitHub actions cache is often slower than fetching the artifacts directly from the internet in a GitHub actions run.
I've set up a simple example to illustrate this: In that case we use Bazel to download binaries of varying sizes and either use Bazel's repository cache feature to cache on GitHub actions cache or not. In the case of a download artifact of about 200MiB in size the full build step (including the download of Bazel itself) takes about 9s. However, with the GitHub actions cache enabled the download of the cache alone takes 1m6s. According to the cache action's outputs the download itself is fast at somewhere around 130MB/s, but the overall step duration brings this down to about 3MB/s. (Perhaps the decompression takes so long.)
On smaller sized artifacts the difference vanishes, the GitHub actions run takes about the same time whether the repository cache is used or not. So, in such cases the repository cache doesn't add much value, but only drives up the storage used.
This begs the question, should we recommend a repository cache in the rules template, or is it better to remove it from the example CI configuration?
The template defined in this repository and the corresponding GitHub actions configuration configure a
--repository_cache
to be cached with the GitHub actions cache. However, in my experience, fetching artifacts from the GitHub actions cache is often slower than fetching the artifacts directly from the internet in a GitHub actions run.I've set up a simple example to illustrate this: In that case we use Bazel to download binaries of varying sizes and either use Bazel's repository cache feature to cache on GitHub actions cache or not. In the case of a download artifact of about 200MiB in size the full build step (including the download of Bazel itself) takes about 9s. However, with the GitHub actions cache enabled the download of the cache alone takes 1m6s. According to the cache action's outputs the download itself is fast at somewhere around 130MB/s, but the overall step duration brings this down to about 3MB/s. (Perhaps the decompression takes so long.)
On smaller sized artifacts the difference vanishes, the GitHub actions run takes about the same time whether the repository cache is used or not. So, in such cases the repository cache doesn't add much value, but only drives up the storage used.
This begs the question, should we recommend a repository cache in the rules template, or is it better to remove it from the example CI configuration?
(Relevant changes https://github.com/bazel-contrib/rules-template/commit/d017a1dcd811bbd25514024776547e5f0b9782c2 and https://github.com/aherrmann/.github/commit/07b63687e79bedab3ff6d184f2003d6aae9421e2)