-
Notifications
You must be signed in to change notification settings - Fork 85
138 lines (130 loc) · 4.84 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Main
on:
push:
branches: [main]
pull_request:
branches: ["**"]
merge_group:
types: [checks_requested]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
Build:
name: ${{ format('{0} {1}', matrix.platform.target, matrix.features)}}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- { target: aarch64-apple-darwin, os: macos-14, test: true }
- { target: x86_64-apple-darwin, os: macos-13, test: true }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-24.04, test: true }
- { target: x86_64-pc-windows-msvc, os: windows-latest, test: true }
- { target: i686-pc-windows-msvc, os: windows-latest, test: false }
- { target: aarch64-pc-windows-msvc, os: windows-latest, test: false }
- {
target: aarch64-unknown-linux-ohos,
os: ubuntu-24.04,
test: false,
}
- { target: arm-linux-androideabi, os: ubuntu-24.04, test: false }
features:
[
"",
"chains sm-raw-window-handle-06",
"chains sm-raw-window-handle-05",
]
include:
- features: "sm-x11 sm-wayland-default"
platform:
{ target: x86_64-unknown-linux-gnu, os: ubuntu-24.04, test: true }
- features: "chains sm-angle-builtin"
platform:
{ target: x86_64-pc-windows-msvc, os: windows-latest, test: true }
- features: "chains sm-no-wgl sm-angle-builtin"
platform:
{ target: x86_64-pc-windows-msvc, os: windows-latest, test: true }
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Linux)
if: startsWith(matrix.platform.os, 'ubuntu')
run: |
sudo apt update
sudo apt install gcc libxxf86vm-dev libosmesa6-dev libgles2-mesa-dev xvfb weston -y
- name: Install rust
id: toolchain
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.platform.target }}
- name: Build
run: |
cargo build --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}
- name: Test
if: ${{ matrix.platform.test && startsWith(matrix.platform.os, 'ubuntu') }}
run: |
weston --no-config --socket=wl-test-env --backend=headless &
WAYLAND_DISPLAY=wl-test-env xvfb-run cargo test --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}
- name: Test
if: ${{ matrix.platform.test && !startsWith(matrix.platform.os, 'ubuntu') }}
run: |
cargo test --features "${{ matrix.features }}" --target ${{ matrix.platform.target }}
android-test:
name: ${{ format('x86_64-linux-android {0}', matrix.features)}}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
features:
[
"",
"chains sm-raw-window-handle-06",
"chains sm-raw-window-handle-05",
]
steps:
- uses: actions/checkout@v4
- name: Install rust
id: toolchain
uses: dtolnay/[email protected]
with:
targets: x86_64-linux-android
- uses: taiki-e/install-action@v2
with:
tool: cargo-dinghy
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Run tests in android emulator
uses: reactivecircus/android-emulator-runner@v2
env:
RANLIB: "${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib"
with:
api-level: 30
arch: x86_64
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
cargo dinghy all-platforms
cargo dinghy all-devices
cargo dinghy -p auto-android-x86_64-api30 --env RUST_BACKTRACE=${{ env.RUST_BACKTRACE }} test --features "${{ matrix.features }}" -- --test-threads 1
Format:
name: Run `rustfmt`
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: mkroening/rust-toolchain-toml@main
- run: cargo fmt --check
build_result:
name: Result
runs-on: ubuntu-24.04
needs: ["Build", "android-test", "Format"]
if: always()
steps:
- name: Mark the job as successful
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
run: exit 0
- name: Mark the job as unsuccessful
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1