How to automate testing of Flutter application on Linux-Desktop via Github Actions CI
Asked Answered
D

3

7

We want to make our integration tests work on Linux desktop (ubuntu-latest) via Github Actions.

The command is

flutter config --enable-linux-desktop
flutter test -d linux integration_test

But we always get an error:

Error waiting for a debug connection: The log reader stopped unexpectedly, or never started.
//...
TestDeviceException(Unable to start the app on the device.)
  package:flutter_tools/src/test/integration_test_device.dart 61:7  IntegrationTestTestDevice.start

Can Github Actions not handle the GPU / GUI related stuff fast enough on the CPU or what is going on. Is this even possible? I found only one repository which call similar command for a linux environment.

Thanks!

Decorous answered 30/4, 2022 at 19:0 Comment(0)
D
-1

I saw this question, where Xvfb was mentioned in an answer, it worked:

jobs:
  linux:
    runs-on: ubuntu-latest
    ...
    steps:
        run: |
          export DISPLAY=:99
          sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
          flutter test -d linux integration_test
Decorous answered 30/4, 2022 at 22:53 Comment(2)
GHA workflow never ends. It gets stuck I think . awaiting connection to test device is the last log in GHADerivation
It works great on our pipeline though: github.com/bluefireteam/audioplayers/blob/…Decorous
O
1

This was enough for me -

xvfb-run flutter test -d linux integration_test

xvfb is pre-installed on Ubuntu 22.04 Runner Image.

Credits -

  1. FrBrGeorge's answer to another question
Ottar answered 5/7, 2023 at 12:27 Comment(0)
A
0

I am using the GabrielBB/[email protected] github action to enable xvfb.

      - name: flutter test
        uses: GabrielBB/[email protected]
        with:
          working-directory: ./examples/flutter
          run: |
            flutter config --enable-linux-desktop
            flutter test integration_test/basics_test.dart -d linux
Armenian answered 18/10, 2022 at 23:3 Comment(0)
D
-1

I saw this question, where Xvfb was mentioned in an answer, it worked:

jobs:
  linux:
    runs-on: ubuntu-latest
    ...
    steps:
        run: |
          export DISPLAY=:99
          sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
          flutter test -d linux integration_test
Decorous answered 30/4, 2022 at 22:53 Comment(2)
GHA workflow never ends. It gets stuck I think . awaiting connection to test device is the last log in GHADerivation
It works great on our pipeline though: github.com/bluefireteam/audioplayers/blob/…Decorous

© 2022 - 2024 — McMap. All rights reserved.