Files
openworker/.github/workflows/rust-sdk.yml

299 lines
13 KiB
YAML

name: Rust SDK
on:
pull_request:
paths: ["harness/**", "docs/harness/**", "deploy/**", ".github/workflows/rust-sdk.yml"]
push:
branches: [main, openworker-harness-sdk]
paths: ["harness/**", "docs/harness/**", "deploy/**", ".github/workflows/rust-sdk.yml"]
workflow_dispatch:
permissions:
contents: read
jobs:
arcade-and-layout:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Public layout and retained transport tests
run: node --test harness/tests/release-layout.test.mjs harness/tests/stdio-client.test.mjs harness/desktop-starters/test.mjs harness/service-ui/test/observability.test.mjs harness/service-ui/test/server.test.mjs
- name: Build SDK and flagship app without launching Electron
run: |
npm --prefix harness/typescript-sdk ci
npm --prefix harness/typescript-sdk run build
npm --prefix harness/examples/arcade ci --ignore-scripts
npm --prefix harness/examples/arcade test
npm --prefix harness/examples/arcade run build
native-desktop:
strategy:
fail-fast: false
matrix:
os: [macos-15, windows-2022]
runs-on: ${{ matrix.os }}
timeout-minutes: 35
defaults:
run:
working-directory: harness
shell: bash
env:
CARGO_BUILD_JOBS: 2
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Find Windows Clang
if: runner.os == 'Windows'
shell: pwsh
run: |
$clang = Get-ChildItem 'C:\Program Files\LLVM\bin\clang.exe','C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin\clang.exe' -ErrorAction SilentlyContinue | Select-Object -First 1
if (!$clang) { throw 'Clang is required for the native Rust dependencies' }
$clang.DirectoryName >> $env:GITHUB_PATH
- name: Compile and test the native Rust desktop host
timeout-minutes: 25
run: |
rustup show active-toolchain
cargo test --locked -p openworker-sdk --features test-support --lib --test registration_errors --test desktop_api --test agent_team --test attachments -- --test-threads=1
cargo test --locked -p openworker-sdk --features test-support --test tool_free responses_embedded
cargo test --locked -p openworker-runtime --lib direct::windows::tests -- --test-threads=1
cargo test --locked -p openworker-runtime --test windows --test connections --test model_endpoints --test direct_macos --test coding --test coding_extended --test assistant
cargo test --locked -p openworker-sdk --features test-support --test coding --test assistant -- --test-threads=1
- name: Build TypeScript SDK and test transport
timeout-minutes: 5
run: |
npm --prefix typescript-sdk ci
npm --prefix typescript-sdk test
npm --prefix typescript-sdk run test:observability
if [ "$RUNNER_OS" = Windows ]; then
echo "OW_TS_TEST_HOST=$(pwd -W)/target/debug/sdk-test-host.exe" >> "$GITHUB_ENV"
else
echo "OW_TS_TEST_HOST=$PWD/target/debug/sdk-test-host" >> "$GITHUB_ENV"
fi
- name: TypeScript named teams and restart
timeout-minutes: 5
run: node --test --test-reporter=tap typescript-sdk/test/agent-team.test.mjs
- name: TypeScript callbacks, approvals and crash recovery
timeout-minutes: 5
run: node --test --test-reporter=tap typescript-sdk/test/desktop-api.test.mjs typescript-sdk/test/registration-errors.test.mjs
- name: TypeScript coding and assistant tools
timeout-minutes: 5
run: node --test --test-reporter=tap typescript-sdk/test/coding.test.mjs typescript-sdk/test/assistant.test.mjs
- name: Desktop starters and release contracts
timeout-minutes: 3
run: |
node --test desktop-starters/test.mjs
node --test tests/stdio-client.test.mjs tests/release-layout.test.mjs
lint:
runs-on: ubuntu-24.04
timeout-minutes: 45
defaults:
run:
working-directory: harness
env:
CARGO_BUILD_JOBS: 2
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v4
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- name: Load pinned Rust toolchain
run: rustup show active-toolchain
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: harness/typescript-sdk/package-lock.json
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
harness/target
key: rust-sdk-v2-lint-${{ runner.os }}-${{ hashFiles('harness/Cargo.lock', 'harness/rust-toolchain.toml') }}
- name: Formatting and strict Clippy
run: |
cargo fmt --all --check
cargo clippy --locked --workspace --all-targets --features openworker-sdk/test-support,openworker-server-reference/team-test -- -D warnings
sdk-storage:
strategy:
fail-fast: false
matrix:
shard: [core, teams, workspaces]
runs-on: ubuntu-24.04
timeout-minutes: 45
services:
postgres:
image: postgres:16.4
env:
POSTGRES_PASSWORD: sdk-test-only
POSTGRES_DB: sdk_tests
ports: ["5432/tcp"]
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s --health-timeout 5s --health-retries 10
defaults:
run:
working-directory: harness
env:
CARGO_BUILD_JOBS: 2
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v4
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- name: Load pinned Rust toolchain
run: rustup show active-toolchain
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: harness/typescript-sdk/package-lock.json
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
harness/target
key: rust-sdk-v2-storage-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('harness/Cargo.lock', 'harness/rust-toolchain.toml') }}
- name: Configure isolated PostgreSQL test service
run: echo "OW_PG_TEST_URL=postgresql://postgres:sdk-test-only@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/sdk_tests" >> "$GITHUB_ENV"
- name: SDK SQLite/PostgreSQL and embedded/stdio matrix
run: node tests/sdk-storage-shard.mjs "${{ matrix.shard }}"
typescript-storage-and-packaging:
runs-on: ubuntu-24.04
timeout-minutes: 45
services:
postgres:
image: postgres:16.4
env:
POSTGRES_PASSWORD: sdk-test-only
POSTGRES_DB: sdk_tests
ports: ["5432/tcp"]
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s --health-timeout 5s --health-retries 10
defaults:
run:
working-directory: harness
env:
CARGO_BUILD_JOBS: 2
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v4
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- name: Load pinned Rust toolchain
run: rustup show active-toolchain
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: harness/typescript-sdk/package-lock.json
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
harness/target
key: rust-sdk-v2-typescript-${{ runner.os }}-${{ hashFiles('harness/Cargo.lock', 'harness/rust-toolchain.toml') }}
- name: Configure isolated PostgreSQL test service
run: echo "OW_PG_TEST_URL=postgresql://postgres:sdk-test-only@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/sdk_tests" >> "$GITHUB_ENV"
- name: Build release test host
env:
CARGO_PROFILE_RELEASE_LTO: "false"
CARGO_PROFILE_RELEASE_OPT_LEVEL: "1"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16"
run: cargo build --locked --release -p openworker-sdk --features test-support,recording,evaluation-export --bin sdk-test-host
- name: TypeScript SDK transport and real-host storage parity
run: |
export OW_TS_TEST_HOST="$PWD/target/release/sdk-test-host"
npm --prefix typescript-sdk ci
npm --prefix typescript-sdk test
node --test typescript-sdk/test/observability-live.test.mjs typescript-sdk/test/evaluation-delivery-live.test.mjs
node ../harness/trace-viewer/sync.mjs --check
npm --prefix typescript-sdk run test:integration
npm --prefix typescript-sdk run test:dynamic-agents
node --test typescript-sdk/test/runtime-integrations.test.mjs
node --test --test-concurrency=2 --test-reporter=tap typescript-sdk/test/chat-usage.test.mjs typescript-sdk/test/openrouter-streaming.test.mjs typescript-sdk/test/anthropic-caching.test.mjs typescript-sdk/test/gemini-compat.test.mjs typescript-sdk/test/session-options.test.mjs typescript-sdk/test/application-guidance.test.mjs typescript-sdk/test/approval-decisions.test.mjs typescript-sdk/test/stream-events.test.mjs typescript-sdk/test/attachments.test.mjs
node --test --test-reporter=tap typescript-sdk/test/desktop-api.test.mjs typescript-sdk/test/cancel-approval.test.mjs typescript-sdk/test/registration-errors.test.mjs typescript-sdk/test/agent-team.test.mjs typescript-sdk/test/standalone-subagents.test.mjs
node --test --test-reporter=tap typescript-sdk/test/coding.test.mjs typescript-sdk/test/assistant.test.mjs
- name: Starter and partner packaging
run: |
node --test desktop-starters/test.mjs
(cd typescript-sdk && npm pack --dry-run)
node --test partner/build-sdk.test.mjs
CARGO_TARGET_DIR="$PWD/target" node --test partner/build-sdk.integration.mjs
runtime-and-postgres-contracts:
runs-on: ubuntu-24.04
timeout-minutes: 45
services:
postgres:
image: postgres:16.4
env:
POSTGRES_PASSWORD: sdk-test-only
POSTGRES_DB: sdk_tests
ports: ["5432/tcp"]
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s --health-timeout 5s --health-retries 10
defaults:
run:
working-directory: harness
env:
CARGO_BUILD_JOBS: 2
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v4
- name: Install native dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- name: Load pinned Rust toolchain
run: rustup show active-toolchain
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: harness/typescript-sdk/package-lock.json
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
harness/target
key: rust-sdk-v2-runtime-${{ runner.os }}-${{ hashFiles('harness/Cargo.lock', 'harness/rust-toolchain.toml') }}
- name: Configure isolated PostgreSQL test service
run: echo "OW_PG_TEST_URL=postgresql://postgres:sdk-test-only@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/sdk_tests" >> "$GITHUB_ENV"
- name: Assistant SQLite/PostgreSQL parity
run: cargo test --locked -p openworker-runtime -p openworker-store-postgres --test assistant -- --include-ignored --test-threads=1
- name: Runtime and telemetry regressions
run: |
cargo test --locked -p openworker-runtime -- --test-threads=1
cargo test --locked -p openworker-runtime --no-default-features --test attachment_features
cargo test --locked -p openworker-server-reference --test input_attachments -- --ignored --test-threads=1
cargo test --locked -p openworker-telemetry --features otlp
OW_OBSERVABILITY_TEST_URL="$OW_PG_TEST_URL" cargo test --locked -p openworker-observability --features postgres,evaluations -- --include-ignored --test-threads=1
cargo test --locked -p openworker-store-postgres --features test-support --test environments terminal_team_save_ -- --ignored --test-threads=1
cargo test --locked -p openworker-store-postgres --test store imported_history_and_turn_context_ -- --ignored --test-threads=1
- name: Shared PostgreSQL team contract
run: cargo test --locked -p openworker-store-postgres --features test-support --test team_contract --test agent_team_contract --test agent_team_worker --test standalone_subagents -- --ignored --test-threads=1