-
Notifications
You must be signed in to change notification settings - Fork 151
234 lines (223 loc) · 10.1 KB
/
rust-instrumented.yml
File metadata and controls
234 lines (223 loc) · 10.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
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
name: Rust Instrumented
# Concurrency control:
# - PRs: new commits on a feature branch will cancel in-progress (outdated) runs.
# - Push to develop: runs queue sequentially, never cancelled.
# - `workflow_dispatch`: groups by branch and queues if run on develop.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/develop' }}
on:
push:
branches: [develop]
pull_request: { }
workflow_dispatch: { }
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
NIGHTLY_TOOLCHAIN: nightly-2026-02-05
jobs:
rust-coverage:
name: "Rust tests (coverage) (${{ matrix.suite }})"
timeout-minutes: 30
permissions:
id-token: write
strategy:
matrix:
include:
- suite: tests
runs-on: >-
${{ github.repository == 'vortex-data/vortex'
&& format('runs-on={0}/runner=amd64-large/image=ubuntu24-full-x64-pre-v2/tag=rust-coverage-suite-{1}', github.run_id, matrix.suite)
|| 'ubuntu-latest' }}
env:
RUSTFLAGS: "-Cinstrument-coverage -A warnings"
CARGO_INCREMENTAL: 0 # Disable incremental compilation to get accurate coverage
LLVM_PROFILE_FILE: "target/coverage/vortex-%p-%m.profraw"
GRCOV_OUTPUT_FILE: "target/coverage/vortex.lcov"
steps:
- uses: runs-on/action@v2
if: github.repository == 'vortex-data/vortex'
with:
sccache: s3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-prebuild
- name: Rust Tests
if: ${{ matrix.suite == 'tests' }}
run: |
cargo nextest run --locked --workspace --all-features --no-fail-fast
- name: Generate coverage report
run: |
grcov . --binary-path target/debug/ -s . -t lcov --llvm --ignore-not-existing \
--threads $(nproc) \
--ignore '../*' --ignore '/*' --ignore 'fuzz/*' --ignore 'vortex-bench/*' \
--ignore 'home/*' --ignore 'xtask/*' --ignore 'target/*' --ignore 'vortex-error/*' \
--ignore 'vortex-python/*' --ignore 'vortex-jni/*' --ignore 'vortex-flatbuffers/*' \
--ignore 'vortex-proto/*' --ignore 'vortex-tui/*' --ignore 'vortex-datafusion/examples/*' \
--ignore 'vortex-ffi/examples/*' --ignore '*/arbitrary/*' --ignore '*/arbitrary.rs' --ignore 'vortex-cxx/*' \
--ignore benchmarks/* --ignore 'vortex-test/*' \
-o ${{ env.GRCOV_OUTPUT_FILE }}
- name: Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
with:
name: run-${{ matrix.suite }}
files: ${{ env.GRCOV_OUTPUT_FILE }}
disable_search: true
flags: ${{ matrix.suite }}
use_oidc: true
rust-test-sanitizer:
strategy:
fail-fast: false
matrix:
include:
# We don't run memory sanitizer as it provides many false positives
# for std
- sanitizer: asan
sanitizer_flags: "-Zsanitizer=address,leak"
- sanitizer: tsan
sanitizer_flags: "-Zsanitizer=thread"
name: "Rust tests (${{ matrix.sanitizer }})"
runs-on: >-
${{ github.repository == 'vortex-data/vortex'
&& format('runs-on={0}/pool=amd64-medium-pre-v2/tag=rust-test-sanitizer', github.run_id)
|| 'ubuntu-latest' }}
timeout-minutes: 30
env:
ASAN_OPTIONS: "symbolize=1:check_initialization_order=1:detect_leaks=1:leak_check_at_exit=1"
LSAN_OPTIONS: "report_objects=1"
ASAN_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer"
MSAN_OPTIONS: "symbolize=1"
MSAN_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer"
TSAN_OPTIONS: "symbolize=1:suppressions=${{ github.workspace }}/vortex-ffi/tsan_suppressions.txt"
TSAN_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer"
VORTEX_SKIP_SLOW_TESTS: "1"
# -Cunsafe-allow-abi-mismatch=sanitizer: libraries like compiler_builtins
# unset -Zsanitizer flag and we should allow that.
RUSTFLAGS: "-A warnings -Cunsafe-allow-abi-mismatch=sanitizer -C debuginfo=2 -C opt-level=0 -C strip=none"
steps:
- uses: runs-on/action@v2
if: github.repository == 'vortex-data/vortex'
with:
sccache: s3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-prebuild
- name: Install Rust nightly toolchain
run: |
rustup toolchain install $NIGHTLY_TOOLCHAIN
rustup component add --toolchain $NIGHTLY_TOOLCHAIN rust-src rustfmt clippy llvm-tools-preview
- name: Build tests with sanitizer
run: |
RUSTFLAGS="${RUSTFLAGS} ${{ matrix.sanitizer_flags }}" \
cargo +$NIGHTLY_TOOLCHAIN build --locked --all-features \
--target x86_64-unknown-linux-gnu -Zbuild-std \
-p vortex-buffer -p vortex-fastlanes -p vortex-fsst -p vortex-alp -p vortex-array
- name: Run tests with sanitizer
run: |
RUSTFLAGS="${RUSTFLAGS} ${{ matrix.sanitizer_flags }}" \
cargo +$NIGHTLY_TOOLCHAIN nextest run --locked --all-features \
--target x86_64-unknown-linux-gnu --no-fail-fast -Zbuild-std \
-p vortex-buffer -p vortex-fastlanes -p vortex-fsst -p vortex-alp -p vortex-array
# vortex-ffi requires --no-default-features as otherwise we pull in
# Mimalloc which interferes with sanitizers
# cargo nextest reports less sanitizer issues than cargo test
# TODO(myrrc): remove --no-default-features once we make Mimalloc opt-in
- name: Run vortex-ffi tests with sanitizer
run: |
RUSTFLAGS="${RUSTFLAGS} ${{ matrix.sanitizer_flags }}" \
cargo +$NIGHTLY_TOOLCHAIN test --locked --no-default-features \
--target x86_64-unknown-linux-gnu --no-fail-fast -Zbuild-std \
-p vortex-ffi -- --no-capture
rust-ffi-test-sanitizer:
strategy:
fail-fast: false
matrix:
include:
# We don't run memory sanitizer as it's clang-only and provides many
# false positives for Catch2
- sanitizer: asan
sanitizer_flags: "-Zsanitizer=address,leak"
- sanitizer: tsan
sanitizer_flags: "-Zsanitizer=thread"
name: "Rust/C++ FFI tests (${{ matrix.sanitizer }})"
timeout-minutes: 30
env:
ASAN_OPTIONS: "symbolize=1:check_initialization_order=1:detect_leaks=1:leak_check_at_exit=1"
LSAN_OPTIONS: "report_objects=1"
ASAN_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer"
MSAN_OPTIONS: "symbolize=1"
MSAN_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer"
TSAN_OPTIONS: "symbolize=1:suppressions=${{ github.workspace }}/vortex-ffi/tsan_suppressions.txt"
TSAN_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer"
VORTEX_SKIP_SLOW_TESTS: "1"
# -Cunsafe-allow-abi-mismatch=sanitizer: libraries like compiler_builtins
# unset -Zsanitizer flag and we should allow that.
runs-on: >-
${{ github.repository == 'vortex-data/vortex'
&& format('runs-on={0}/runner=amd64-medium/image=ubuntu24-full-x64-pre-v2/tag=rust-ffi-test-sanitizer', github.run_id)
|| 'ubuntu-latest' }}
steps:
- uses: runs-on/action@v2
if: github.repository == 'vortex-data/vortex'
with:
sccache: s3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-prebuild
- name: Install rustfilt
run: |
cargo install rustfilt
- name: Install Rust nightly toolchain
run: |
rustup toolchain install $NIGHTLY_TOOLCHAIN
rustup component add --toolchain $NIGHTLY_TOOLCHAIN rust-src rustfmt clippy llvm-tools-preview
- name: Build FFI library
run: |
# TODO(myrrc): remove --no-default-features
RUSTFLAGS="-A warnings -Cunsafe-allow-abi-mismatch=sanitizer \
-C debuginfo=2 -C opt-level=0 -C strip=none -Zexternal-clangrt \
${{ matrix.sanitizer_flags }}" \
cargo +$NIGHTLY_TOOLCHAIN build --locked --no-default-features \
--target x86_64-unknown-linux-gnu -Zbuild-std \
-p vortex-ffi
- name: Build FFI library tests and examples
run: |
cd vortex-ffi
cmake -Bbuild -DBUILD_TESTS=1 -DBUILD_EXAMPLES=1 -DSANITIZER=${{ matrix.sanitizer }} -DTARGET_TRIPLE="x86_64-unknown-linux-gnu"
cmake --build build -j
- name: Run tests
run: |
set -o pipefail
./vortex-ffi/build/test/vortex_ffi_test 2>&1 | rustfilt
- name: Run examples
run: |
set -o pipefail
# Failed to create data source: Object store error: Generic LocalFileSystem
# error: Unable to walk dir: File system loop found
rm -fr vortex-ffi/build/_deps/nanoarrow-src/python
./vortex-ffi/build/examples/write_sample file.vortex 2>&1 | rustfilt
./vortex-ffi/build/examples/write_sample file2.vortex 2>&1 | rustfilt
./vortex-ffi/build/examples/dtype '*.vortex' 2>&1 | rustfilt
./vortex-ffi/build/examples/scan '*.vortex' 2>&1 | rustfilt
./vortex-ffi/build/examples/scan_to_arrow '*.vortex' 2>&1 | rustfilt
miri:
name: "Rust tests (miri)"
runs-on: >-
${{ github.repository == 'vortex-data/vortex'
&& format('runs-on={0}/runner=amd64-medium/image=ubuntu24-full-x64-pre-v2/tag=rust-miri', github.run_id)
|| 'ubuntu-latest' }}
timeout-minutes: 30
env:
MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-disable-isolation -Zmiri-env-forward=RUST_BACKTRACE
RUSTFLAGS: "-A warnings"
RUST_BACKTRACE: full
steps:
- uses: runs-on/action@v2
if: github.repository == 'vortex-data/vortex'
with:
sccache: s3
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-prebuild
- name: Install nightly with miri
run: rustup toolchain install $NIGHTLY_TOOLCHAIN --component rust-src,rustfmt,clippy,miri
- name: Run Miri
run: cargo +$NIGHTLY_TOOLCHAIN miri nextest run --no-fail-fast -p vortex-buffer -p vortex-ffi