utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
560 stars 38 forks source link

Improve ci cd workflow #614

Closed chippmann closed 1 month ago

chippmann commented 2 months ago

This PR contains the following changes:

CedNaru commented 2 months ago

I don't think this is the right approach to save on cache space. I have read the documentation in details. Caches are created per key AND per branch and can only be accessed by that branch or a child branch.

Let's take this PR as en example. This branch is a child of gd_kotlin_rework, itself a child of master If you try to fetch a cache here, it's going to check for the key in this branch's cache, then in gd_kotlin_rework then in master. Here is the relevant part in the doc: image

But afterward, a new cache will be saved automatically by the action, a cache that will only be accessible from this PR. It means that none of the work cached in that branch will be useable by the others. The way I see to properly share cache between branches is to only save the cache when running on the master and prevent saving on other branches. Or at least to only save cache on merge actions, that way we only generate caches for "parent branches" whatever they are (in this case, that would be cached for gd_kotlin_rework). Preventing generating cache on "leaf" branches is important so we don't bloat the cache with each PR: image

So you should keep your different keys for all kind of build (release, debug and dev should all be a separate key). And instead only save when the conditions are met (either you are on master or triggered by a merge action if that's possible) so the amount of generated cache is kept to a minimum. To be more granular with restoring and saving caches, you can use the actions/cache/restore and actions/cache/save instead of the more generic actions/cache that both restore and save automatically.

As it is, I don't think your PR is going to save on cache, and on top will force a different build to restore a cache they can't use because you made them all use the same key.

chippmann commented 1 month ago

Superseeded by https://github.com/utopia-rise/godot-kotlin-jvm/pull/638