-
Notifications
You must be signed in to change notification settings - Fork 22
294 lines (290 loc) · 11 KB
/
pull-request.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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# ================= THIS FILE IS AUTOMATICALLY GENERATED =================
#
# Please run generate.sh and commit after editing the workflow templates.
#
# ========================================================================
name: CI
on:
pull_request:
branches: [main]
env:
RUST_TOOLCHAIN_NIGHTLY: nightly-2024-03-17
CARGO_TERM_COLOR: always
CACHE_KEY_SUFFIX: 20240621
jobs:
misc-check:
name: misc check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run typos check
uses: crate-ci/typos@master
- name: Install yq
run: |
wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${BINARY}.tar.gz -O - | tar xz && sudo mv ${BINARY} /usr/bin/yq
env:
YQ_VERSION: v4.16.1
BINARY: yq_linux_amd64
BUF_VERSION: 1.0.0-rc6
- name: Install jq
uses: dcarbone/[email protected]
- name: Check if CI workflows are up-to-date
run: |
./.github/template/generate.sh --check
- name: Check if Grafana dashboards are minimized
run: |
./scripts/minimize-dashboards.sh --check
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
rust-udeps:
name: rust udeps test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- name: Cache Cargo home
uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ env.CACHE_KEY_SUFFIX }}-rust-udeps
- name: Install cargo-udeps
if: steps.cache.outputs.cache-hit != 'true'
run: |
cargo install cargo-udeps --locked
- name: Unused Dependencies Check
env:
RUSTFLAGS: "--cfg tokio_unstable -Awarnings"
run: "cargo udeps --all-targets \n"
rust-test:
name: rust test with codecov
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
rust_toolchain: [stable, 1.77]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_toolchain }}
components: rustfmt, clippy, llvm-tools-preview
- name: Cache Cargo home
uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ env.CACHE_KEY_SUFFIX }}-rust-test
- name: Install cargo tools
if: steps.cache.outputs.cache-hit != 'true'
run: |
cargo install cargo-sort --locked
- name: Run rust cargo-sort check
run: |
cargo sort -w -c
- name: Run rust format check
run: |
cargo fmt --all -- --check
- name: Run rust clippy check
run: |
cargo clippy --all-targets --features tokio-console -- -D warnings
cargo clippy --all-targets --features deadlock -- -D warnings
cargo clippy --all-targets --features mtrace -- -D warnings
cargo clippy --all-targets -- -D warnings
- if: steps.cache.outputs.cache-hit != 'true'
uses: taiki-e/install-action@cargo-llvm-cov
- if: steps.cache.outputs.cache-hit != 'true'
uses: taiki-e/install-action@nextest
- name: Run rust test with coverage (igored tests)
env:
RUST_BACKTRACE: 1
CI: true
run: |
cargo llvm-cov --no-report nextest --run-ignored ignored-only --no-capture --workspace --features "strict_assertions,sanity"
- name: Run rust test with coverage
env:
RUST_BACKTRACE: 1
CI: true
run: |
cargo llvm-cov --no-report nextest --features "strict_assertions,sanity"
- name: Run examples with coverage
env:
RUST_BACKTRACE: 1
CI: true
run: |
cargo llvm-cov --no-report run --example memory
cargo llvm-cov --no-report run --example hybrid
cargo llvm-cov --no-report run --example hybrid_full
cargo llvm-cov --no-report run --example event_listener
- name: Run foyer-bench with coverage
if: matrix.os == 'ubuntu-latest'
env:
RUST_BACKTRACE: 1
CI: true
run: |
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-bench/codecov
cargo llvm-cov --no-report run --package foyer-bench --bin foyer-bench --features "strict_assertions,sanity" -- --dir $GITHUB_WORKSPACE/foyer-data/foyer-bench/codecov --mem 16 --disk 256 --file-size 16 --get-range 1000 --w-rate 1 --r-rate 1 --admission-rate-limit 10 --time 60
- name: Generate codecov report
run: |
cargo llvm-cov report --lcov --output-path lcov.info
- uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest' && matrix.rust_toolchain == 'stable'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
verbose: true
deadlock:
name: run with single worker thread and deadlock detection
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Cache Cargo home
uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ env.CACHE_KEY_SUFFIX }}-deadlock
- name: Run foyer-bench with single worker thread and deadlock detection
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "--cfg tokio_unstable"
RUST_LOG: info
TOKIO_WORKER_THREADS: 1
CI: true
run: |-
cargo build --all --features deadlock
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-storage/deadlock
timeout 2m ./target/debug/foyer-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-bench/deadlock --mem 16 --disk 256 --file-size 16 --get-range 1000 --w-rate 1 --r-rate 1 --admission-rate-limit 10 --time 60
asan:
name: run with address saniziter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
- name: Cache Cargo home
uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ env.CACHE_KEY_SUFFIX }}-asan
- name: Run Unit Tests With Address Sanitizer
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "-Zsanitizer=address --cfg tokio_unstable"
RUST_LOG: info
CI: true
run: |-
cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture
- name: Run foyer-bench With Address Sanitizer
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "-Zsanitizer=address --cfg tokio_unstable"
RUST_LOG: info
CI: true
run: |-
cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} build --all --target x86_64-unknown-linux-gnu
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-bench/asan
timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-bench/asan --mem 16 --disk 256 --file-size 16 --get-range 1000 --w-rate 1 --r-rate 1 --admission-rate-limit 10 --time 60
- name: Prepare Artifacts on Failure
if: ${{ failure() }}
run: |-
find ./target/x86_64-unknown-linux-gnu/debug/ -type f -executable -name 'foyer*' -print0 | xargs -0 tar czvf artifacts.asan.tgz --transform 's#.*/##'
- name: Upload Artifacts on Failure
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: artifacts.asan.tgz
path: artifacts.asan.tgz
lsan:
name: run with leak saniziter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN_NIGHTLY }}
- name: Cache Cargo home
uses: actions/cache@v4
id: cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ env.CACHE_KEY_SUFFIX }}-lsan
- name: Run Unit Tests With Leak Sanitizer
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "-Zsanitizer=leak --cfg tokio_unstable"
RUST_LOG: info
CI: true
run: |-
cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} test --lib --bins --tests --target x86_64-unknown-linux-gnu -- --nocapture
- name: Run foyer-bench With Leak Sanitizer
env:
RUST_BACKTRACE: 1
RUSTFLAGS: "-Zsanitizer=leak --cfg tokio_unstable"
RUST_LOG: info
CI: true
run: |-
cargo +${{ env.RUST_TOOLCHAIN_NIGHTLY }} build --all --target x86_64-unknown-linux-gnu
mkdir -p $GITHUB_WORKSPACE/foyer-data/foyer-bench/lsan
timeout 2m ./target/x86_64-unknown-linux-gnu/debug/foyer-bench --dir $GITHUB_WORKSPACE/foyer-data/foyer-bench/lsan --mem 16 --disk 256 --file-size 16 --get-range 1000 --w-rate 1 --r-rate 1 --admission-rate-limit 10 --time 60
- name: Prepare Artifacts on Failure
if: ${{ failure() }}
run: |-
find ./target/x86_64-unknown-linux-gnu/debug/ -type f -executable -name 'foyer*' -print0 | xargs -0 tar czvf artifacts.lsan.tgz --transform 's#.*/##'
- name: Upload Artifacts on Failure
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: artifacts.lsan.tgz
path: artifacts.lsan.tgz
concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: true
# ================= THIS FILE IS AUTOMATICALLY GENERATED =================
#
# Please run generate.sh and commit after editing the workflow templates.
#
# ========================================================================