-
-
Notifications
You must be signed in to change notification settings - Fork 258
179 lines (143 loc) · 5.1 KB
/
ci.yml
File metadata and controls
179 lines (143 loc) · 5.1 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# Code quality checks
quality:
name: Quality Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Cache dependencies
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Install typos-cli
uses: taiki-e/install-action@205eb1d74c6feda89abb1f3a09360601953286c0 # v2.68.18
with:
tool: typos-cli
- name: Check for typos
run: typos
- name: Install cargo-deny
uses: taiki-e/install-action@205eb1d74c6feda89abb1f3a09360601953286c0 # v2.68.18
with:
tool: cargo-deny
- name: Run cargo-deny
run: cargo deny check
- name: Install cargo-machete
uses: taiki-e/install-action@205eb1d74c6feda89abb1f3a09360601953286c0 # v2.68.18
with:
tool: cargo-machete
- name: Run cargo-machete
run: cargo machete
# Test on multiple platforms with different Rust versions
test:
name: Test ${{ matrix.os }} - ${{ matrix.rust }} ${{ matrix.features != '' && format('({0})', matrix.features) || '' }}
runs-on: ${{ matrix.os }}
needs: quality
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
rust: [stable, nightly, 1.85]
include:
# MacOS with fsevent
- os: macos-latest
rust: stable
features: "--no-default-features --features macos_fsevent"
- os: macos-latest
rust: nightly
features: "--no-default-features --features macos_fsevent"
- os: macos-latest
rust: 1.85
features: "--no-default-features --features macos_fsevent"
# MacOS with kqueue
- os: macos-latest
rust: stable
features: "--no-default-features --features macos_kqueue"
- os: macos-latest
rust: nightly
features: "--no-default-features --features macos_kqueue"
- os: macos-latest
rust: 1.85
features: "--no-default-features --features macos_kqueue"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Remove rust-toolchain.toml (Unix)
if: runner.os != 'Windows'
run: rm -f rust-toolchain.toml
- name: Remove rust-toolchain.toml (Windows)
if: runner.os == 'Windows'
run: |
if (Test-Path rust-toolchain.toml) {
Remove-Item -Path rust-toolchain.toml
}
- name: Install Rust ${{ matrix.rust }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Cache dependencies
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Build
run: cargo build --verbose
- name: Build examples
run: cargo build --examples --verbose
- name: Run tests
run: cargo test --verbose
- name: Run tests with futures
if: matrix.rust == 'stable'
run: cargo test --verbose --features futures
- name: Run tests with tokio
if: matrix.rust == 'stable'
run: cargo test --verbose --features tokio
# Android cross-compilation
android:
name: Android
runs-on: ubuntu-latest
needs: quality
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Remove rust-toolchain.toml
run: rm -f rust-toolchain.toml
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: armv7-linux-androideabi, aarch64-linux-android
- name: Cache dependencies
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Install cargo-ndk
uses: taiki-e/install-action@205eb1d74c6feda89abb1f3a09360601953286c0 # v2.68.18
with:
tool: cargo-ndk
- name: Build for Android (arm64)
run: cargo ndk --target aarch64-linux-android build --verbose
- name: Build for Android (arm)
run: cargo ndk --target armv7-linux-androideabi build --verbose
# # WebAssembly System Interface (WASI)
# wasi:
# name: WASI
# runs-on: ubuntu-latest
# needs: quality
# steps:
# - uses: actions/checkout@v4
# - name: Remove rust-toolchain.toml
# run: rm -f rust-toolchain.toml
# - name: Install Rust
# uses: dtolnay/rust-toolchain@nightly
# with:
# targets: wasm32-wasip2
# - name: Cache dependencies
# uses: Swatinem/rust-cache@v2
# - name: Build for WASI
# run: cargo build --target wasm32-wasip2 --verbose
# - name: Build examples for WASI
# run: cargo build --examples --target wasm32-wasip2 --verbose