flutter-action icon indicating copy to clipboard operation
flutter-action copied to clipboard

Arm64 runners support

Open ferraridamiano opened this issue 10 months ago • 8 comments
trafficstars

Github just released arm64 actions for linux. I tried to setup flutter with flutter-action on ubuntu-24.04-arm but it failed. Will you add support also for arm runners?

Here is the error:

Run subosito/flutter-action@v2
  with:
    channel: stable
    cache: true
    architecture: ARM6[4](https://github.com/ferraridamiano/prova/actions/runs/12855298558/job/35840677162#step:4:4)
    pub-cache-path: default
    dry-run: false
Run chmod +x "$GITHUB_ACTION_PATH/setup.sh"
  chmod +x "$GITHUB_ACTION_PATH/setup.sh"
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
Run $GITHUB_ACTION_PATH/setup.sh -p \
  $GITHUB_ACTION_PATH/setup.sh -p \
    -n '' \
    -f '' \
    -a 'ARM[6](https://github.com/ferraridamiano/prova/actions/runs/12855298558/job/35840677162#step:4:6)4' \
    -k '' \
    -c '' \
    -l '' \
    -d 'default' \
    stable
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
Unable to determine Flutter version for channel: stable version: any architecture: arm64
Error: Process completed with exit code 1.

ferraridamiano avatar Jan 19 '25 16:01 ferraridamiano

The official does not provide linux arm64 build, you can use snap instead

The official support deployment on linux-arm64 and provide dart-sdk-linux-arm64(3.24.5 SDK example). It should be possible if you don't reference release_linux.json.

Npepperlinux avatar Jan 22 '25 02:01 Npepperlinux

So It should be possible to include it in this action?

ferraridamiano avatar Jan 22 '25 06:01 ferraridamiano

Here's an alternative way to install Flutter for Linux that works on ARM. I've tested this on ubuntu-24.04-arm and it's working as expected.

3.27.3 is the latest Flutter version as of writing this. You can replace 3.27.3 in the clone command below with your preferred Flutter version.

jobs:
  build-linux:
    # If you want to run the same action on x86 and ARM, you can use a matrix strategy
    strategy:
      matrix:
        os: [ubuntu-latest, ubuntu-24.04-arm]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Check out repository
        uses: actions/checkout@v4

      - name: Install dependencies from Apt
        run: |
          sudo apt-get update -y && sudo apt-get upgrade -y;

          # These packages are listed in the setup instructions for Linux desktop. They may not all be necessary.
          # For reference: https://docs.flutter.dev/get-started/install/linux/desktop
          sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev

      - name: Clone Flutter
        run: |
          # Shallow-clone Flutter to reduce download size
          git clone --depth 1 --branch 3.27.3 https://github.com/flutter/flutter.git $RUNNER_TEMP/flutter

          # Add Flutter to PATH
          echo "$RUNNER_TEMP/flutter/bin" >> $GITHUB_PATH

      - name: Install Flutter
        # Running "flutter doctor" will download Flutter's dependencies
        run: flutter doctor
      
      # More steps here...

If you want to use the same clone strategy on Windows, the code is similar:

jobs:
  build-windows:
    runs-on: [windows-latest]
    steps:
      - name: Check out repository
        uses: actions/checkout@v4

      - name: Clone Flutter
        run: |
          # Shallow-clone Flutter to reduce download size
          git clone --depth 1 --branch 3.27.3 https://github.com/flutter/flutter.git $env:RUNNER_TEMP\flutter

          # Add Flutter to PATH
          Add-Content $env:GITHUB_PATH "$env:RUNNER_TEMP\flutter\bin"
      
      - name: Install Flutter
        # Running "flutter doctor" will download Flutter's dependencies
        run: flutter doctor

      # More steps here...

josh-audio avatar Feb 05 '25 23:02 josh-audio

you don't need to manually git clone, u just

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: master
      flutter-version: 3.24.0
  - run: flutter --version

then linux arm works

pugaizai avatar Feb 13 '25 17:02 pugaizai

Thanks for your solution @pugaizai. It works!

The issue with this action occurs when it's configured to use a flutter channel other than master.

ferraridamiano avatar Feb 15 '25 15:02 ferraridamiano

HI, how can I make it work with the latest version on stable? It only works when you set the flutter-version, but I need to use latest to avoid update the ci. In my case is with Apple M4 chip

MiniSuperDev avatar Apr 03 '25 09:04 MiniSuperDev

you don't need to manually git clone, u just

steps:
  - name: Clone repository
    uses: actions/checkout@v4
  - name: Set up Flutter
    uses: subosito/flutter-action@v2
    with:
      channel: master
      flutter-version: 3.24.0
  - run: flutter --version

then linux arm works

~With this I am getting an error as:~

The following required packages were not found:
   - gtk+-3.0

~After installing all the libs then this works.~

~Here is the runner log - https://github.com/akshaybabloo/flutter_arm_test/actions/runs/14263080900/job/39978830950~

I had to install libraries via apt and it worked.

akshaybabloo avatar Apr 04 '25 10:04 akshaybabloo

Latest version with stable chanel not working:

Runner log: https://github.com/hurelhuyag/flutter-arm64-action-demo/actions/runs/14819702105/job/41604983691

hurelhuyag avatar May 04 '25 09:05 hurelhuyag

@ferraridamiano is correct it will not work if channel is set to other than master

very inconvenient, I need to create another x64 instance for flutter build

kadenchoi-halo avatar Aug 27 '25 08:08 kadenchoi-halo

HI, how can I make it work with the latest version on stable? It only works when you set the flutter-version, but I need to use latest to avoid update the ci. In my case is with Apple M4 chip

@MiniSuperDev i think you can try to set flutter-version: stable

pugaizai avatar Aug 27 '25 08:08 pugaizai

Blocked because of https://github.com/flutter/flutter/issues/164431 Arm Builds currently are not run on stable, only on master. Also need to call flutter doctor as resources must be fetched manually then.

Gustl22 avatar Sep 23 '25 22:09 Gustl22

Even on master the x64 builds were downloaded as fallback as the arm64 builds were not present. If you experience the The current channel's Dart SDK does not support Windows Arm64, falling back to Windows x64... message (on flutter doctor) this was probably the case.

In https://github.com/flutter/flutter/commit/1c6c6f46118450ddc98cac8ff367d345b455efc0 the engine artifacts are now also uploaded. So one can pin to this commit to get it working. Alternatively one can set the FLUTTER_PREBUILT_ENGINE_VERSION to any flutter commit, so it is forced to take a presubmit engine version.

Gustl22 avatar Oct 09 '25 06:10 Gustl22