burrunan / gradle-cache-action

GitHub Action to properly cache ~/.gradle folder
Apache License 2.0
150 stars 13 forks source link

Is running multiple commands in multiple working directories supported? #18

Open LouisCAD opened 4 years ago

LouisCAD commented 4 years ago

Here's the link of a workflow that I'd like to update to be more efficient and faster thanks to caching: https://github.com/jmfayard/refreshVersions/blob/c8f1e0c5b9d6e7303fbc97228b8980cd73f53cf0/.github/workflows/check-build.yml

vlsi commented 4 years ago

Well, the issue with launching Gradle several times is to figure out "how to deal with the shared dependencies cache".

So far I have execution-only-caches: true action property which skips gradle dependencies, maven local repository and similar caches for a particular execution.

Here's how it works in Apache Calcite: https://github.com/apache/calcite/blob/c17dacabe8effe8d644070d5aceb902776f8e23b/.github/workflows/main.yml#L65-L88

Back to your case, I guess it would work if you replace eskatos/gradle-command-action with burrunan/gradle-cache-action 😉 and add execution-only-caches: true (into with:) to the second and the third executions. Then the first one would fetch dependencies caches, execution-only-caches: true would still use remote build cache, and finally post step of the very first execution would update dependencies cache if needed.

The drawback there would be that dependencies cache would not account for build.gradle.* changes within sample-kotlin and sample-groovy (which is https://github.com/burrunan/gradle-cache-action/issues/15)