forked from vmware-archive/database-stream-processor
-
Notifications
You must be signed in to change notification settings - Fork 0
420 lines (372 loc) · 13.3 KB
/
main.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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
name: Rust
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
# It's really `--all-features`, but not adding `persistence`, we expect the
# persistence feature to go away again in the future (but if we add it
# unconditionally it changes the code that's run significantly)
ALMOST_ALL_FEATURES: --features "with-serde with-csv"
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content_newer'
skip_after_successful_duplicate: 'true'
paths_ignore: '["**/README.md", "**/doc/**"]'
do_not_skip: '["workflow_dispatch", "schedule"]'
tests:
name: Tests
needs: [pre_job, clippy, fmt]
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
# We test the following targets:
# - 64bit Linux stable
# - 64bit Linux beta
# - 64bit Linux nightly
# - 64bit MacOS stable
# - 64bit Windows stable
include:
- {
rust: stable,
target: x86_64-unknown-linux-gnu,
cargo_args: --workspace,
os: [self-hosted, Linux, skylake-2x],
}
- {
rust: stable,
target: x86_64-apple-darwin,
os: macos-latest,
cargo_args: --workspace,
test_flags: --skip kafka
}
- {
rust: stable,
target: x86_64-pc-windows-msvc,
os: windows-latest,
cargo_args: -p dbsp -p dbsp_adapters -p dbsp_pipeline_manager,
test_flags: --skip kafka
}
# `rdkafka` doesn't compile on 32-bit Windows.
# - { rust: stable, target: i686-pc-windows-msvc, os: windows-latest }
- {
rust: beta,
target: x86_64-unknown-linux-gnu,
cargo_args: -p dbsp -p dbsp_adapters -p dbsp_pipeline_manager,
os: ubuntu-latest
}
- {
rust: nightly-2022-11-10,
target: x86_64-unknown-linux-gnu,
cargo_args: -p dbsp -p dbsp_adapters -p dbsp_pipeline_manager,
os: ubuntu-latest,
}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
profile: minimal
default: true
- name: Restore cache
uses: Swatinem/rust-cache@v1
# Don't cache on Windows due to low disk space
if: runner.os != 'Windows'
- name: Install redpanda
if: runner.os == 'Linux'
run: |
curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' | sudo -E bash && \
sudo apt install redpanda -y && \
sudo systemctl start redpanda
# We split building the tests into a separate step
# so that we can easily distinguish between build
# errors and failing tests
- name: Build tests with all features
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ matrix.cargo_args }} --no-run --all-features --target ${{ matrix.target }}
- name: Build tests with no features
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ matrix.cargo_args }} --no-run --no-default-features --target ${{ matrix.target }}
- name: Run tests
if: runner.os != 'Windows'
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ matrix.cargo_args }} ${{ env.ALMOST_ALL_FEATURES }} --target ${{ matrix.target }} -- ${{ matrix.test_flags }}
# Only run basic tests on windows, which tends to run out of resources.
- name: Run tests on Windows
if: runner.os == 'Windows'
uses: actions-rs/cargo@v1
with:
command: test
args: ${{ matrix.cargo_args }} --target ${{ matrix.target }} -- ${{ matrix.test_flags }}
# miri:
# name: Miri
#
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3
#
# - name: Install rust
# uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# profile: minimal
# components: miri, rust-src
# default: true
#
# - name: Restore cache
# uses: Swatinem/rust-cache@v1
#
# - name: Run miri
# uses: actions-rs/cargo@v1
# env:
# OS: ${{ matrix.os }}
# # FIXME: `-Zmiri-preemption-rate=0` is a temporary fix for rust/#55005, remove it when possible
# MIRIFLAGS: "-Zmiri-tag-raw-pointers -Zmiri-disable-isolation -Zmiri-preemption-rate=0"
# with:
# command: miri
# args: test ${{ env.ALMOST_ALL_FEATURES }}
test-sanitizers:
name: Sanitizer Tests
needs: [pre_job, clippy, fmt]
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
max-parallel: 3
# Note: We use this really sketchy matrix because msan doesn't work on macos,
# I would much rather use `matrix.exclude` for this but for some reason
# github actions in its ever-inspired wisdom decided that `include`
# should calculate its combinations *after* `exclude`` is applied
# and since no one could *ever* want to exclude things added by an
# `include` and in their infinite brilliance they saw fit not to have
# any way of excluding things added by an include. In an ideal world I'd
# just write this since it's what makes sense
# ```
# matrix:
# sanitizer: [address, thread, memory, leak]
# include:
# - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
# - { target: x86_64-apple-darwin, os: macos-latest }
# exclude:
# - target: x86_64-apple-darwin
# sanitizer: memory
# ```
# but no, instead we have to do whatever the hell this is
matrix:
os: [skylake-2x, macos-latest]
# The leak sanitizer keeps randomly crashing. Hope we can enable it in
# the future when it's more stable.
# sanitizer: [address, thread, memory, leak]
sanitizer: [address, thread, memory]
target: [x86_64-unknown-linux-gnu] # x86_64-apple-darwin
exclude:
# Exclude ubuntu runs with darwin targets
- { os: skylake-2x, target: x86_64-apple-darwin }
# Exclude macos runs with linux targets
- { os: macos-latest, target: x86_64-unknown-linux-gnu }
# Exclude darwin runs with memory sanitizers since
# it doesn't support msan
- { target: x86_64-apple-darwin, sanitizer: memory }
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-11-10
target: ${{ matrix.target }}
components: rust-src
default: true
- name: Restore cache
uses: Swatinem/rust-cache@v1
- name: Run tests under ${{ matrix.sanitizer }} sanitizer
uses: actions-rs/cargo@v1
env:
RUSTDOCFLAGS: "-Z sanitizer=${{ matrix.sanitizer }}"
RUSTFLAGS: "-Z sanitizer=${{ matrix.sanitizer }}"
ASAN_OPTIONS: detect_stack_use_after_return=1,detect_leaks=1
# Ensure the C++ code (rocksdb etc.) also gets compiled with the correct sanitizer arguments
CC: "clang"
CCFLAGS: "-fsanitize=${{ matrix.sanitizer }}"
CXX: "clang++"
CXXFLAGS: "-fsanitize=${{ matrix.sanitizer }}"
ASAN_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-14"
# Suppress known memory leaks.
LSAN_OPTIONS: "suppressions=lsan.supp"
# Backtraces sometimes mess with sanitizers
RUST_BACKTRACE: 0
# Leak sanitizer is very slow on many of the proptests.
# Additionally, there appears to be a bug in the sanitizer framework
# that causes the leak sanitizer to crash randomly with a large number
# of test threads. Crashes happen in random tests, but always at the
# same location in the sanitizer code:
# https://github.com/llvm-mirror/compiler-rt/blob/69445f095c22aac2388f939bedebf224a6efcdaf/lib/sanitizer_common/sanitizer_thread_registry.h#L104.
# So we run tests one at a time to mitigate this.
THREADS: "${{ matrix.sanitizer == 'leak' && '--test-threads=1' || '' }}"
# Memory sanitizer reports uninitialized reads in `librdkafka`.
SKIP_KAFKA: "${{ (matrix.sanitizer == 'memory' || matrix.sanitizer == 'thread') && '--skip kafka' || '' }}"
with:
command: test
args: --workspace ${{ env.ALMOST_ALL_FEATURES }} --target ${{ matrix.target }} -Z build-std -- --skip 'proptest' --skip 'persistent' ${{ env.SKIP_KAFKA }} ${{ env.THREADS }}
clippy:
name: Clippy
runs-on: ubuntu-latest
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
# Run nightly clippy, which often finds additional issues.
toolchain: nightly-2022-11-10
components: clippy
default: true
- name: Restore cache
uses: Swatinem/rust-cache@v1
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --workspace -- -D warnings
fmt:
name: Rustfmt
runs-on: ubuntu-latest
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
# We use unstable rustfmt features: `wrap_comments` and
# `format_code_in_doc_comments`.
toolchain: nightly-2022-11-10
components: rustfmt
default: true
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
links:
name: Check Doc Links
runs-on: ubuntu-latest
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
- name: Restore cache
uses: Swatinem/rust-cache@v1
- name: Check links
uses: actions-rs/cargo@v1
env:
RUSTRDOCFLAGS: "-D warnings --cfg docsrs"
with:
command: doc
args: --workspace ${{ env.ALMOST_ALL_FEATURES }}
udeps:
name: Unused Dependencies
runs-on: ubuntu-latest
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-11-10
default: true
- name: Restore cache
uses: Swatinem/rust-cache@v1
- name: Install cargo-udeps
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-udeps --locked
- name: Check for unused dependencies
uses: actions-rs/cargo@v1
with:
command: udeps
args: --workspace --all-features --all-targets
python:
name: Test Python API
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 4
matrix:
os: [ubuntu-latest, macos-latest]
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt'
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-11-10
default: true
- name: Build SQL compiler with Maven
run: cd sql-to-dbsp-compiler/SQL-compiler && mvn --batch-mode -DskipTests package
- name: Install cargo-make
uses: actions-rs/cargo@v1
with:
command: install
args: --debug cargo-make
- name: Restore cache
uses: Swatinem/rust-cache@v1
- name: Run Python API test
uses: actions-rs/cargo@v1
with:
command: make
args: --cwd crates/pipeline_manager python_test