subosito / flutter-action

Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.
MIT License
2.28k stars 202 forks source link

How to integrate with caching #283

Closed niccokunzmann closed 8 months ago

niccokunzmann commented 8 months ago

For caching, I see this section:

Integration with actions/cache:

What I do not know is the following:

bartekpacia commented 8 months ago

If you want to take advantage of caching, you just need to set cache: true:

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    channel: stable
    flutter-version: 3.19.0
    precache: true # <--
niccokunzmann commented 8 months ago

Uh, I just created #284 and I wonder what the difference between precache and cache is.

bartekpacia commented 8 months ago

Ugh, my bad!

bartekpacia commented 8 months ago

I meant this:

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    channel: stable
    flutter-version: 3.19.0
    cache: true # <--
bartekpacia commented 8 months ago

precache is still WIP: https://github.com/subosito/flutter-action/pull/276

widarlein commented 5 months ago

This might be a stupid question on a closed issue, but what exactly does cache: true do? I don't seem to see any improvements in build time :/

bartekpacia commented 5 months ago

Not a stupid question at all:). cache:true makes subosito/flutter-action use actions/cache under the hood (source link) to cache (1) Flutter SDK installation and (2) Pub dependencies.

I don't seem to see any improvements in build time :/

I guess this is because archiving cache + sending cache to github and (in a subsequent workflow run) downloading cache from github is not necessarily much faster than just downloading everything from Google servers every time.

If you don't see any improvement, feel free to disable it.