diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38d69eb..f428a4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -134,7 +134,63 @@ jobs: - name: Run tests with coverage run: cargo llvm-cov --all-features - + + example-test: + name: Example test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # install nodejs + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install uv + uses: astral-sh/setup-uv@v6 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Set up Python + run: uv python install + + - name: Create venv for python + run: uv venv + + - uses: Swatinem/rust-cache@v2 + + - name: Add target WASI preview 2 + run: | + rustup target add wasm32-wasip2 + + - name: Build examples + run: | + for dir in examples/*/ ; do + if [ -f "$dir/Cargo.toml" ]; then + echo "Building $dir" + + if [[ "$dir" == *"wasi"* ]]; then + cargo build --manifest-path "$dir/Cargo.toml" --target wasm32-wasip2 + else + cargo build --manifest-path "$dir/Cargo.toml" --all-features --tests + fi + fi + done + + - name: Run tests in examples + run: | + # Tests are run for each subdirectory in the example directory. + for dir in examples/*/ ; do + if [ -f "$dir/Cargo.toml" ]; then + if [[ "$dir" != *"wasi"* ]]; then + echo "Testing $dir" + cargo test --manifest-path "$dir/Cargo.toml" --all-features + fi + fi + done + security_audit: name: Security Audit runs-on: ubuntu-latest diff --git a/examples/rig-integration/Cargo.toml b/examples/rig-integration/Cargo.toml index a8af25a..dc52da3 100644 --- a/examples/rig-integration/Cargo.toml +++ b/examples/rig-integration/Cargo.toml @@ -16,6 +16,7 @@ rig-core = "0.10.0" tokio = { version = "1", features = ["full"] } rmcp = { path = "../../crates/rmcp", features = [ "client", + "reqwest", "transport-child-process", "transport-sse-client", ] }