-
Notifications
You must be signed in to change notification settings - Fork 13
274 lines (235 loc) · 8.61 KB
/
ci.yml
File metadata and controls
274 lines (235 loc) · 8.61 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: CI
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
env:
TOOLCHAIN: nightly
CARGO_TERM_COLOR: always
ANDROID_API: 33
ANDROID_NDK_VERSION: 25.2.9519653
ANDROID_SYSTEM_IMAGE_PACKAGE: system-images;android-33;google_apis_playstore;arm64-v8a
OPENSSL_VERSION: 1.1.1s
HOMEBREW_NO_AUTO_UPDATE: 1
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cargo fmt
run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cargo fmt
run: cargo clippy -- -Dwarnings
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: typos-cli
- name: run typos
run: typos
- name: Typos info
if: failure()
run: |
echo 'To fix typos, please run `typos -w`'
echo 'To check for a diff, run `typos`'
echo 'You can find typos here: https://crates.io/crates/typos'
apple_simulator_integration_tests:
runs-on: macos-15
strategy:
fail-fast: false
matrix:
rust-target: ["aarch64-apple-ios-sim"]
apple-target-os: ["iOS"]
build-std: [""]
include:
- rust-target: "aarch64-apple-tvos-sim"
apple-target-os: "tvOS"
build-std: "-Zbuild-std"
- rust-target: "aarch64-apple-watchos-sim"
apple-target-os: "watchOS"
build-std: "-Zbuild-std"
steps:
- uses: actions/checkout@v4
- uses: ./tests/support/test_server/
# needs nightly for now as some ios targets require -Zbuild-std
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "nightly"
components: rust-src
targets: aarch64-apple-ios-sim
- name: Cache Cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
key: cargo-${{ github.workflow }}-${{ github.job}}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-dinghy@0.7.1
- name: Start Simulator
uses: futureware-tech/simulator-action@v4
with:
os: ${{ matrix.apple-target-os }}
- name: Build tests for ${{ matrix.rust-target }}
run: cargo ${{ matrix.build-std }} test --target ${{ matrix.rust-target }} --no-run
- name: Dinghy devices and platforms for ${{ matrix.rust-target }}
env:
DINGHY_LOG: debug
run: |
cargo dinghy all-platforms
cargo dinghy all-devices
- name: Test for for ${{ matrix.rust-target }}
env:
DINGHY_LOG: debug
SIMCTL_CHILD_RUST_LOG: trace
SIMCTL_CHILD_RUST_BACKTRACE: full
timeout-minutes: 30
run: |
cargo ${{ matrix.build-std }} test --target ${{ matrix.rust-target }} -- -- --test-threads 1
- name: Build phoenix_channel_clients with tls
run: cargo build ${{ matrix.build-std }} --target ${{ matrix.rust-target }} --features native-tls
- name: Phx server logs
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}-${{ matrix.rust-target }}
path: |
tests/support/test_server/server.stdout.txt
tests/support/test_server/server.stderr.txt
/Users/runner/Library/Developer/CoreSimulator/Devices/*/data/Containers/Bundle/Application/*/Dinghy.app/stdout
uniffi-check:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
key: cargo-${{ github.workflow }}-${{ github.job}}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build static library
run: cargo build --lib --release # For some unclear reason, the release build has better errors.
- name: Generate swift bindings
run: |
cargo run --bin uniffi-bindgen -- generate --library ./target/release/libphoenix_channels_client.dylib --out-dir ./binding-swift/ --language swift
- name: Generate kotlin bindings
run: |
cargo run --bin uniffi-bindgen -- generate --library ./target/release/libphoenix_channels_client.dylib --out-dir ./binding-kotlin/ --language kotlin
integration_tests:
# rust cross-compilation
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: ./tests/support/test_server/
- uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
key: cargo-${{ github.workflow }}-${{ github.job}}-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build phoenix_channels_client
run: cargo build --all-targets
- name: Generate docs for phoenix_channel_clients
run: cargo doc
- name: Get JNA jar
run: wget 'https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar'
- name: Set up Elixir, kotlin and ktlint
if: ${{ runner.os == 'macOS' }}
run: brew install ktlint
- name: Test phoenix_channel_clients
env:
# This is required for the kotlin uniffi tests
CLASSPATH: "/opt/homebrew/opt/kotlin/libexec/lib/kotlinx-coroutines-core-jvm.jar:./jna-5.14.0.jar"
run: cargo test
android_simulator_integration_tests:
# rust cross-compilation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./tests/support/test_server/
- name: Install Rust Nightly
uses: dtolnay/rust-toolchain@stable
with:
target: x86_64-linux-android
- name: Cache Cargo
uses: actions/cache@v5
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
key: cargo-${{ github.workflow }}-${{ github.job }}-${{runner.os}}-${{runner.arch}}-${{ hashFiles('**/Cargo.lock') }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-dinghy@0.7.1
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
- 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: Gradle cache
uses: gradle/actions/setup-gradle@v4
- name: AVD cache
uses: actions/cache@v5
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.ANDROID_API }}-${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{runner.arch}}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_API }}
ndk: ${{ env.ANDROID_NDK_VERSION }}
force-avd-creation: false
target: google_apis
arch: x86_64
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- 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: ${{ env.ANDROID_API }}
ndk: ${{ env.ANDROID_NDK_VERSION }}
target: google_apis
arch: x86_64
force-avd-creation: false
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
export RUSTFLAGS="--cfg tokio_unstable"
cargo dinghy -p auto-android-x86_64-api${ANDROID_API} test