如何通过Github Actions CI在Linux桌面上自动化测试Flutter应用程序

7
我们希望能够通过Github Actions在Linux桌面上(ubuntu-latest)使我们的集成测试正常运行。
命令是:
flutter config --enable-linux-desktop
flutter test -d linux integration_test

但是我们总是会遇到错误:

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

Github Actions无法通过CPU快速处理GPU / GUI相关内容吗?这是可能的吗? 我只找到了一个存储库在Linux环境下调用类似命令的存储库。 谢谢!
3个回答

0

我正在使用 GabrielBB/xvfb-action@v1.6 的 Github 操作来启用 xvfb。

      - name: flutter test
        uses: GabrielBB/xvfb-action@v1.6
        with:
          working-directory: ./examples/flutter
          run: |
            flutter config --enable-linux-desktop
            flutter test integration_test/basics_test.dart -d linux

0

0

我看到了这个问题,其中在一个答案中提到了Xvfb,它起作用了:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接