Open DanAlbert opened 2 years ago
https://github.com/DanAlbert/sccache-example, but it's incomplete for the reasons mentioned in the readme.
cc @luser for feedback/tips here on sccache usage or limitations in CMake / with GCS buckets.
I actually haven't used sccache with CMake! The guidance in the README was provided by a user. That combination does seem to be used in the wild. For example, in Qt: https://github.com/qt/qtbase/blob/1eb2d4d0da121b51832136773f4c863d3e9affc5/coin/instructions/prepare_building_env.yaml#L467-L492
https://github.com/DanAlbert/sccache-example, but it's incomplete for the reasons mentioned in the readme.
re: building sccache via cargo install
, that is definitely not recommended! The sccache repo provides pre-built release binaries. I'm not sure if there's some shortcut we could provide to make using sccache via GitHub Actions simpler? That would be worthwhile to explore.
There's not much complexity involved in using a cloud storage backend for sccache, but unfortunately it's not exactly plug-and-play. You need to create the bucket and configure it, and then set the appropriate environment variables to point sccache at it, as well as the access credentials as secrets. It would be nice if CI environments like GitHub Actions provided an API to use their provided cache storage as a simple key/value store. If that were available, sccache could be taught to use that directly, which would be perfect for small projects.
re: building sccache via cargo install, that is definitely not recommended!
Oh yes, I saw the warnings in your docs (thanks for documenting that!) Above I was just trying to prove that it was possible to use with the NDK, and figured I might as well upload it as a starting point for someone else to improve. It's extremely not production ready :)
I'm not sure if there's some shortcut we could provide to make using sccache via GitHub Actions simpler? That would be worthwhile to explore.
I know next to nothing about this, but GitHub does have https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows which is how you would enable caching for other languages. That might be the place to start digging?
Description
It's actually trivially easy to use sccache with CMake:
Might be worthwhile to build a full sample that does that with a GCS bucket for caching a github action.