-
Notifications
You must be signed in to change notification settings - Fork 6
278 lines (278 loc) · 9.41 KB
/
ci.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
278
name: CI
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
find-msrv:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.step2.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: step2
run: echo "version=`cat Cargo.toml | sed -n 's/rust-version = "\(.*\)"/\1/p'`" >> "$GITHUB_OUTPUT"
benchmarks:
runs-on: ubuntu-latest
needs: [clippy,no-unused-dependencies]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Cache cargo home
uses: actions/cache@v3
env:
cache-name: cache-cargo-home
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-
- name: Compile benchmarks (1k)
run: cargo bench --no-run --bench event_parsing
- name: Compile benchmarks (100k)
run: cargo bench --no-run --bench event_parsing_100k
clippy:
runs-on: ubuntu-latest
needs: [rustfmt,no-unused-dependencies,wasm-compatible-common-crate]
name: nightly Clippy
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Cache cargo home
uses: actions/cache@v3
env:
cache-name: cache-cargo-home
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-
- name: Install nightly
uses: dtolnay/rust-toolchain@master
with:
components: clippy
toolchain: nightly
- name: Clippy
run: cargo clippy --tests --workspace --no-deps -- -D warnings
tests:
runs-on: ubuntu-latest
needs: [clippy,no-unused-dependencies]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Cache cargo home
uses: actions/cache@v3
env:
cache-name: cache-cargo-home
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install Dependencies
run: |
sudo apt -y install at-spi2-core systemd
- name: Run Tests (tokio)
run: cargo test --workspace --no-default-features --features=tokio -- --nocapture
- name: Run Tests (async-std)
run: cargo test --workspace --no-default-features --features=async-std -- --nocapture
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Run formatter
run: cargo fmt --all --check
rustdoc:
runs-on: ubuntu-latest
needs: [clippy,no-unused-dependencies]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Cache cargo home
uses: actions/cache@v3
env:
cache-name: cache-cargo-home
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Generate Documentation
run: cargo doc --workspace --no-deps --document-private-items
cargo-deny:
runs-on: ubuntu-latest
needs: [rustfmt]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Cache cargo home
uses: actions/cache@v3
env:
cache-name: cache-cargo-home
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install Deny
uses: taiki-e/install-action@cargo-deny
- name: Check For Unsuitable Licenses
run: cargo deny check licenses
- name: Check For Known Security Vulnerabilities
run: cargo deny check advisories
- name: Check For Unknown Repositories
run: cargo deny check sources
no-unused-dependencies:
runs-on: ubuntu-latest
needs: [rustfmt]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Cache cargo home
uses: actions/cache@v3
env:
cache-name: cache-cargo-home
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install Cargo Machete
uses: taiki-e/install-action@cargo-machete
- name: Check For Unused Dependencies
run: cargo machete
semver-compliance:
runs-on: ubuntu-latest
needs: [clippy,no-unused-dependencies]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Cache cargo home
uses: actions/cache@v3
env:
cache-name: cache-cargo-home
with:
path: |
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-x86_64-unknown-linux-gnu-build-${{ env.cache-name }}-
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install Semver Checks
# no default features so that it uses native Rust TLS instead of trying to link with system TLS.
uses: taiki-e/install-action@main
with:
tool: cargo-semver-checks
- name: Check Semver Compliance
run: cargo semver-checks check-release -p atspi --default-features
msrv-compliance:
runs-on: ubuntu-latest
needs: [clippy,no-unused-dependencies,find-msrv]
steps:
- name: install stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ needs.find-msrv.outputs.version }}
- name: Git checkout
uses: actions/checkout@v3
- name: Check MSRV Compliance
run: cargo test --workspace --no-run --all-features
wasm-compatible-common-crate:
runs-on: ubuntu-latest
needs: [rustfmt]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install WASM target(s)
run: rustup target add wasm32-wasip1 && rustup target add wasm32-unknown-unknown
- name: Test Common Compilation (wasm32-unknown-unknown)
run: cargo build -p atspi-common --no-default-features --target wasm32-unknown-unknown
- name: Test Common Compilation (wasm32-wasip1)
run: cargo build -p atspi-common --no-default-features --target wasm32-wasip1
coverage:
runs-on: ubuntu-latest
needs: [clippy,no-unused-dependencies]
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Install nightly
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: llvm-tools-preview
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: Install Dependencies
run: |
sudo apt -y install at-spi2-core systemd
- name: cargo llvm-cov
run: cargo llvm-cov --workspace --locked --lcov --output-path lcov.info
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}