From d1252425b033a70afb9a129c0dbd66ab8f53419e Mon Sep 17 00:00:00 2001 From: Oliver Lazoroski Date: Thu, 19 Nov 2026 17:00:42 +0100 Subject: [PATCH] ci: run only the checks a change needs, and share one runner for the SDKs Every pull request started all 11 CI (unit) jobs whatever it changed, and with 60 runners for the organization, jobs waited 26-43 minutes for one while running for 0.3-16 minutes. - Split ci.yml into CI (Python), CI (Go) and CI (SDKs), each started by GitHub's `paths:` trigger only when its own files change. None of them may be a required check: a PR that does not trigger one would wait on it. - Check the six server SDKs one after another on one runner. `!cancelled()` keeps checking the rest after one fails. - Fold the stream-chat 10 suite into the JS steps. - Delete sdk-go.yml: the Go SDK steps of CI (SDKs) are the same check. - Resolve Python 3.10-3.14 in one job, two at a time, printing each version's output even when the job fails or times out. - Drop the dashboard job: dashboard/ no longer exists. Replaying the last 25 PRs, CI starts 26 jobs (~190 runner-minutes) instead of 264 (~600). --- .claude/skills/sdk-go/SKILL.md | 4 +- .github/workflows/ci-go.yml | 172 +++++++++ .github/workflows/ci-python.yml | 60 ++++ .github/workflows/ci-sdks.yml | 244 +++++++++++++ .github/workflows/ci.yml | 389 --------------------- .github/workflows/integration.yml | 2 +- .github/workflows/python-versions.yml | 50 ++- .github/workflows/sdk-go.yml | 57 --- sdks/js/tests/agent-chat-transport.test.ts | 4 +- sdks/js/tests/session.test.ts | 4 +- sdks/js/tests/stream-chat.ts | 3 +- 11 files changed, 528 insertions(+), 461 deletions(-) create mode 100644 .github/workflows/ci-go.yml create mode 100644 .github/workflows/ci-python.yml create mode 100644 .github/workflows/ci-sdks.yml delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/sdk-go.yml diff --git a/.claude/skills/sdk-go/SKILL.md b/.claude/skills/sdk-go/SKILL.md index f83ae17f3..e8aa4467a 100644 --- a/.claude/skills/sdk-go/SKILL.md +++ b/.claude/skills/sdk-go/SKILL.md @@ -110,8 +110,8 @@ Every identifier in a code block exists; the quickstart is the example file verb is copied. While 0.x, a minor may break a signature; a patch only fixes. 1. Land the change on `main` by a pull request, with the `CHANGELOG.md` entry. The `Go SDK` - workflow (`.github/workflows/sdk-go.yml`) checks `sdks/go` alone on Go 1.25, as a consumer - gets it. + steps of the `CI (SDKs)` workflow (`.github/workflows/ci-sdks.yml`) check `sdks/go` alone + on Go 1.25, as a consumer gets it. 2. Check out the commit to tag (`git switch --detach `), run the smoke set from `sdks/go` with `E2E_REQUIRED=1`, as above, and keep its output, so the result is the tagged commit's. diff --git a/.github/workflows/ci-go.yml b/.github/workflows/ci-go.yml new file mode 100644 index 000000000..ba02f59f2 --- /dev/null +++ b/.github/workflows/ci-go.yml @@ -0,0 +1,172 @@ +name: CI (Go) +# The router, the Go SDK, the terminal UI and the load benchmark, tied together by go.work. +# Feature branches run through pull_request; a push of the same commit would be a second, +# uncancellable copy of every job. A push to main runs it on the same paths as a pull request. +# A pull request that changes none of them never starts this workflow, so its check must not +# be made required: it would wait forever on such a pull request. +on: + push: + branches: [ "main" ] + paths: + - 'acceleration/**' + - 'sdks/go/**' + - 'tui/**' + - 'performance_benchmark/**' + # The example modules go.work uses: their requirements take part in the workspace's + # version selection, so they change what the router, SDK and TUI build against. + - 'examples/routers/chorus_asr_example/go.mod' + - 'examples/routers/chorus_asr_example/go.sum' + - 'examples/routers/stt_realtime_example/go.mod' + - 'examples/routers/stt_realtime_example/go.sum' + - 'examples/voice_agents/swift_assistant/backend/go.mod' + - 'examples/voice_agents/swift_assistant/backend/go.sum' + - 'examples/voice_agents/swift_assistant/configure/go.mod' + - 'examples/voice_agents/swift_assistant/configure/go.sum' + - 'examples/voice_agents/swift_demo/backend/go.mod' + - 'examples/voice_agents/swift_demo/backend/go.sum' + - 'examples/voice_agents/swift_demo/configure/go.mod' + - 'examples/voice_agents/swift_demo/configure/go.sum' + - 'go.work' + - 'go.work.sum' + - '.github/workflows/ci-go.yml' + - '!**/*.md' + pull_request: + branches: [ "**" ] + paths: + - 'acceleration/**' + - 'sdks/go/**' + - 'tui/**' + - 'performance_benchmark/**' + # The example modules go.work uses: their requirements take part in the workspace's + # version selection, so they change what the router, SDK and TUI build against. + - 'examples/routers/chorus_asr_example/go.mod' + - 'examples/routers/chorus_asr_example/go.sum' + - 'examples/routers/stt_realtime_example/go.mod' + - 'examples/routers/stt_realtime_example/go.sum' + - 'examples/voice_agents/swift_assistant/backend/go.mod' + - 'examples/voice_agents/swift_assistant/backend/go.sum' + - 'examples/voice_agents/swift_assistant/configure/go.mod' + - 'examples/voice_agents/swift_assistant/configure/go.sum' + - 'examples/voice_agents/swift_demo/backend/go.mod' + - 'examples/voice_agents/swift_demo/backend/go.sum' + - 'examples/voice_agents/swift_demo/configure/go.mod' + - 'examples/voice_agents/swift_demo/configure/go.sum' + - 'go.work' + - 'go.work.sum' + - '.github/workflows/ci-go.yml' + - '!**/*.md' + +permissions: + contents: read + pull-requests: read + +# Cancel in-flight runs for the same branch/PR when new commits arrive +concurrency: + group: ci-go-${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +jobs: + go: + runs-on: ubuntu-latest + # Every backend test that needs Redis skips without ROUTER_REDIS_ADDR: the service gives + # them one, on a host port the runner picks so a port already held on the runner cannot + # fail the job. The health check holds the steps until it answers PING. + services: + redis: + image: redis:7-alpine + ports: + - 6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 5s + --health-timeout 3s + --health-retries 10 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: acceleration/go.mod + cache-dependency-path: | + acceleration/go.sum + sdks/go/go.sum + tui/go.sum + performance_benchmark/go.sum + examples/routers/chorus_asr_example/go.sum + examples/routers/stt_realtime_example/go.sum + examples/voice_agents/swift_assistant/backend/go.sum + examples/voice_agents/swift_assistant/configure/go.sum + examples/voice_agents/swift_demo/backend/go.sum + examples/voice_agents/swift_demo/configure/go.sum + + # The spec is rendered from the server's Go operations and the clients are generated + # from the spec, so any of them left behind has already drifted from the others. + - name: Check the generated code is in step with the spec + run: | + (cd acceleration && go run ./cmd/openapi) + (cd sdks/go && go generate ./...) + git diff --exit-code -- acceleration/api/openapi.yaml sdks/go/acceleration/generated.go + + # internal/video samples clips with ffmpeg and ffprobe, and its tests skip without them. + - name: Install ffmpeg + run: sudo apt-get update -qq && sudo apt-get install -y -qq ffmpeg + + # The backend is built with Go's SIMD experiment, as acceleration/Dockerfile builds it. + - name: Vet the backend + run: go vet ./... + working-directory: acceleration + env: + GOEXPERIMENT: simd + + - name: Test the backend + run: go test ./... + working-directory: acceleration + env: + GOEXPERIMENT: simd + ROUTER_REDIS_ADDR: localhost:${{ job.services.redis.ports['6379'] }} + + # Without the experiment the Opus codec runs its scalar code, which must still build + # and pass. + - name: Test the audio without SIMD + run: go build ./... && go test ./internal/audio/... ./internal/audiofloor/... ./internal/agent/streamedge/... + working-directory: acceleration + + - name: Vet phonecheck + run: go vet ./... + working-directory: acceleration/cmd/phonecheck + + - name: Test phonecheck + run: go test -race ./... + working-directory: acceleration/cmd/phonecheck + + - name: Compile STS integration tests + run: go test -tags integration -run '^$' -exec=true ./internal/sts/... + working-directory: acceleration + env: + GOEXPERIMENT: simd + + - name: Vet the SDK + run: go vet ./... + working-directory: sdks/go + + - name: Test the SDK + run: go test -race ./... + working-directory: sdks/go + + - name: Vet the terminal UI + run: go vet ./... + working-directory: tui + + - name: Test the terminal UI + run: go test -race ./... + working-directory: tui + + # Without the webrtc tag the load benchmark builds its transport as a stub, so its + # ramp, report and audio checks are tested here without live calls. + - name: Vet the load benchmark + run: go vet ./... + working-directory: performance_benchmark + + - name: Test the load benchmark + run: go test ./... + working-directory: performance_benchmark diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml new file mode 100644 index 000000000..7581c427d --- /dev/null +++ b/.github/workflows/ci-python.yml @@ -0,0 +1,60 @@ +name: CI (Python) +# Ruff lints every .py in the repository, examples included, and the stream plugin's client is +# generated from the spec, so both are among the paths. +# Feature branches run through pull_request; a push of the same commit would be a second, +# uncancellable copy of every job. A push to main runs it on the same paths as a pull request. +# A pull request that changes none of them never starts this workflow, so its check must not +# be made required: it would wait forever on such a pull request. +on: + push: + branches: [ "main" ] + paths: + - '**/*.py' + - '**/pyproject.toml' + - 'uv.lock' + - 'pytest.ini' + - 'sdks/python/**' + - 'plugins/**' + - 'tests/**' + - 'acceleration/api/openapi.yaml' + - '.github/workflows/run_tests.yml' + - '.github/actions/python-uv-setup/**' + - '.github/workflows/ci-python.yml' + - '!**/*.md' + # The example plugins/stream/tests/test_folder.py loads, instructions.md included, so it + # must stay after the *.md exclusion. + - 'examples/text_agents/mcp_plugins/**' + pull_request: + branches: [ "**" ] + paths: + - '**/*.py' + - '**/pyproject.toml' + - 'uv.lock' + - 'pytest.ini' + - 'sdks/python/**' + - 'plugins/**' + - 'tests/**' + - 'acceleration/api/openapi.yaml' + - '.github/workflows/run_tests.yml' + - '.github/actions/python-uv-setup/**' + - '.github/workflows/ci-python.yml' + - '!**/*.md' + # The example plugins/stream/tests/test_folder.py loads, instructions.md included, so it + # must stay after the *.md exclusion. + - 'examples/text_agents/mcp_plugins/**' + +permissions: + contents: read + pull-requests: read + +# Cancel in-flight runs for the same branch/PR when new commits arrive +concurrency: + group: ci-python-${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +jobs: + # No secrets: unit tests reach no provider, and a pull request's code runs here. + unit: + uses: ./.github/workflows/run_tests.yml + with: + marker: 'not integration' diff --git a/.github/workflows/ci-sdks.yml b/.github/workflows/ci-sdks.yml new file mode 100644 index 000000000..28a8100ee --- /dev/null +++ b/.github/workflows/ci-sdks.yml @@ -0,0 +1,244 @@ +name: CI (SDKs) +# Server SDKs share one runner, one after another, and every run checks all of them. +# Feature branches run through pull_request; a push of the same commit would be a second, +# uncancellable copy of every job. A push to main runs it on the same paths as a pull request. +# A pull request that changes none of them never starts this workflow, so its check must not +# be made required: it would wait forever on such a pull request. +on: + push: + branches: [ "main" ] + paths: + - 'sdks/go/**' + - 'sdks/js/**' + - 'sdks/dotnet/**' + - 'sdks/php/**' + - 'sdks/rust/**' + - 'sdks/ruby/**' + - 'acceleration/api/openapi.yaml' + - '.github/workflows/ci-sdks.yml' + - 'sdks/testdata/ui/**' + - 'examples/voice_agents/swift_assistant/a2ui/prompt.json' + - 'examples/voice_agents/swift_assistant/app/SwiftAssistant/UIComponents.json' + - '!**/*.md' + # A Markdown file the Go SDK's ui_test.go reads: it must stay after the *.md exclusion, + # which would otherwise drop it. + - 'examples/voice_agents/swift_assistant/a2ui/instructions.md' + pull_request: + branches: [ "**" ] + paths: + - 'sdks/go/**' + - 'sdks/js/**' + - 'sdks/dotnet/**' + - 'sdks/php/**' + - 'sdks/rust/**' + - 'sdks/ruby/**' + - 'acceleration/api/openapi.yaml' + - '.github/workflows/ci-sdks.yml' + - 'sdks/testdata/ui/**' + - 'examples/voice_agents/swift_assistant/a2ui/prompt.json' + - 'examples/voice_agents/swift_assistant/app/SwiftAssistant/UIComponents.json' + - '!**/*.md' + # A Markdown file the Go SDK's ui_test.go reads: it must stay after the *.md exclusion, + # which would otherwise drop it. + - 'examples/voice_agents/swift_assistant/a2ui/instructions.md' + +permissions: + contents: read + pull-requests: read + +# Cancel in-flight runs for the same branch/PR when new commits arrive +concurrency: + group: ci-sdks-${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +jobs: + # Every step runs after a failure (`!cancelled()`), so each SDK reports its result. + sdks: + runs-on: ubuntu-latest + # For the Go SDK, the only Go here: it is installed on its own, with no go.work, by Go as + # old as its go directive, so it is checked that way too. GOTOOLCHAIN=local keeps 1.25 + # from switching to a newer toolchain, which would prove nothing about 1.25. + env: + GOWORK: 'off' + GOTOOLCHAIN: local + GOFLAGS: '' + steps: + - uses: actions/checkout@v7 + + - name: 'Go SDK: set up Go 1.25.0' + if: ${{ !cancelled() }} + uses: actions/setup-go@v5 + with: + go-version: '1.25.0' + cache-dependency-path: sdks/go/go.sum + + - name: 'Go SDK: check formatting' + if: ${{ !cancelled() }} + working-directory: sdks/go + run: test -z "$(gofmt -l .)" + + - name: 'Go SDK: check go.mod and go.sum are tidy and verified' + if: ${{ !cancelled() }} + working-directory: sdks/go + run: | + go mod tidy -diff + go mod verify + + - name: 'Go SDK: vet, the end-to-end suite included' + if: ${{ !cancelled() }} + working-directory: sdks/go + run: | + go vet ./... + go vet -tags e2e . + + - name: 'Go SDK: test' + if: ${{ !cancelled() }} + working-directory: sdks/go + run: go test -race ./... + + - name: 'JS: set up Node 24' + if: ${{ !cancelled() }} + uses: actions/setup-node@v7 + with: + node-version: 24 + cache: npm + cache-dependency-path: sdks/js/package-lock.json + + - name: 'JS: install' + if: ${{ !cancelled() }} + working-directory: sdks/js + run: npm ci + + # The generated types are committed so that installing the package needs no code + # generation, which only holds while they are the ones the spec describes. + - name: 'JS: check the generated types are in step with the spec' + if: ${{ !cancelled() }} + working-directory: sdks/js + run: npm run types -- --check + + - name: 'JS: test' + if: ${{ !cancelled() }} + working-directory: sdks/js + run: npm test + + - name: 'JS: build' + if: ${{ !cancelled() }} + working-directory: sdks/js + run: npm run build + + # The same suite again with stream-chat 10 in place of the 9 the lockfile has: an app may + # hand either to the SDK, and the SDK reads both by shape. It runs last, after the build, + # because it changes node_modules. The newest 10 there is, release candidates included, + # so a release candidate that breaks the SDK shows here before it ships. The log says + # which one ran. + - name: 'JS: install stream-chat 10' + if: ${{ !cancelled() }} + working-directory: sdks/js + run: | + npm install --no-save stream-chat@^10.0.2 + node -p "'stream-chat ' + require('./node_modules/stream-chat/package.json').version" + + - name: 'JS: test with stream-chat 10' + if: ${{ !cancelled() }} + working-directory: sdks/js + run: npm test + + - name: '.NET: set up .NET' + if: ${{ !cancelled() }} + uses: actions/setup-dotnet@v4 + with: + global-json-file: sdks/dotnet/global.json + + - name: '.NET: check the generated models are in step with the spec' + if: ${{ !cancelled() }} + working-directory: sdks/dotnet + run: dotnet run --project tools/Generate -- --check + + - name: '.NET: check formatting' + if: ${{ !cancelled() }} + working-directory: sdks/dotnet + run: dotnet format --verify-no-changes + + - name: '.NET: build' + if: ${{ !cancelled() }} + working-directory: sdks/dotnet + run: dotnet build -warnaserror + + - name: '.NET: test' + if: ${{ !cancelled() }} + working-directory: sdks/dotnet + run: dotnet test --no-build + + - name: 'PHP: set up PHP 8.4' + if: ${{ !cancelled() }} + uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 + with: + php-version: '8.4' + tools: composer + + - name: 'PHP: install' + if: ${{ !cancelled() }} + working-directory: sdks/php + run: composer install --no-interaction --no-progress + + - name: 'PHP: check the generated classes are in step with the spec' + if: ${{ !cancelled() }} + working-directory: sdks/php + run: composer generate-check + + - name: 'PHP: analyse' + if: ${{ !cancelled() }} + working-directory: sdks/php + run: composer stan + + - name: 'PHP: test' + if: ${{ !cancelled() }} + working-directory: sdks/php + run: composer test + + - name: 'Rust: set up the stable toolchain' + if: ${{ !cancelled() }} + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable branch + with: + toolchain: stable + components: rustfmt, clippy + + - name: 'Rust: restore the build cache' + if: ${{ !cancelled() }} + uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 + with: + workspaces: sdks/rust + + - name: 'Rust: check the generated types are in step with the spec' + if: ${{ !cancelled() }} + working-directory: sdks/rust + run: cargo run -p generate -- --check + + - name: 'Rust: check formatting' + if: ${{ !cancelled() }} + working-directory: sdks/rust + run: cargo fmt --check + + - name: 'Rust: lint' + if: ${{ !cancelled() }} + working-directory: sdks/rust + run: cargo clippy --all-targets -- -D warnings + + - name: 'Rust: test' + if: ${{ !cancelled() }} + working-directory: sdks/rust + run: cargo test + + - name: 'Ruby: set up Ruby 3.3' + if: ${{ !cancelled() }} + uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0 + with: + ruby-version: '3.3' + bundler-cache: true + working-directory: sdks/ruby + + # The default task checks the generated spec table against the spec, then runs the tests. + - name: 'Ruby: check and test' + if: ${{ !cancelled() }} + working-directory: sdks/ruby + run: bundle exec rake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index ac201ebf9..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,389 +0,0 @@ -name: CI (unit) -# Feature branches run through pull_request; a push of the same commit would be a second, -# uncancellable copy of every job. -on: - push: - branches: [ "main" ] - paths-ignore: - - '**/*.md' - - '**/*.png' - - '**/*.jpg' - - '**/*.gif' - - '**/*.mp3' - - '**/*.mp4' - - '**/*.wav' - - 'LICENSE' - - '.gitignore' - - '.dockerignore' - - '.git-blame-ignore-revs' - - 'assets/**' - - 'docs/**' - - '.coderabbit.yaml' - - '.cursor/**' - - '.claude/**' - - '.idea/**' - pull_request: - branches: [ "**" ] - paths-ignore: - - '**/*.md' - - '**/*.png' - - '**/*.jpg' - - '**/*.gif' - - '**/*.mp3' - - '**/*.mp4' - - '**/*.wav' - - 'LICENSE' - - '.gitignore' - - '.dockerignore' - - '.git-blame-ignore-revs' - - 'assets/**' - - 'docs/**' - - '.coderabbit.yaml' - - '.cursor/**' - - '.claude/**' - - '.idea/**' - -permissions: - contents: read - pull-requests: read - -jobs: - # No secrets: unit tests reach no provider, and a pull request's code runs here. - unit: - uses: ./.github/workflows/run_tests.yml - with: - marker: 'not integration' - - go: - runs-on: ubuntu-latest - # Every backend test that needs Redis skips without ROUTER_REDIS_ADDR: the service gives - # them one, on a host port the runner picks so a port already held on the runner cannot - # fail the job. The health check holds the steps until it answers PING. - services: - redis: - image: redis:7-alpine - ports: - - 6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 5s - --health-timeout 3s - --health-retries 10 - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version-file: acceleration/go.mod - cache-dependency-path: | - acceleration/go.sum - sdks/go/go.sum - tui/go.sum - performance_benchmark/go.sum - - # The spec is rendered from the server's Go operations and the clients are generated - # from the spec, so any of them left behind has already drifted from the others. - - name: Check the generated code is in step with the spec - run: | - (cd acceleration && go run ./cmd/openapi) - (cd sdks/go && go generate ./...) - git diff --exit-code -- acceleration/api/openapi.yaml sdks/go/acceleration/generated.go - - # internal/video samples clips with ffmpeg and ffprobe, and its tests skip without them. - - name: Install ffmpeg - run: sudo apt-get update -qq && sudo apt-get install -y -qq ffmpeg - - # The backend is built with Go's SIMD experiment, as acceleration/Dockerfile builds it. - - name: Vet the backend - run: go vet ./... - working-directory: acceleration - env: - GOEXPERIMENT: simd - - - name: Test the backend - run: go test ./... - working-directory: acceleration - env: - GOEXPERIMENT: simd - ROUTER_REDIS_ADDR: localhost:${{ job.services.redis.ports['6379'] }} - - # Without the experiment the Opus codec runs its scalar code, which must still build - # and pass. - - name: Test the audio without SIMD - run: go build ./... && go test ./internal/audio/... ./internal/audiofloor/... ./internal/agent/streamedge/... - working-directory: acceleration - - - name: Vet phonecheck - run: go vet ./... - working-directory: acceleration/cmd/phonecheck - - - name: Test phonecheck - run: go test -race ./... - working-directory: acceleration/cmd/phonecheck - - - name: Compile STS integration tests - run: go test -tags integration -run '^$' -exec=true ./internal/sts/... - working-directory: acceleration - env: - GOEXPERIMENT: simd - - - name: Vet the SDK - run: go vet ./... - working-directory: sdks/go - - - name: Test the SDK - run: go test -race ./... - working-directory: sdks/go - - - name: Vet the terminal UI - run: go vet ./... - working-directory: tui - - - name: Test the terminal UI - run: go test -race ./... - working-directory: tui - - # Without the webrtc tag the load benchmark builds its transport as a stub, so its - # ramp, report and audio checks are tested here without live calls. - - name: Vet the load benchmark - run: go vet ./... - working-directory: performance_benchmark - - - name: Test the load benchmark - run: go test ./... - working-directory: performance_benchmark - - # The Go SDK is installed on its own, with no go.work, by Go as old as its go directive, - # so it is checked that way too. GOTOOLCHAIN=local keeps 1.25 from switching to a newer - # toolchain, which would prove nothing about 1.25. - go-sdk: - runs-on: ubuntu-latest - defaults: - run: - working-directory: sdks/go - env: - GOWORK: 'off' - GOTOOLCHAIN: local - GOFLAGS: '' - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: '1.25.0' - cache-dependency-path: sdks/go/go.sum - - - name: Check formatting - run: test -z "$(gofmt -l .)" - - - name: Check go.mod and go.sum are tidy and verified - run: | - go mod tidy -diff - go mod verify - - - name: Vet, the end-to-end suite included - run: | - go vet ./... - go vet -tags e2e . - - - name: Test - run: go test -race ./... - - js: - runs-on: ubuntu-latest - defaults: - run: - working-directory: sdks/js - steps: - - uses: actions/checkout@v7 - - - uses: actions/setup-node@v7 - with: - node-version: 24 - cache: npm - cache-dependency-path: sdks/js/package-lock.json - - - name: Install - run: npm ci - - # The generated types are committed so that installing the package needs no code - # generation, which only holds while they are the ones the spec describes. - - name: Check the generated types are in step with the spec - run: npm run types -- --check - - - name: Test - run: npm test - - - name: Build - run: npm run build - - # The same suite with stream-chat 10 in place of the 9 the lockfile has: an app may hand - # either to the SDK, and the SDK reads both by shape. - js-stream-chat-10: - runs-on: ubuntu-latest - defaults: - run: - working-directory: sdks/js - steps: - - uses: actions/checkout@v7 - - - uses: actions/setup-node@v7 - with: - node-version: 24 - cache: npm - cache-dependency-path: sdks/js/package-lock.json - - - name: Install - run: npm ci - - # The newest 10 there is, release candidates included, so a release candidate that - # breaks the SDK shows here before it ships. The log says which one ran. - - name: Install stream-chat 10 - run: | - npm install --no-save stream-chat@^10.0.2 - node -p "'stream-chat ' + require('./node_modules/stream-chat/package.json').version" - - - name: Test - run: npm test - - dotnet: - runs-on: ubuntu-latest - defaults: - run: - working-directory: sdks/dotnet - steps: - - uses: actions/checkout@v7 - - - uses: actions/setup-dotnet@v4 - with: - global-json-file: sdks/dotnet/global.json - - - name: Check the generated models are in step with the spec - run: dotnet run --project tools/Generate -- --check - - - name: Check formatting - run: dotnet format --verify-no-changes - - - name: Build - run: dotnet build -warnaserror - - - name: Test - run: dotnet test --no-build - - php: - runs-on: ubuntu-latest - defaults: - run: - working-directory: sdks/php - steps: - - uses: actions/checkout@v7 - - - uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0 - with: - php-version: '8.4' - tools: composer - - - name: Install - run: composer install --no-interaction --no-progress - - - name: Check the generated classes are in step with the spec - run: composer generate-check - - - name: Analyse - run: composer stan - - - name: Test - run: composer test - - rust: - runs-on: ubuntu-latest - defaults: - run: - working-directory: sdks/rust - steps: - - uses: actions/checkout@v7 - - - uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable branch - with: - toolchain: stable - components: rustfmt, clippy - - - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 - with: - workspaces: sdks/rust - - - name: Check the generated types are in step with the spec - run: cargo run -p generate -- --check - - - name: Check formatting - run: cargo fmt --check - - - name: Lint - run: cargo clippy --all-targets -- -D warnings - - - name: Test - run: cargo test - - ruby: - runs-on: ubuntu-latest - defaults: - run: - working-directory: sdks/ruby - steps: - - uses: actions/checkout@v7 - - - uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0 - with: - ruby-version: '3.3' - bundler-cache: true - working-directory: sdks/ruby - - # The default task checks the generated spec table against the spec, then runs the tests. - - name: Check and test - run: bundle exec rake - - dashboard: - runs-on: ubuntu-latest - defaults: - run: - working-directory: dashboard - steps: - - uses: actions/checkout@v7 - - - name: Check for dashboard - id: dashboard - working-directory: . - run: echo "present=$([[ -f dashboard/package-lock.json ]] && echo true || echo false)" >> "$GITHUB_OUTPUT" - - - uses: actions/setup-node@v7 - if: steps.dashboard.outputs.present == 'true' - with: - node-version: 22 - cache: npm - cache-dependency-path: dashboard/package-lock.json - - - name: Install - if: steps.dashboard.outputs.present == 'true' - run: npm ci - - # The dashboard's types come from the same spec the Go and Python clients do, so a - # spec edited without regenerating them is a dashboard already reading a shape the - # router no longer answers with. - - name: Check the generated types are in step with the spec - if: steps.dashboard.outputs.present == 'true' - run: | - npm run types - git diff --exit-code -- src/lib/api.d.ts - - - name: Lint - if: steps.dashboard.outputs.present == 'true' - run: npm run lint - - - name: Build - if: steps.dashboard.outputs.present == 'true' - run: npm run build - -# Cancel in-flight runs for the same branch/PR when new commits arrive -concurrency: - group: ci-unit-${{ github.workflow }}-${{ github.head_ref || github.ref_name }} - cancel-in-progress: true diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index c426ec8cc..3a5e6ef26 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -2,7 +2,7 @@ name: Integration (router) # The router's `-tags integration` suites that need Postgres, in six jobs: each runs its group of # packages one at a time on its own Postgres and Redis. Groups, not a job per package, because each # job spends about 35 s on setup; the groups are balanced by test time on CI, so a new package goes -# in the lightest one. CI (unit) runs `go test ./...` without the tag, so only this workflow runs +# in the lightest one. CI (Go) runs `go test ./...` without the tag, so only this workflow runs # these suites on CI. Not a required check. Vendor suites (tts, stt, llm, sts, search, imagegen, detection) # need API keys, so they are not here. internal/campaign, internal/phone/outcome, # internal/searchrouter and internal/simulation are Postgres suites left out of the matrix too diff --git a/.github/workflows/python-versions.yml b/.github/workflows/python-versions.yml index 2e62c2025..9fd5b0316 100644 --- a/.github/workflows/python-versions.yml +++ b/.github/workflows/python-versions.yml @@ -24,13 +24,15 @@ permissions: pull-requests: read jobs: + # One job for every version: each only resolves (`uv pip compile`), and the setup took most + # of each job's time when there was a job per version. Versions resolve two at a time, each + # into its own log so their output does not interleave. Every version is checked even after + # one fails, and the job fails at the end, naming the versions that did not resolve. resolve: - name: Resolve on Python ${{ matrix.python }} + name: Resolve on Python 3.10–3.14 runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] + env: + PYTHON_VERSIONS: "3.10 3.11 3.12 3.13 3.14" steps: - name: Checkout uses: actions/checkout@v6 @@ -38,5 +40,39 @@ jobs: uses: ./.github/actions/python-uv-setup with: sync-flags: "--frozen --only-group dev" - - name: Resolve every workspace member on Python ${{ matrix.python }} - run: uv run --no-sync dev.py check-python-versions ${{ matrix.python }} + - name: Resolve every workspace member on each Python version + id: resolve + run: | + read -ra versions <<< "$PYTHON_VERSIONS" + printf '%s\n' "${versions[@]}" | xargs -P 2 -n 1 bash -c ' + version=$1 + uv run --no-sync dev.py check-python-versions "$version" > "$RUNNER_TEMP/python-$version.log" 2>&1 + echo "$?" > "$RUNNER_TEMP/python-$version.status" + ' _ + failed=() + for version in "${versions[@]}"; do + if [[ $(cat "$RUNNER_TEMP/python-$version.status") != 0 ]]; then + failed+=("$version") + fi + done + if (( ${#failed[@]} )); then + echo "::error::Did not resolve on Python ${failed[*]}" + exit 1 + fi + # Its own step, so the logs show even when the resolve step fails, is cancelled or times + # out: a version that never finished shows how far it got. + - name: Show each version's resolver output + if: always() && steps.resolve.outcome != 'skipped' + run: | + read -ra versions <<< "$PYTHON_VERSIONS" + for version in "${versions[@]}"; do + log="$RUNNER_TEMP/python-$version.log" + if [[ ! -f $log ]]; then + echo "Python $version: did not start" + elif [[ ! -f $RUNNER_TEMP/python-$version.status ]]; then + echo "Python $version: did not finish; its output so far:" + cat "$log" + else + cat "$log" + fi + done diff --git a/.github/workflows/sdk-go.yml b/.github/workflows/sdk-go.yml deleted file mode 100644 index 4721443df..000000000 --- a/.github/workflows/sdk-go.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Go SDK - -# sdks/go is released by a tag on main (see the Versioning section of sdks/go/README.md). -# This checks it the way a consumer gets it: -# alone, with no go.work, on the oldest Go its go directive allows. GOTOOLCHAIN=local keeps -# 1.25 from switching to a newer toolchain, which would prove nothing about 1.25. -on: - push: - branches: [ "main" ] - paths: - - 'sdks/go/**' - - '.github/workflows/sdk-go.yml' - pull_request: - paths: - - 'sdks/go/**' - - '.github/workflows/sdk-go.yml' - -permissions: - contents: read - -concurrency: - group: sdk-go-${{ github.head_ref || github.ref_name }} - cancel-in-progress: true - -jobs: - check: - runs-on: ubuntu-latest - defaults: - run: - working-directory: sdks/go - env: - GOWORK: 'off' - GOTOOLCHAIN: local - GOFLAGS: '' - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version: '1.25.0' - cache-dependency-path: sdks/go/go.sum - - - name: Check formatting - run: test -z "$(gofmt -l .)" - - - name: Check go.mod and go.sum are tidy and verified - run: | - go mod tidy -diff - go mod verify - - - name: Vet, the end-to-end suite included - run: | - go vet ./... - go vet -tags e2e . - - - name: Test - run: go test -race ./... diff --git a/sdks/js/tests/agent-chat-transport.test.ts b/sdks/js/tests/agent-chat-transport.test.ts index f0de3b307..0044b0741 100644 --- a/sdks/js/tests/agent-chat-transport.test.ts +++ b/sdks/js/tests/agent-chat-transport.test.ts @@ -131,8 +131,8 @@ describe("agentChatTransport, branching", () => { }); /** - * An AgentChat over a real stream-chat client (9, or 10 in CI's js-stream-chat-10 job) reading - * the channel from the test router, and the transport, connected to a feed. + * An AgentChat over a real stream-chat client (9, or 10 in the stream-chat 10 pass of CI's sdks + * job) reading the channel from the test router, and the transport, connected to a feed. */ async function connected(messages: Record[] = conversationOf) { const streamChat = await chatClient(router.url); diff --git a/sdks/js/tests/session.test.ts b/sdks/js/tests/session.test.ts index 2c132f7dc..20d620c45 100644 --- a/sdks/js/tests/session.test.ts +++ b/sdks/js/tests/session.test.ts @@ -1971,8 +1971,8 @@ describe("Regenerate, edit and branches", () => { /** * The session with its channel open and holding `messages`, read by a real stream-chat client - * (9, or 10 in CI's js-stream-chat-10 job) from the test router: what is under test is what its - * channel state holds, and that 9's query merges rather than replaces. + * (9, or 10 in the stream-chat 10 pass of CI's sdks job) from the test router: what is under test + * is what its channel state holds, and that 9's query merges rather than replaces. */ async function loaded(messages: Record[]) { const chat = await chatClient(router.url); diff --git a/sdks/js/tests/stream-chat.ts b/sdks/js/tests/stream-chat.ts index 9d06d9abf..3f1adc356 100644 --- a/sdks/js/tests/stream-chat.ts +++ b/sdks/js/tests/stream-chat.ts @@ -2,7 +2,8 @@ import * as streamChat from "stream-chat"; /** * A real stream-chat client reading Chat from a test router, for the installed major: 9, or 10 - * in CI's js-stream-chat-10 job (`npm install --no-save stream-chat@^10.0.2 && npm test`). + * in the stream-chat 10 pass of CI's sdks job (`npm install --no-save stream-chat@^10.0.2 && + * npm test`). * * Typed by shape rather than by either version's declarations, so the suite compiles against both. * What differs between them, and why a 10 client pointed at the router the way a 9 one is reached