-
Notifications
You must be signed in to change notification settings - Fork 23
133 lines (119 loc) · 5.14 KB
/
Copy pathci-cpp.yml
File metadata and controls
133 lines (119 loc) · 5.14 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
name: C++ CI
on:
# No use_local_sdk input: the C++ build always compiles the Rust core from
# local source (BuildRustFfi.cmake runs `cargo build` in ../rust/ffi, which
# depends on ../rust/sdk by path), so there is no released-vs-local mode to
# toggle and no crates.io dependency to patch.
workflow_call:
jobs:
fmt:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
defaults:
run:
working-directory: cpp
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y clang-format
- name: Check formatting
run: make fmt-check
test:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
defaults:
run:
working-directory: cpp
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Get JFrog OIDC token
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/jfrog-oidc-token.sh"
- name: Configure Cargo registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-cargo.sh"
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- name: Build (SDK, tests, examples)
run: make build
- name: Run tests
run: make test
sanitize:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
defaults:
run:
working-directory: cpp
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Get JFrog OIDC token
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/jfrog-oidc-token.sh"
- name: Configure Cargo registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-cargo.sh"
# Nightly + rust-src: the sanitizer build instruments the Rust FFI too
# (BuildRustFfi.cmake), which needs -Zsanitizer + -Zbuild-std.
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # nightly
with:
toolchain: nightly
components: rust-src
# clang: the instrumented Rust archive emits LLVM sanitizer runtime calls,
# so the C++ side must link with clang (GCC's runtime can't resolve them).
# Unpinned; a clang/rustc LLVM mismatch would surface as unresolved
# __tsan_*/__asan_* at link, not silent breakage.
- name: Install clang
run: sudo apt-get update && sudo apt-get install -y clang
# Build the SDK, tests, and examples with AddressSanitizer and run the
# existing suite under it. This catches the memory bugs a thin FFI wrapper
# is prone to (use-after-free, double-free, buffer overflow), in both the
# C++ wrapper and the instrumented Rust core. Debug build for readable
# stack traces.
- name: Build + test with AddressSanitizer
env:
# The Rust core's global tokio runtime is intentionally never torn
# down, so the leak detector would flag it as a false positive.
# Disable leak detection; keep the use-after-free/double-free checks.
ASAN_OPTIONS: detect_leaks=0
run: make test SANITIZE=address BUILD_TYPE=Debug CLANG_CC=clang CLANG_CXX=clang++
sanitize-thread:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest
defaults:
run:
working-directory: cpp
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Get JFrog OIDC token
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/jfrog-oidc-token.sh"
- name: Configure Cargo registry
shell: bash
run: bash "$GITHUB_WORKSPACE/.github/scripts/configure-cargo.sh"
# Nightly + rust-src: the sanitizer build instruments the Rust FFI too
# (BuildRustFfi.cmake), which needs -Zsanitizer + -Zbuild-std.
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # nightly
with:
toolchain: nightly
components: rust-src
# clang: the instrumented Rust archive emits LLVM sanitizer runtime calls,
# so the C++ side must link with clang (GCC's runtime can't resolve them).
# Unpinned; a clang/rustc LLVM mismatch would surface as unresolved
# __tsan_*/__asan_* at link, not silent breakage.
- name: Install clang
run: sudo apt-get update && sudo apt-get install -y clang
# Build + run the suite under ThreadSanitizer over the wrapper's
# concurrency contracts (e.g. concurrent readers on a shared ProtoSchema).
# The Rust FFI is instrumented too, so races inside the core are visible,
# not just on the C++ side. Debug build for readable stack traces.
- name: Build + test with ThreadSanitizer
env:
# Fail the job on the first race rather than merely printing it.
TSAN_OPTIONS: halt_on_error=1
run: make test SANITIZE=thread BUILD_TYPE=Debug CLANG_CC=clang CLANG_CXX=clang++