Skip to content

Commit ce91b0c

Browse files
committed
chore: enable integration test on windows and linux
1 parent 7ed36f8 commit ce91b0c

File tree

3 files changed

+86
-12
lines changed

3 files changed

+86
-12
lines changed

.github/actions/flutter_build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ runs:
9898

9999
- uses: actions/upload-artifact@v4
100100
with:
101-
name: ${{ github.run_id }}-${{ matrix.os }}
101+
name: ${{ github.run_id }}-${{ inputs.os }}
102102
path: appflowy_flutter.tar.gz

.github/actions/flutter_integration_test/action.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Flutter Integration Test
22
description: Run integration tests for AppFlowy
33

44
inputs:
5+
os:
6+
description: "The OS to run the tests on"
7+
required: true
58
test_path:
69
description: "The path to the integration test file"
710
required: true
@@ -49,20 +52,32 @@ runs:
4952
- name: Install prerequisites
5053
working-directory: frontend
5154
run: |
52-
sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
53-
sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
54-
sudo apt-get update
55-
sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev network-manager
55+
if [ "$RUNNER_OS" == "Linux" ]; then
56+
sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
57+
sudo wget -qO /etc/apt/sources.list.d/dart_stable.list https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list
58+
sudo apt-get update
59+
sudo apt-get install -y dart curl build-essential libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev network-manager
60+
elif [ "$RUNNER_OS" == "Windows" ]; then
61+
vcpkg integrate install
62+
elif [ "$RUNNER_OS" == "macOS" ]; then
63+
echo 'do nothing'
64+
fi
5665
shell: bash
5766

5867
- name: Enable Flutter Desktop
5968
run: |
60-
flutter config --enable-linux-desktop
69+
if [ "$RUNNER_OS" == "Linux" ]; then
70+
flutter config --enable-linux-desktop
71+
elif [ "$RUNNER_OS" == "Windows" ]; then
72+
flutter config --enable-windows-desktop
73+
elif [ "$RUNNER_OS" == "macOS" ]; then
74+
flutter config --enable-macos-desktop
75+
fi
6176
shell: bash
6277

6378
- uses: actions/download-artifact@v4
6479
with:
65-
name: ${{ github.run_id }}-ubuntu-latest
80+
name: ${{ github.run_id }}-${{ inputs.os }}
6681

6782
- name: Uncompressed appflowy_flutter
6883
run: tar -xf appflowy_flutter.tar.gz
@@ -71,8 +86,14 @@ runs:
7186
- name: Run Flutter integration tests
7287
working-directory: frontend/appflowy_flutter
7388
run: |
74-
export DISPLAY=:99
75-
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
76-
sudo apt-get install network-manager
77-
flutter test ${{ inputs.test_path }} -d Linux --coverage
89+
if [ "$RUNNER_OS" == "Linux" ]; then
90+
export DISPLAY=:99
91+
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
92+
sudo apt-get install network-manager
93+
flutter test ${{ inputs.test_path }} -d Linux --coverage
94+
elif [ "$RUNNER_OS" == "Windows" ]; then
95+
flutter test ${{ inputs.test_path }} -d Windows --coverage
96+
elif [ "$RUNNER_OS" == "macOS" ]; then
97+
flutter test ${{ inputs.test_path }} -d macOS --coverage
98+
fi
7899
shell: bash

.github/workflows/flutter_ci.yaml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ jobs:
339339
flutter test integration_test/desktop/cloud/cloud_runner.dart -d Linux --coverage
340340
shell: bash
341341

342-
integration_test:
342+
linux_integration_test:
343343
needs: [prepare-linux]
344344
if: github.event.pull_request.draft != true
345345
strategy:
@@ -358,6 +358,59 @@ jobs:
358358
- name: Flutter Integration Test ${{ matrix.test_number }}
359359
uses: ./.github/actions/flutter_integration_test
360360
with:
361+
os: ${{ matrix.os }}
362+
test_path: integration_test/desktop_runner_${{ matrix.test_number }}.dart
363+
flutter_version: ${{ env.FLUTTER_VERSION }}
364+
rust_toolchain: ${{ env.RUST_TOOLCHAIN }}
365+
cargo_make_version: ${{ env.CARGO_MAKE_VERSION }}
366+
rust_target: ${{ matrix.target }}
367+
368+
windows_integration_test:
369+
needs: [prepare-windows]
370+
if: github.event.pull_request.draft != true
371+
strategy:
372+
fail-fast: false
373+
matrix:
374+
os: [windows-latest]
375+
test_number: [1, 2, 3, 4, 5, 6, 7, 8, 9]
376+
include:
377+
- os: windows-latest
378+
target: "x86_64-pc-windows-msvc"
379+
runs-on: ${{ matrix.os }}
380+
steps:
381+
- name: Checkout source code
382+
uses: actions/checkout@v4
383+
384+
- name: Flutter Integration Test ${{ matrix.test_number }}
385+
uses: ./.github/actions/flutter_integration_test
386+
with:
387+
os: ${{ matrix.os }}
388+
test_path: integration_test/desktop_runner_${{ matrix.test_number }}.dart
389+
flutter_version: ${{ env.FLUTTER_VERSION }}
390+
rust_toolchain: ${{ env.RUST_TOOLCHAIN }}
391+
cargo_make_version: ${{ env.CARGO_MAKE_VERSION }}
392+
rust_target: ${{ matrix.target }}
393+
394+
macos_integration_test:
395+
needs: [prepare-macos]
396+
if: github.event.pull_request.draft != true
397+
strategy:
398+
fail-fast: false
399+
matrix:
400+
os: [macos-latest]
401+
test_number: [1, 2, 3, 4, 5, 6, 7, 8, 9]
402+
include:
403+
- os: macos-latest
404+
target: "x86_64-apple-darwin"
405+
runs-on: ${{ matrix.os }}
406+
steps:
407+
- name: Checkout source code
408+
uses: actions/checkout@v4
409+
410+
- name: Flutter Integration Test ${{ matrix.test_number }}
411+
uses: ./.github/actions/flutter_integration_test
412+
with:
413+
os: ${{ matrix.os }}
361414
test_path: integration_test/desktop_runner_${{ matrix.test_number }}.dart
362415
flutter_version: ${{ env.FLUTTER_VERSION }}
363416
rust_toolchain: ${{ env.RUST_TOOLCHAIN }}

0 commit comments

Comments
 (0)