Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to automatically run flutter precache #256

Closed
bartekpacia opened this issue Nov 13, 2023 · 8 comments
Closed

Allow to automatically run flutter precache #256

bartekpacia opened this issue Nov 13, 2023 · 8 comments

Comments

@bartekpacia
Copy link
Collaborator

bartekpacia commented Nov 13, 2023

I often have the following code in my workflows

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    flutter-version: ${{ matrix.flutter-version }}
    channel: ${{ matrix.flutter-channel }}

- name: Preload Flutter artifacts
  run: flutter precache

I wish I could so something like:

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    flutter-version: ${{ matrix.flutter-version }}
    channel: ${{ matrix.flutter-channel }}
    precache: true

Possibly it should also allow for more granular selection of artifacts to precache, e.g. flutter precache --android --ios would translate to:

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    flutter-version: ${{ matrix.flutter-version }}
    channel: ${{ matrix.flutter-channel }}
    precache: ['android', 'ios']
@subosito
Copy link
Owner

subosito commented Mar 1, 2024

I like this idea @bartekpacia, I would be happy to merge the PR.

@bartekpacia
Copy link
Collaborator Author

awesome, I'll start on it :)

@bartekpacia
Copy link
Collaborator Author

GitHub Actions doesn't support passing arrays to actions. For example, I would want to have this API:

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    channel: stable
    flutter-version: '3.19.0'
    precache: [android, ios]

but it doesn't work:

Screenshot 2024-03-02 at 04 36 11

Only strings, integers, or booleans can be passed, so that's how actually the API would look like:

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    channel: stable
    flutter-version: '3.19.0'
    precache: '[android, ios]'

I think it's pretty ugly. So right now I'm leaning toward making precache a boolean.

- name: Set up Flutter
  uses: subosito/flutter-action@v2
  with:
    channel: stable
    flutter-version: '3.19.0'
    precache: true

Someone can contribute the more complex version later, and meanwhile they can continue with calling flutter precache manually.

@yurikoles
Copy link

What about nested booleans?

precache:
  ios: true
  android: false

@bartekpacia
Copy link
Collaborator Author

That's some solution, thanks! However it results in quite "tall" code.

@bartekpacia
Copy link
Collaborator Author

bartekpacia commented Mar 24, 2024

I think this would be cool:

Precache artifacts for all currently enabled platforms:

precache: true

OR

precache artifacts for specific platforms:

precache:
  ios: true
  android: false

Both syntaxes would be correct. I'm not sure if GitHub Actions supports this though (mixed type: value vs list of values).

@yurikoles what do you think?

@yurikoles
Copy link

yurikoles commented Mar 24, 2024

This feature is mostly for GitHub-hosted runners only. Self-hosted runners retain their state, so precaching seems less important for them. Cheaper Linux runners are preferred due to higher billing multipliers for macOS and Windows runners. Most users require only iOS support on macOS runners. Therefore, I propose to implement one boolean, which will run flutter precache with no options on Linux, flutter precache --windows on Windows, and flutter precache --ios on macOS.

@bartekpacia
Copy link
Collaborator Author

see #276 (comment)

@bartekpacia bartekpacia closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants