Improving the ball of spaghetti following the guidelines of the plugin you shared always helps (a flat tree with at most 3-4 levels to maximize parallelization of tasks). However I don't think this is your worst problem right now. In the
timeline you can see that most of your threads are able to work in parallel most of the time, with not big idle waits, so right now you probably won't see a big improvement with that.
As mentioned by others in this thread, your biggest issue here is 7min in configuration phase. It is not healthy to spend 30% of your total build time there.
Other than that, what will definitively help you cutting drastically the build time on CI is to enable a
remote gradle cache, as avoiding task execution is usually the best way to speed up your builds. You have gradle cache already enabled (and I guess you enjoy it in your local builds), but your CI runners are most likely ephemeral (starting clean, and shut down after each build), so you are not leveraging this on CI, adding a
remote cache will help you here.
Once you have this, then solving the spaghetti module graph will also make more sense (as the fewer dependencies a module has, the more times it will be reused from the cache).