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

`flutter-action` step waiting for cache hit for 60 mins #186

Closed tanmay-pnaik closed 1 year ago

tanmay-pnaik commented 1 year ago

Summary:

I use the flutter-action step with the cache value set to true. In one instance, the cache failed to download on the GitHub hosted runner, so the step waited for the default timeout of 60 minutes before downloading.

As per the documentation of actions/cache, this can be fixed by setting the SEGMENT_DOWNLOAD_TIMEOUT_MINS environment variable value in minutes.

Details:

Current flutter-action version: 2 flutter version use: 3.0.5 runner: macOS runner (GitHub hosted)

Screenshot of step taking 1 hour:

image

Step output:

Run subosito/flutter-action@v2
  with:
    channel: stable
    flutter-version: 3.0.5
    cache: true
    cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:
    cache-path: /Users/runner/hostedtoolcache/flutter/:channel:-:version:-:arch:
    architecture: X64
  env:
    FLUTTER_VERSION: 3.0.5
Run $GITHUB_ACTION_PATH/setup.sh -p -c '/Users/runner/hostedtoolcache/flutter/:channel:-:version:-:arch:' -n '3.0.5' -a 'X64' stable
  $GITHUB_ACTION_PATH/setup.sh -p -c '/Users/runner/hostedtoolcache/flutter/:channel:-:version:-:arch:' -n '3.0.5' -a 'X64' stable
  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    FLUTTER_VERSION: 3.0.5
Run actions/cache@v3
  with:
    path: /Users/runner/hostedtoolcache/flutter/stable-3.0.5-x64
    key: flutter-macos-stable-3.0.5-x64-f1875d570e39de09040c8f79aa13cc56baab8db1
  env:
    FLUTTER_VERSION: 3.0.5
Received 0 of 1302283932 (0.0%), 0.0 MBs/sec
Received 54525952 of 1302283932 (4.2%), 25.9 MBs/sec
Received 121634816 of 1302283932 (9.3%), 38.4 MBs/sec
Received 201326592 of 1302283932 (15.5%), 47.7 MBs/sec
Received 289406976 of 1302283932 (22.2%), 54.9 MBs/sec
Received 369098752 of 1302283932 (28.3%), 58.4 MBs/sec
Received 436207616 of 1302283932 (33.5%), 59.1 MBs/sec
Received 499122176 of 1302283932 (38.3%), 59.2 MBs/sec
Received 557842432 of 1302283932 (42.8%), 58.8 MBs/sec
Received 624951296 of 1302283932 (48.0%), 59.3 MBs/sec
Received 683671552 of 1302283932 (52.5%), 59.0 MBs/sec
Received 734003200 of 1302283932 (56.4%), 58.1 MBs/sec
Received 792723456 of 1302283932 (60.9%), 58.0 MBs/sec
Received 826277888 of 1302283932 (63.4%), 56.1 MBs/sec
Received 859832320 of 1302283932 (66.0%), 54.5 MBs/sec
Received 893386752 of 1302283932 (68.6%), 53.1 MBs/sec
Received 918552576 of 1302283932 (70.5%), 51.4 MBs/sec
Received 943718400 of 1302283932 (72.5%), 49.8 MBs/sec
Received 973078528 of 1302283932 (74.7%), 48.6 MBs/sec
Received 1010827264 of 1302283932 (77.6%), 48.0 MBs/sec
Received 1040187392 of 1302283932 (79.9%), 47.0 MBs/sec
Received 1065353216 of 1302283932 (81.8%), 45.9 MBs/sec
Received 1098907648 of 1302283932 (84.4%), 45.3 MBs/sec
Received 1124073472 of 1302283932 (86.3%), 44.4 MBs/sec
Received 1149239296 of 1302283932 (88.2%), 43.6 MBs/sec
Received 1178599424 of 1302283932 (90.5%), 43.0 MBs/sec
Received 1203765248 of 1302283932 (92.4%), 42.3 MBs/sec
Received 1233125376 of 1302283932 (94.7%), 41.7 MBs/sec
Received 1266679808 of 1302283932 (97.3%), 41.4 MBs/sec
Received 1289701020 of 1302283932 (99.0%), 40.8 MBs/sec
Received 1289701020 of 1302283932 (99.0%), 39.4 MBs/sec
.
.
.
.
Received 1289701020 of 1302283932 (99.0%), 0.3 MBs/sec
Received 1289701020 of 1302283932 (99.0%), 0.3 MBs/sec
Warning: Failed to restore: Aborting cache download as the download time exceeded the timeout.
Cache not found for input keys: flutter-macos-stable-3.0.5-x64-f1875d570e39de09040c8f79aa13cc56baab8db1
Run $GITHUB_ACTION_PATH/setup.sh -c '/Users/runner/hostedtoolcache/flutter/stable-3.0.5-x64' -n '3.0.5' -a 'x64' stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0 1203M    0 1806k    0     0  7383k      0  0:02:46 --:--:--  0:02:46 8030k
  9 1203M    9  112M    0     0  90.1M      0  0:00:13  0:00:01  0:00:12 91.5M
 19 1203M   19  239M    0     0   106M      0  0:00:11  0:00:02  0:00:09  107M
 34 1203M   34  412M    0     0   126M      0  0:00:09  0:00:03  0:00:06  127M
 48 1203M   48  587M    0     0   138M      0  0:00:08  0:00:04  0:00:04  139M
 63 1203M   63  766M    0     0   145M      0  0:00:08  0:00:05  0:00:03  152M
 77 1203M   77  932M    0     0   149M      0  0:00:08  0:00:06  0:00:02  164M
 89 1203M   89 1071M    0     0   147M      0  0:00:08  0:00:07  0:00:01  166M
100 1203M  100 1203M    0     0   147M      0  0:00:08  0:00:08 --:--:--  160M

Step in my workflow:

     - name: Install and set Flutter version
        uses: subosito/flutter-action@v2
        with:
          channel: "stable"
          flutter-version: ${{ env.FLUTTER_VERSION }}
          cache: true

Suggested fix:

Set environment variable SEGMENT_DOWNLOAD_TIMEOUT_MINS to 2 as per the documentation of actions/cache

subosito commented 1 year ago

Closing, related to https://github.com/subosito/flutter-action/pull/202