1616 ouisync/target/
1717
1818jobs :
19- test :
20- name : test on ${{ matrix.name }}
21- runs-on : ${{ matrix.os }}
22- strategy :
23- matrix :
24- name : [linux, windows]
25- include :
26- - name : linux
27- os : ubuntu-24.04
28- env :
29- OUISYNC_LIB : ouisync/target/debug/libouisync_service.so
30- analyze : true
19+ test_linux :
20+ name : test on linux
21+ runs-on : self-hosted
3122
32- - name : windows
33- os : windows-latest
34- env :
35- # Install Dokan2.dll to where `flutter test` can find it
36- DOKAN_DLL_OUTPUT_PATH : C:\Windows\System32
37- OUISYNC_LIB : ouisync\target\debug\ouisync_service.dll
38- # FIXME: The mount test fails on windows CI with a panic somewhere in the dokan-rust
39- # crate. Disabling for now but it needs to be looked into.
40- test-args : --exclude-tags mount
23+ steps :
24+ - uses : actions/checkout@v4
25+ with :
26+ submodules : recursive
27+
28+ - name : Create container name
29+ run : echo "CONTAINER=ouisync-unit-test-linux-$GITHUB_RUN_ID" >> $GITHUB_ENV
30+
31+ - name : Start container
32+ run : ./docker/linux.sh --container $CONTAINER --srcdir . --cache start
4133
42- env : ${{ matrix.env }}
34+ - name : Analyze
35+ run : ./docker/linux.sh --container $CONTAINER analyze
36+
37+ - name : Run tests
38+ run : ./docker/linux.sh --container $CONTAINER unit-test
39+
40+ - name : Stop container
41+ run : ./docker/linux.sh --container $CONTAINER stop
42+ if : always()
43+
44+ test_windows :
45+ name : test on windows
46+ runs-on : windows-latest
47+ env :
48+ # Install Dokan2.dll to where `flutter test` can find it
49+ DOKAN_DLL_OUTPUT_PATH : C:\Windows\System32
50+ OUISYNC_LIB : ouisync\target\debug\ouisync_service.dll
4351
4452 steps :
4553 - uses : actions/checkout@v4
@@ -54,18 +62,10 @@ jobs:
5462 key : ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
5563 restore-keys : ${{ runner.os }}-cargo-
5664
57- - name : Install dependencies (linux)
58- run : |
59- sudo apt update -y
60- sudo apt-get install libfuse-dev
61- if : matrix.name == 'linux'
62-
6365 # FIXME: when dokan is installed some tests fail with weird panic from the dokan-rust library.
64- # Disabling for now. See also the comment for the `test-args` variable in the `windows`
65- # strategy.
66+ # Disabling for now. See also the comment in the 'Run tests' step.
6667 # - name: Install dependencies (windows)
6768 # run: choco install dokany2
68- # if: matrix.name == 'windows'
6969
7070 - uses : subosito/flutter-action@v2
7171 with :
@@ -109,25 +109,25 @@ jobs:
109109 - name : " [HACK] Force dokan-sys to build"
110110 run : cargo clean --package dokan-sys
111111 working-directory : ouisync
112- if : matrix.name == 'windows'
113112
114113 - name : Build Ouisync service library for tests
115114 working-directory : ouisync
116115 run : cargo build --package ouisync-service --lib
117116
118117 - name : Run tests
119- run :
120- flutter test ${{ matrix.test-args }}
118+ # FIXME: The mount test fails on windows CI with a panic somewhere in the dokan-rust
119+ # crate. Disabling for now but it needs to be looked into.
120+ run : flutter test --exclude-tags mount
121121
122122 - name : Upload test/debug artifacts
123123 uses : actions/upload-artifact@v4
124124 with :
125125 # Name of the produced zip file
126- name : test-artifacts-${{ matrix.name }}
126+ name : test-artifacts-${{ runner.os }}
127127 path : test/widget/artifacts/*
128128 if-no-files-found : ignore
129- # Upload even when tests fail
130- if : always ()
129+ # Upload when tests fail
130+ if : failure ()
131131
132132 build :
133133 name : build on ${{ matrix.name }}
@@ -280,8 +280,7 @@ jobs:
280280
281281 integration_test_android :
282282 name : " run integration tests on android ${{ matrix.api-level }}"
283- runs-on : ubuntu-24.04
284-
283+ runs-on : self-hosted
285284 strategy :
286285 fail-fast : false
287286 matrix :
@@ -292,10 +291,7 @@ jobs:
292291 # - 25
293292
294293 - 26
295-
296- # This uses different target so it's included explicitly
297- # - 27
298-
294+ - 27
299295 - 28
300296 - 29
301297 - 30
@@ -305,50 +301,27 @@ jobs:
305301 - 34
306302 - 35
307303 - 36
308- target :
309- - google_apis
310- include :
311- - api-level : 27
312- target : default
313- steps :
314-
315- - name : Enable KVM
316- run : |
317- echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
318- sudo udevadm control --reload-rules
319- sudo udevadm trigger --name-match=kvm
320304
305+ steps :
321306 - uses : actions/checkout@v4
322307 with :
323308 submodules : recursive
324309
325- - uses : ./.github/actions/setup_android_tests
326-
327- - name : Prebuild
328- run : flutter build apk --debug --flavor itest --target-platform android-x64
329-
330310 - name : Run tests
331- uses : reactivecircus/android-emulator-runner@v2
332- with :
333- api-level : ${{ matrix.api-level }}
334- target : ${{ matrix.target }}
335- arch : x86_64
336- sdcard-path-or-size : 16M
337- script : |
338- adb logcat -c || true
339- adb logcat > logcat.txt &
340- yes | ./util/adb-format-sdcard.sh
341- flutter test integration_test --flavor itest --ignore-timeouts
342-
343- - name : Upload logcat
344- uses : actions/upload-artifact@v4
345- with :
346- # Name of the produced zip file
347- name : logcat-${{ matrix.api-level }}
348- path : logcat.txt
349- if-no-files-found : ignore
350- # Upload only when the tests fail
351- if : failure() || cancelled()
311+ run : |
312+ ./docker/linux.sh \
313+ --container ouisync-integration-test-android-${{ matrix.api-level }}-$GITHUB_RUN_ID \
314+ integration-test --platform android --api ${{ matrix.api-level }}
315+
316+ # - name: Upload logcat
317+ # uses: actions/upload-artifact@v4
318+ # with:
319+ # # Name of the produced zip file
320+ # name: logcat-${{ matrix.api-level }}
321+ # path: logcat.txt
322+ # if-no-files-found: ignore
323+ # # Upload only when the tests fail
324+ # if: failure() || cancelled()
352325
353326
354327 # TODO: Integration tests on both linux and windows currently fail or hang. Commenting them out until they are fixed.
0 commit comments