godot-kotlin-jvm icon indicating copy to clipboard operation
godot-kotlin-jvm copied to clipboard

Improve ci cd workflow

Open chippmann opened this issue 1 year ago • 1 comments

This PR contains the following changes:

  • hopefully improves our cache usage by only using the cache name and no refs for cache creation
  • always prints the testoutput now (including the error out)
  • Adds a workflow which builds and tests on every commit for linux only but does not (fully) run on pull requests

chippmann avatar Apr 18 '24 07:04 chippmann

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.

CedNaru avatar Apr 24 '24 02:04 CedNaru

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

chippmann avatar May 16 '24 14:05 chippmann