12
12
CARGO_TERM_COLOR : always
13
13
14
14
jobs :
15
- Build :
15
+ android-test :
16
16
name : ${{ format('{0} {1}', matrix.platform.target, matrix.features)}}
17
- runs-on : ${{ matrix.platform.os }}
17
+ runs-on : ubuntu-24.04
18
18
env :
19
19
RUST_BACKTRACE : 1
20
20
strategy :
21
21
fail-fast : false
22
22
matrix :
23
23
platform :
24
- # - { target: aarch64-apple-darwin, os: macos-14, test: true }
25
- # - { target: x86_64-apple-darwin, os: macos-13, test: true }
26
- # - { target: x86_64-unknown-linux-gnu, os: ubuntu-24.04, test: true }
27
- # - { target: x86_64-pc-windows-msvc, os: windows-latest, test: true }
28
- # - { target: i686-pc-windows-msvc, os: windows-latest, test: false }
29
- # - { target: aarch64-pc-windows-msvc, os: windows-latest, test: false }
30
- # - {
31
- # target: aarch64-unknown-linux-ohos,
32
- # os: ubuntu-24.04,
33
- # test: false,
34
- # }
35
- - { target: arm-linux-androideabi, os: ubuntu-24.04, test: true }
36
- - { target: aarch64-linux-android, os: ubuntu-24.04, test: true }
37
- - { target: armv7-linux-androideabi, os: ubuntu-24.04, test: true }
38
- - { target: x86_64-linux-android, os: ubuntu-24.04, test: true }
24
+ - { target: aarch64-linux-android, arch: arm64-v8a }
25
+ - { target: x86_64-linux-android, arch: x86_64 }
39
26
features :
40
27
[
41
28
" " ,
42
29
" chains sm-raw-window-handle-06" ,
43
30
" chains sm-raw-window-handle-05" ,
44
31
]
45
- # include:
46
- # - features: "sm-x11 sm-wayland-default"
47
- # platform:
48
- # { target: x86_64-unknown-linux-gnu, os: ubuntu-24.04, test: true }
49
- # - features: "chains sm-angle-builtin"
50
- # platform:
51
- # { target: x86_64-pc-windows-msvc, os: windows-latest, test: true }
52
- # - features: "chains sm-no-wgl sm-angle-builtin"
53
- # platform:
54
- # { target: x86_64-pc-windows-msvc, os: windows-latest, test: true }
55
32
steps :
56
33
- uses : actions/checkout@v4
57
- - name : Install dependencies (Linux)
58
- if : startsWith(matrix.platform.os, 'ubuntu')
59
- run : |
60
- sudo apt update
61
- sudo apt install gcc libxxf86vm-dev libosmesa6-dev libgles2-mesa-dev xvfb weston -y
62
34
- name : Set up JDK 17
63
- if : ${{ contains(matrix.platform.target, 'android') }}
64
35
uses : actions/setup-java@v4
65
36
with :
66
37
java-version : " 17"
67
38
distribution : " temurin"
68
39
- name : Setup Android SDK
69
- if : ${{ contains(matrix.platform.target, 'android') }}
70
40
uses : android-actions/setup-android@v3
71
41
with :
72
42
packages : " tools platform-tools platforms;android-33"
73
43
- name : Install Android NDK
74
- if : ${{ contains(matrix.platform.target, 'android') }}
75
44
uses : nttld/setup-ndk@v1
76
45
id : setup-ndk
77
46
with :
@@ -81,26 +50,60 @@ jobs:
81
50
uses : dtolnay/rust-toolchain@1.81.0
82
51
with :
83
52
targets : ${{ matrix.platform.target }}
84
- - name : Build
85
- run : |
86
- cargo build --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}
87
- - name : Test
88
- if : ${{ matrix.platform.test && startsWith(matrix.platform.os, 'ubuntu') && !contains(matrix.platform.target, 'android') }}
89
- run : |
90
- weston --no-config --socket=wl-test-env --backend=headless &
91
- WAYLAND_DISPLAY=wl-test-env xvfb-run cargo test --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}
92
- - name : Test
93
- if : ${{ matrix.platform.test && !startsWith(matrix.platform.os, 'ubuntu') && !contains(matrix.platform.target, 'android') }}
53
+
54
+ - uses : taiki-e/install-action@v2
55
+ with :
56
+ tool : cargo-dinghy
57
+
58
+ - name : Enable KVM
94
59
run : |
95
- cargo test --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}
96
- - name : Test
97
- if : ${{ matrix.platform.test && contains(matrix.platform.target, 'android') }}
60
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
61
+ sudo udevadm control --reload-rules
62
+ sudo udevadm trigger --name-match=kvm
63
+
64
+ - name : AVD cache
65
+ uses : actions/cache@v4
66
+ id : avd-cache
67
+ with :
68
+ path : |
69
+ ~/.android/avd/*
70
+ ~/.android/adb*
71
+ key : avd-30-${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{runner.arch}}
72
+
73
+ - name : Create directory for avd
74
+ # This shouldn't be necesary but this is a work around for
75
+ # https://github.com/ReactiveCircus/android-emulator-runner/issues/197
76
+ if : steps.avd-cache.outputs.cache-hit != 'true'
77
+ run : mkdir -p ~/.android/avd
78
+
79
+ - name : Create AVD and generate snapshot for caching
80
+ if : steps.avd-cache.outputs.cache-hit != 'true'
81
+ uses : reactivecircus/android-emulator-runner@v2
82
+ with :
83
+ api-level : 30
84
+ ndk : ${{ steps.setup-ndk.outputs.ndk-full-version }}
85
+ force-avd-creation : false
86
+ arch : ${{ matrix.platform.arch }}
87
+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
88
+ disable-animations : false
89
+ script : echo "Generated AVD snapshot for caching."
90
+
91
+ - name : Run tests in android emulator
92
+ uses : reactivecircus/android-emulator-runner@v2
98
93
env :
94
+ RANLIB : " ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib"
99
95
ANDROID_NDK_HOME : ${{ steps.setup-ndk.outputs.ndk-path }}
100
- run : |
101
- cargo install cargo-dinghy
102
- cargo dinghy all-platforms
103
- cargo dinghy test --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}
96
+ with :
97
+ api-level : 30
98
+ ndk : ${{ steps.setup-ndk.outputs.ndk-full-version }}
99
+ arch : ${{ matrix.platform.arch }}
100
+ force-avd-creation : false
101
+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
102
+ disable-animations : true
103
+ script : |
104
+ cargo dinghy all-platforms
105
+ cargo dinghy all-devices
106
+ cargo dinghy -p auto-android-${{ matrix.platform.arch }}-api30 test --features "${{ matrix.features }}" -- --test-threads 1
104
107
Format :
105
108
name : Run `rustfmt`
106
109
runs-on : ubuntu-24.04
@@ -111,7 +114,7 @@ jobs:
111
114
build_result :
112
115
name : Result
113
116
runs-on : ubuntu-24.04
114
- needs : ["Build ", "Format"]
117
+ needs : ["android-test ", "Format"]
115
118
if : always()
116
119
steps :
117
120
- name : Mark the job as successful
0 commit comments