Skip to content

Commit cef339d

Browse files
committed
Add rust-example CI job
Builds libroqr-ffi and roqr-relayd, builds examples/rust with warnings as errors, and runs the example against a relay in echo mode as an end-to-end smoke test (asserts all frames are echoed back). Relies on the Rust toolchain preinstalled on ubuntu-latest. Documented in the guide's CI table.
1 parent a35fb70 commit cef339d

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,45 @@ jobs:
8484
env:
8585
TSAN_OPTIONS: "halt_on_error=0 history_size=7 second_deadlock_stack=1 suppressions=${{ github.workspace }}/cmake/tsan.supp"
8686
run: ctest --test-dir build --output-on-failure --timeout 300
87+
88+
rust-example:
89+
name: rust ffi example
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v4
93+
- name: Install dependencies
94+
run: sudo apt-get update && sudo apt-get install -y
95+
cmake g++ ninja-build libssl-dev openssl
96+
- name: Build picoquic deps
97+
run: eval "$(scripts/setup_picoquic_deps.sh)"
98+
# Build only what the example needs: the FFI shared library and the relay.
99+
- name: Build libroqr-ffi and roqr-relayd
100+
run: |
101+
eval "$(scripts/setup_picoquic_deps.sh)"
102+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug \
103+
-DROQR_BUILD_QUIC=ON -DROQR_BUILD_RTMP=ON -DROQR_BUILD_TOOLS=ON \
104+
-DROQR_BUILD_FFI=ON -DROQR_BUILD_EXAMPLES=OFF \
105+
-DROQR_BUILD_TESTS=OFF -DROQR_BUILD_JNI=OFF
106+
cmake --build build --target roqr-ffi roqr-relayd --parallel
107+
# ubuntu-latest ships a stable Rust toolchain; no install step needed.
108+
- name: Build the Rust example
109+
env:
110+
ROQR_FFI_LIB_DIR: ${{ github.workspace }}/build/ffi
111+
RUSTFLAGS: "-D warnings"
112+
run: cargo build --manifest-path examples/rust/Cargo.toml
113+
# End-to-end: the example connects to a relay in echo mode and must get
114+
# every frame back. build.rs baked an rpath to ROQR_FFI_LIB_DIR, so the
115+
# binary finds libroqr-ffi.so without LD_LIBRARY_PATH.
116+
- name: Echo round-trip smoke test
117+
run: |
118+
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \
119+
-keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=localhost"
120+
./build/bin/roqr-relayd --cert cert.pem --key key.pem --port 4443 --mode echo &
121+
relay_pid=$!
122+
trap 'kill "$relay_pid" 2>/dev/null || true' EXIT
123+
sleep 2
124+
set +e
125+
examples/rust/target/debug/roqr-rust-client 127.0.0.1 4443
126+
rc=$?
127+
set -e
128+
exit $rc

docs/guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ network-thread callbacks — suppressing it could hide a real callback race.
131131
| `core-only (no picoquic)` | Builds and tests just the sans-I/O core (`ROQR_BUILD_QUIC=OFF`). |
132132
| `full (gcc)` / `full (clang)` | Full build with QUIC, tools, examples; runs the whole suite including the ffmpeg e2e tests. |
133133
| `thread-sanitizer (clang)` | Full build with `ROQR_SANITIZE=thread`; runs the suite under TSAN with the suppressions file. A race in ROQR code fails the job. |
134+
| `rust ffi example` | Builds `libroqr-ffi` and `roqr-relayd`, builds `examples/rust` (warnings-as-errors), and runs the example against a relay in echo mode as an end-to-end smoke test. |
134135

135136
### Project layout
136137

0 commit comments

Comments
 (0)