|
84 | 84 | env: |
85 | 85 | TSAN_OPTIONS: "halt_on_error=0 history_size=7 second_deadlock_stack=1 suppressions=${{ github.workspace }}/cmake/tsan.supp" |
86 | 86 | 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 |
0 commit comments