Skip to content

feat(client-sdks): add CI/CD pipeline for OpenAPI SDK validation and publishing#5274

Open
JayDi11a wants to merge 12 commits intollamastack:mainfrom
JayDi11a:feat/openapi-sdk-cicd-pipeline
Open

feat(client-sdks): add CI/CD pipeline for OpenAPI SDK validation and publishing#5274
JayDi11a wants to merge 12 commits intollamastack:mainfrom
JayDi11a:feat/openapi-sdk-cicd-pipeline

Conversation

@JayDi11a
Copy link
Copy Markdown
Contributor

Summary

This PR adds comprehensive CI/CD automation for the OpenAPI-generated Python SDK, building on the foundational work from #4874, #4932, and #5001 by @egeiger.

Changes

CI Workflow - OpenAPI Generator Validation:

  • ✅ Validates SDK generation on every PR
  • ✅ Multi-platform testing (Ubuntu + macOS)
  • ✅ Generates and validates 1,092+ Python files
  • ✅ Verifies SDK installation and imports
  • ✅ Runs integration tests against generated SDK
  • ✅ Smart matrix: always runs on Linux, adds macOS for main/release branches or when critical files change

CD Workflow - PyPI Publishing:

  • ✅ Automated SDK publishing workflow
  • ✅ Triggered on release tags matching client-sdks/openapi/v*
  • ✅ Builds SDK from OpenAPI spec
  • ✅ Publishes to PyPI with proper versioning
  • ✅ Includes safety checks and test PyPI support

SDK Improvements:

  • Fixed httpx dependency inclusion in generated pyproject.toml
  • Updated Makefile to pass httpx=true flag to OpenAPI Generator
  • Improved SDK installation reliability in CI environments

Documentation:

  • Added comprehensive CI/CD documentation to client-sdks/openapi/README.md
  • Updated workflow README with OpenAPI validation details

Testing

End-to-end validation performed:

  • ✅ SDK generation (1,092 files)
  • ✅ SDK installation via pip/uv
  • ✅ Import verification
  • ✅ Integration tests against live llama-stack server
  • ✅ Provider API, Routes API, Models API all functional
  • ✅ CI passing on both Ubuntu and macOS

Key Commits

  • feat: PyPI publishing workflow for OpenAPI SDK (CD)
  • feat: Add integration testing for OpenAPI-generated SDK (CI)
  • fix: Add httpx dependency to SDK generation
  • fix: Use 'uv run python' for proper venv context in CI
  • fix: Update upload-artifact action to correct SHA

Files Changed

.github/actions/setup-runner/action.yml            |   2 +-
.github/workflows/README.md                        |   1 +
.github/workflows/openapi-generator-validation.yml |  47 ++++++-
.github/workflows/pre-commit.yml                   |   2 +-
.github/workflows/publish-openapi-sdk.yml          | 151 +++++++++++++++++++++
client-sdks/openapi/Makefile                       |   2 +-
client-sdks/openapi/README.md                      |  42 ++++++
.../templates/python/pyproject.mustache            |  35 +++--
8 files changed, 263 insertions(+), 19 deletions(-)

Checklist

  • Follows conventional commit format
  • CI/CD workflows tested and passing
  • End-to-end SDK validation completed
  • Documentation updated
  • Conforms to CONTRIBUTING.md guidelines

🤖 Generated with Claude Code

JayDi11a and others added 11 commits March 24, 2026 12:57
The setup-runner action was not upgrading llama-stack-client when installing
from git after uv sync. This caused CI to use the old PyPI version (0.2.23)
instead of the latest git version which has the admin, beta, and vector_io
updates.

Without --upgrade, uv pip install skips installation if the package is already
present, even if the source is different (git vs PyPI).

This fixes integration test failures for admin, vector_io, datasets, and
tool_runtime APIs that require the updated client SDK.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Apply the same fix as setup-runner to ensure pre-commit workflow also
upgrades to the git client version instead of keeping the PyPI version.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add CD pipeline for publishing the OpenAPI-generated SDK to PyPI/TestPyPI.

Changes:
- Add publish-openapi-sdk.yml workflow with manual and tag-based triggers
- Update pyproject.mustache with proper PyPI metadata (authors, license, classifiers, URLs)
- Document PyPI publishing process in README.md

The workflow supports:
- Manual publishing via GitHub Actions UI (with dry-run option)
- Automatic publishing to TestPyPI when tags matching openapi-sdk-v* are pushed
- Publishing to both TestPyPI (testing) and PyPI (production)

Related to llamastack#4609

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The workflow was failing because the upload-artifact action SHA was invalid.
Updated to the latest version (v4.6.0) with correct SHA.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Extend openapi-generator-validation workflow to:
- Generate SDK with OPEN=0 (creates llama_stack_client package)
- Install the generated SDK locally
- Run integration tests with the OpenAPI SDK instead of Stainless
- Validate SDK compatibility with llama-stack server

This implements the CI validation that Eitan outlined:
- Tests run with our SDK instead of the official one
- Validates the SDK actually works against the server
- Helps identify compatibility issues early

Tests run:
- Basic smoke tests (inspect API)
- More tests can be added incrementally

Related to llamastack#4609

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The OpenAPI-generated SDK installation was failing because pydantic and
other dependencies were not being installed when using `uv pip install -e .`.
This fix explicitly installs the required dependencies first, then installs
the SDK in editable mode with --no-deps to avoid conflicts.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The previous approach with --no-deps was preventing dependencies from being
properly linked. Using --force-reinstall ensures all dependencies are correctly
installed along with the SDK in editable mode.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removing working-directory and --force-reinstall flag to ensure proper
dependency resolution in the parent venv. Installing from root ensures
the editable install path is correctly set up.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The editable install was failing because uv was trying to replace an existing
llama-stack-client package without properly installing dependencies. This fix
uninstalls any existing client first, then performs a fresh install with all
dependencies properly resolved.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The OpenAPI-generated SDK was missing the httpx dependency in pyproject.toml
because the httpx flag wasn't being passed to openapi-generator. This fix adds
httpx=true to the additional-properties parameter, ensuring httpx is properly
included in the generated pyproject.toml dependencies list.

This resolves SDK installation failures in CI where dependencies weren't being
properly installed with the editable install.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The import was failing because 'python' wasn't properly using the venv
environment in GitHub Actions. Using 'uv run python' ensures we use the
correct Python interpreter with the right site-packages and editable install
paths configured.

Also removed the unsupported -y flag from uv pip uninstall.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 24, 2026
Copy link
Copy Markdown
Collaborator

@franciscojavierarceo franciscojavierarceo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should stick with stainless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants