subosito / flutter-action

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

x64 install using flutter-action@v2 won't install a flutter version higher than 3.0.1 #177

Closed charlesluzar closed 1 year ago

charlesluzar commented 1 year ago

I'm trying to get this action to install Flutter@3.0.5 but it won't seem to install anything higher than 3.0.1 on a macos VM running the self-hosted actions runner.

Things I tried:

Nothing I tried got anything higher than 3.0.1 to install.

Here's a script I used to test on a macos machine:

steps:
  - name: Prove we only have a stock macos dart SDK
    run: which dart
  - name: Prove we don't have a flutter SDK yet
    run: which flutter
    continue-on-error: true
  - uses: actions/setup-java@v1
    with:
      java-version: "12.x"
  - uses: subosito/flutter-action@v2
    with:
      flutter-version: "3.0.5"
      channel: "stable"
      architecture: x64
  - name: Prove subosito/flutter-action@v2 persisted the new dart SDK to $PATH
    run: which dart
  - name: Prove subosito/flutter-action@v2 persisted the new flutter SDK to $PATH
    run: which flutter
  - name: Prove we have the wrong version of the flutter and dart SDKs
    run: flutter doctor

Here is the output. (If you'd like the raw logs just let me know, I figured this is easier to look at.)

image

kuhnroyal commented 1 year ago

The action just checks if the cache-path exists on self-hosted runners. If it does it just updates the environment. A better use for self-hosted is to add the cache-path: ${{ runner.tool_cache }}/flutter/${{ env.FLUTTER_VERSION }}-${{ env.FLUTTER_CHANNEL }} parameter. This way you can have multiple versions installed in parallel. Make sure to clean the _tools/flutter folder beforehand.

@subosito Not sure, maybe the action can catch the different local version and then delete/re-install?

charlesluzar commented 1 year ago

@kuhnroyal That did the trick. Seems a helpful thing to add to the README for people running on self-hosted runners. Happy to submit a PR if requested, just let me know. I'll leave it to an existing contributor to close the issue if desired. Thanks so much!

subosito commented 1 year ago

Closing for now, since we are now incorporating hash in cache-key; please try using the v2 and let me know if the issue persists.