-
-
Notifications
You must be signed in to change notification settings - Fork 394
278 lines (240 loc) · 9.03 KB
/
rust.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
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
275
276
277
name: CI
on:
push:
branches: ['main', '0.8.x']
pull_request:
merge_group:
schedule:
- cron: "21 3 * * 5"
jobs:
test-freebsd:
# see https://github.com/actions/runner/issues/385
# use https://github.com/vmactions/freebsd-vm for now
name: test on freebsd
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: test on freebsd
uses: vmactions/freebsd-vm@v1
with:
usesh: true
mem: 4096
copyback: false
prepare: |
pkg install -y curl
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable
run: |
export PATH="$HOME/.cargo/bin:$PATH"
echo "===== rustc --version ====="
rustc --version
echo "===== freebsd-version ====="
freebsd-version
cargo build --all-targets && cargo test && cargo test --manifest-path fuzz/Cargo.toml && cargo test -p quinn-udp --benches
test-netbsd:
name: test on netbsd
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: test on netbsd
uses: vmactions/netbsd-vm@v1
with:
usesh: true
mem: 4096
copyback: false
prepare: |
export PATH="/usr/sbin:/sbin:$PATH"
pkg_add curl
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable
run: |
export PATH="$HOME/.cargo/bin:$PATH"
echo "===== rustc --version ====="
rustc --version
echo "===== uname -a ====="
uname -a
cargo build --all-targets && cargo test && cargo test --manifest-path fuzz/Cargo.toml && cargo test -p quinn-udp --benches
test-solaris:
name: test on solaris
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: test on Solaris
uses: vmactions/solaris-vm@v1
with:
release: "11.4-gcc"
usesh: true
mem: 4096
copyback: false
prepare: |
source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install)
echo "~~~~ rustc --version ~~~~"
rustc --version
echo "~~~~ Solaris-version ~~~~"
uname -a
run: |
export PATH=$HOME/.rust_solaris/bin:$PATH
cargo build --all-targets && cargo test && cargo test --manifest-path fuzz/Cargo.toml && cargo test -p quinn-udp --benches
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [stable, beta]
exclude:
- os: macos-latest
rust: beta
- os: windows-latest
rust: beta
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --all-targets
- run: cargo test
- run: cargo test --manifest-path fuzz/Cargo.toml
if: ${{ matrix.rust }} == "stable"
- run: cargo test -p quinn-udp --benches
test-aws-lc-rs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Prevent feature unification from selecting *ring* as the crypto provider
- run: RUST_BACKTRACE=1 cargo test --manifest-path quinn-proto/Cargo.toml --no-default-features --features rustls-aws-lc-rs
- run: RUST_BACKTRACE=1 cargo test --manifest-path quinn/Cargo.toml --no-default-features --features rustls-aws-lc-rs,runtime-tokio
# FIPS
- run: RUST_BACKTRACE=1 cargo test --manifest-path quinn-proto/Cargo.toml --no-default-features --features rustls-aws-lc-rs-fips
- run: RUST_BACKTRACE=1 cargo test --manifest-path quinn/Cargo.toml --no-default-features --features rustls-aws-lc-rs-fips,runtime-tokio
wasm_test:
name: test wasm32-unknown-unknown
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Add wasm target
run: rustup target add wasm32-unknown-unknown
- name: Install nodejs v20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup `wasm-tools`
uses: bytecodealliance/actions/wasm-tools/setup@v1
- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main
# We need to downgrade cc to version 1.1.31 for ring Wasm compilation to work.
# See the upstream issue https://github.com/rust-lang/cc-rs/issues/1275
- name: Use working `cc` version 1.1.31
run: cargo update -p cc --precise 1.1.31
- name: build wasm32 tests (quinn-proto)
run: cargo test -p quinn-proto --target wasm32-unknown-unknown --no-run
# If the Wasm file contains any 'import "env"' declarations, then
# some non-Wasm-compatible code made it into the final code.
- name: Check for 'import "env"' in Wasm
run: |
! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/deps/quinn_proto-*.wasm | grep 'import "env"'
- name: Install wasm-bindgen-test-runner
run: cargo binstall wasm-bindgen-cli --locked --no-confirm
- name: wasm32 test (quinn-proto)
run: cargo test -p quinn-proto --target wasm32-unknown-unknown
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo check --lib --all-features -p quinn-udp -p quinn-proto -p quinn
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- run: cargo check --manifest-path quinn/Cargo.toml --all-targets --no-default-features
- run: cargo clippy --all-targets -- -D warnings
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: doc
run: cargo doc --no-deps --document-private-items
env:
RUSTDOCFLAGS: -Dwarnings
- name: lint fuzz
run: |
cd fuzz
cargo clippy -- -D warnings
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
test-android:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: x86_64-linux-android
emulator-arch: x86_64
# Note that x86_64 image is only available for API 21+. See
# https://github.com/ReactiveCircus/android-emulator-runner?tab=readme-ov-file#configurations.
api-level: 26
- target: i686-linux-android
emulator-arch: x86
api-level: 26
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
- name: Install Android SDK
uses: android-actions/setup-android@v3
- name: Install Android NDK
run: sdkmanager --install "ndk;25.2.9519653"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install cargo-ndk
run: cargo install cargo-ndk
- name: Build unit tests for Android
run: cargo ndk -t ${{ matrix.target }} test --no-run
- name: Enable KVM group perms
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: Set up Android Emulator and run tests
env:
TARGET: ${{ matrix.target }}
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: ${{ matrix.emulator-arch }}
script: .github/workflows/rust-android-run-tests-on-emulator.sh
features:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -Dwarnings
# skip FIPS features outside of Linux
SKIP_FEATURES: ${{ matrix.os != 'ubuntu-latest' && 'rustls-aws-lc-rs-fips,aws-lc-rs-fips' || '' }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- run: cargo hack check --feature-powerset --optional-deps --no-dev-deps --ignore-unknown-features --ignore-private --group-features runtime-async-std,async-io,async-std --group-features runtime-smol,async-io,smol --skip "${{env.SKIP_FEATURES}}"