joreilly / Confetti

KMP GraphQL based conference project with Jetpack Compose Android, Compose for Wear, Compose Multiplatform and SwiftUI iOS clients along with GraphQL backend.
Apache License 2.0
809 stars 95 forks source link

Caching dependencies for ios build action workflow #1454

Closed mirzemehdi closed 1 month ago

mirzemehdi commented 1 month ago

for other environments I don't think caching makes that much difference, but for iOS, saw that it takes around 20 minutes for each build, this should make it 2 times faster for next builds.

Wasn't make sure if it uses CocoaPods, so added caching option for that too just in case.

joreilly commented 1 month ago

@mirzemehdi looks like the cache works within same workflow runs....as opposed to for different runs of workflow?

mirzemehdi commented 1 month ago

@joreilly didn't know for pull request cache can work differently:

"When a cache is created by a workflow run triggered on a pull request, the cache is created for the merge ref (refs/pull/.../merge). Because of this, the cache will have a limited scope and can only be restored by re-runs of the pull request. It cannot be restored by the base branch or other pull requests targeting that base branch" (https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache)

For my case, workflow trigger was on pushing main branch, so I could see real benefit.

mirzemehdi commented 1 month ago

There is also this: "If a workflow run is triggered for a pull request, it can also restore caches created in the base branch, including base branches of forked repositories.".

So I think best option would be just observing for next builds and see if it works as expected 😂