I am trying to compile a Linux kernel in the CI, but it is set to time out after 3 hours. And it took 80 minutes to clone the repo from GitHub. How do I cache the repo so consecutive builds are faster?
are you cloning the repository in your CI job to compile, or have you imported it into GitLab already? The latter should be faster although I could imagine that the many revisions and objects are a resource consuming process.
The Linux kernel itself is written in C, so there might be additional caching on compilation optimization, such as involving ccache: http://nickdesaulniers.github.io/blog/2018/06/02/speeding-up-linux-kernel-builds-with-ccache/
Probably best to see your .gitlab-ci.yml to make more suggestions if possible.
Generally speaking, dedicated hardware resources & your own GitLab runner will improve this behaviour. Like, throwing 64 cores & 1TB ram at the compiler will help compared to shared resources on the .com runner fleet.