subosito / flutter-action

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

Action broke and doesn't work at all #183

Closed bartekpacia closed 2 years ago

bartekpacia commented 2 years ago

I use this action in many projects of mine and it works fine. But there's this one project at work where it just broke and remains in this sad state.

That's how I use the action:

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

Nothing fancy. Newest version doesn't work as well. And below are the logs from this action's step:

Run subosito/flutter-action@v2.5.0
  with:
    flutter-version: [2](https://github.com/leancodepl/REDACTED/runs/7732114460?check_suite_focus=true#step:3:2).10.5
    cache-key: flutter-:os:-:arch:-:channel:-:version:-:hash:
    cache-path: /opt/hostedtoolcache/flutter
    architecture: X6[4](https://github.com/leancodepl/REDACTED/runs/7732114460?check_suite_focus=true#step:3:4)
Run $GITHUB_ACTION_PATH/setup.sh -c "/opt/hostedtoolcache/flutter"  2.10.[5](https://github.com/leancodepl/REDACTED/runs/7732114460?check_suite_focus=true#step:3:5) X[6](https://github.com/leancodepl/REDACTED/runs/7732114460?check_suite_focus=true#step:3:6)4
  $GITHUB_ACTION_PATH/setup.sh -c "/opt/hostedtoolcache/flutter"  2.10.5 X64
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   19[7](https://github.com/leancodepl/REDACTED/runs/7732114460?check_suite_focus=true#step:3:8)  100   1[9](https://github.com/leancodepl/REDACTED/runs/7732114460?check_suite_focus=true#step:3:10)7    0     0   4020      0 --:--:-- --:--:-- --:--:--  4020
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
2.10.5:X64:x64|null:null:x64

I remember that it was working fine, then I enabled cache using cache: true argument. Something broke then, so I removed that cache: true and was hoping it would start working again, but it didn't.

I've also cleared all the caches:

$ gh api /repos/leancodepl/REDACTED/actions/caches
{
  "total_count": 0,
  "actions_caches": []
}
subosito commented 2 years ago

@bartekpacia What about using subosito/flutter-action@v2?

bartekpacia commented 2 years ago

I tried a few times but the result was the same :(

bartekpacia commented 2 years ago

Some more info: this problem occurs in all new repositories in our organization that (attempt to) use this action. Flutter isn't downloaded and then it fails with the same error message as above.

kuhnroyal commented 2 years ago

Self hosted runners?

bartekpacia commented 2 years ago

Nope, GitHub provided ones.

kuhnroyal commented 2 years ago

Definitely try the latest version, there was something broken. See https://github.com/subosito/flutter-action/issues/180

bartekpacia commented 2 years ago

@kuhnroyal Yeah, I also experienced that problem, but 2.6.1 fixed it. The problem I described happens in both v2.5 and v2.6.1.

kuhnroyal commented 2 years ago

Hmm, can you show your matrix? I have no idea but in the output you posted, it seems the version/architecture are somehow formatted really weird with some links in between.

2.10.5:X64:x64|null:null:x64 is also really odd.

bartekpacia commented 2 years ago

Here it is a chunk of my workflow file

jobs:
  main:
    name: Flutter ${{ matrix.channel }}${{ matrix.version }}
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        include:
          - version: 2.10.5
          - channel: stable
          - channel: beta

    steps:
      - name: Clone repository
        uses: actions/checkout@v3

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

2.10.5:X64:x64|null:null:x64 is also really odd.

oh boi, sure it is

kuhnroyal commented 2 years ago

Hmm the matrix doesn't make much sense to me but I guess it is valid.

Anyway, try to run again with 2.6.1 and post the new output. Not having any other ideas.

subosito commented 2 years ago

I think it's because positional arguments break when we have blank value, for example:

    - uses: subosito/flutter-action@v2
      with:
        channel:
        flutter-version: 2.10.5

will be translated as setup.sh 2.10.5 X64, which is missing channel argument; thus, the script failed to run correctly.

I think moving to named arguments would be better for preventing such cases. Will push an update when the changes are ready.

subosito commented 2 years ago

@bartekpacia I have pushed the changes, please retry using the main branch and let me know the result on your end.

- uses: subosito/flutter-action@main
bartekpacia commented 2 years ago

@subosito Thanks, it works! Flutter is being downloaded just fine! 🚀

Problem solved, closing.

In case it's needed in the future, here's the commit that fixed this.

subosito commented 2 years ago

@bartekpacia Thanks for the confirmation. Let me publish a new tag and update v2 for this.

subosito commented 2 years ago

@bartekpacia Just published v2.6.2 and updated `v2; you can use that one instead of main.