Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ OGX uses GitHub Actions for Continuous Integration (CI). Below is a table detail
| Pre-commit | [pre-commit.yml](pre-commit.yml) | Run pre-commit checks |
| Prepare release | [prepare-release.yml](prepare-release.yml) | Prepare release |
| Test OGX Build | [providers-build.yml](providers-build.yml) | Test ogx build and list-deps |
| Publish OpenAPI SDK to PyPI | [publish-openapi-sdk.yml](publish-openapi-sdk.yml) | Publish ogx-open-client to PyPI |
| Publish OpenAPI SDK to PyPI | [publish-openapi-sdk.yml](publish-openapi-sdk.yml) | Publish ogx-client to PyPI |
| Build, test, and publish packages | [pypi.yml](pypi.yml) | Build, test, and publish packages |
| Integration Tests (Record) | [record-integration-tests.yml](record-integration-tests.yml) | Auto-record missing test recordings for PR |
| vLLM GPU Recording | [record-vllm-gpu-tests.yml](record-vllm-gpu-tests.yml) | GPU recording for gpt-oss:20b (${{ inputs.suite }} suite) |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/openapi-generator-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:

- name: Generate Python SDK
working-directory: client-sdks/openapi
run: make sdk OPEN=1
run: make sdk OPEN=0

- name: Validate generated SDK
working-directory: client-sdks/openapi
Expand Down Expand Up @@ -217,14 +217,14 @@ jobs:

- name: Install generated SDK
run: |
echo "Reinstalling OpenAPI-generated SDK (ogx_open_client)..."
uv pip uninstall ogx-open-client || true
echo "Reinstalling OpenAPI-generated SDK (ogx_client)..."
uv pip uninstall ogx-client || true

# Install SDK using uv pip
uv pip install -e client-sdks/openapi/sdks/python

echo "Verifying installation..."
uv run python -c "import ogx_open_client; print(f'Installed: {ogx_open_client.__name__}')"
uv run python -c "import ogx_client; print(f'Installed: {ogx_client.__name__}')"

- name: Setup Ollama (for integration tests)
if: runner.os == 'Linux'
Expand All @@ -242,7 +242,7 @@ jobs:
|| echo "::warning::Some integration tests failed - this may indicate SDK compatibility issues"

# Show which SDK is actually being used
uv run python -c "import ogx_open_client; import inspect; print(f'SDK location: {inspect.getfile(ogx_open_client)}')"
uv run python -c "import ogx_client; import inspect; print(f'SDK location: {inspect.getfile(ogx_client)}')"

- name: Summary
if: runner.os == 'Linux'
Expand All @@ -255,5 +255,5 @@ jobs:
echo "✅ Integration tests executed (check logs for results)"
echo ""
echo "**Platform**: ${{ matrix.os }}"
echo "**Package**: ogx_open_client (OpenAPI-generated)"
echo "**Package**: ogx_client (OpenAPI-generated)"
} >> "$GITHUB_STEP_SUMMARY"
53 changes: 44 additions & 9 deletions .github/workflows/publish-openapi-sdk.yml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we remove this workflow? Seems duplicative and pypi.yml should be the only place we publish packages from -- per the trusted publishing settings on pypi.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I agree, removed.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish OpenAPI SDK to PyPI

run-name: Publish ogx-open-client to PyPI
run-name: Publish ogx-client to PyPI

on:
workflow_dispatch:
Expand All @@ -13,6 +13,10 @@ on:
options:
- testpypi
- pypi
version:
description: 'Version override (e.g., "1.2.0"). Leave empty to auto-detect from tag or fallback_version.'
required: false
type: string
dry_run:
description: 'Dry run (build only, no publish)'
type: boolean
Expand All @@ -29,7 +33,37 @@ permissions:
contents: read

jobs:
compute-version:
name: Compute version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Compute SDK version
id: version
run: |
if [ -n "${{ inputs.version }}" ]; then
# Explicit override from workflow_dispatch
VERSION="${{ inputs.version }}"
elif [[ "$GITHUB_REF" == refs/tags/openapi-sdk-v* ]]; then
# Extract version from tag: openapi-sdk-v1.2.0 -> 1.2.0
VERSION="${GITHUB_REF#refs/tags/openapi-sdk-v}"
else
# Fall back to fallback_version from pyproject.toml
VERSION=$(python3 -c "
import tomllib, pathlib
p = tomllib.loads(pathlib.Path('pyproject.toml').read_text())
print(p.get('tool', {}).get('setuptools_scm', {}).get('fallback_version', '0.0.0.dev0'))
")
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Computed version: ${VERSION}"

build-sdk:
needs: compute-version
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -60,14 +94,15 @@ jobs:
echo "=== OpenAPI Generator version ==="
openapi-generator-cli version

echo "=== SDK version from pyproject.toml ==="
make version
echo "=== SDK version ==="
echo "${{ needs.compute-version.outputs.version }}"

- name: Generate OpenAPI SDK
working-directory: client-sdks/openapi
run: |
echo "Generating SDK with OPEN=1 (ogx_open_client)..."
make sdk OPEN=1
VERSION="${{ needs.compute-version.outputs.version }}"
echo "Generating SDK with OPEN=0 (ogx_client) at version ${VERSION}..."
make sdk OPEN=0 VERSION="${VERSION}"

- name: Verify SDK generation
working-directory: client-sdks/openapi
Expand Down Expand Up @@ -134,10 +169,10 @@ jobs:
echo ""
echo "- **Event**: ${{ github.event_name }}"
echo "- **Target**: TestPyPI"
echo "- **Package**: ogx-open-client"
echo "- **Package**: ogx-client"
echo ""
echo "✅ Package published to TestPyPI"
echo "Install with: \`pip install --index-url https://test.pypi.org/simple/ ogx-open-client\`"
echo "Install with: \`pip install --index-url https://test.pypi.org/simple/ ogx-client\`"
} >> "$GITHUB_STEP_SUMMARY"

publish-pypi:
Expand Down Expand Up @@ -169,8 +204,8 @@ jobs:
echo ""
echo "- **Event**: ${{ github.event_name }}"
echo "- **Target**: PyPI (production)"
echo "- **Package**: ogx-open-client"
echo "- **Package**: ogx-client"
echo ""
echo "✅ Package published to PyPI"
echo "Install with: \`pip install ogx-open-client\`"
echo "Install with: \`pip install ogx-client\`"
} >> "$GITHUB_STEP_SUMMARY"
93 changes: 68 additions & 25 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This workflow builds, tests, and publishes all ogx packages:
# - ogx (PyPI)
# - ogx-api (PyPI)
# - ogx-client-python (PyPI, from external repo)
# - ogx-client (PyPI, OpenAPI-generated SDK)
# - ogx-client-typescript (npm, from external repo)
#
# =============================================================================
Expand Down Expand Up @@ -225,11 +225,12 @@ jobs:
path: .
type: local
registry: pypi
# External packages (client SDKs from other repos)
- package: ogx-client-python
repo: ogx-ai/ogx-client-python
type: external
# OpenAPI-generated SDK (built from spec in this repo)
- package: ogx-client
path: client-sdks/openapi
type: openapi-sdk
registry: pypi
# External packages (client SDKs from other repos)
- package: ogx-client-typescript
repo: ogx-ai/ogx-client-typescript
type: external
Expand All @@ -246,7 +247,7 @@ jobs:

if [ "$PACKAGES" == "all" ]; then
echo "skip=false" >> "$GITHUB_OUTPUT"
elif [ "$PACKAGES" == "ogx-only" ] && [ "$TYPE" == "local" ]; then
elif [ "$PACKAGES" == "ogx-only" ] && { [ "$TYPE" == "local" ] || [ "$TYPE" == "openapi-sdk" ]; }; then
echo "skip=false" >> "$GITHUB_OUTPUT"
elif [ "$PACKAGES" == "clients-only" ] && [ "$TYPE" == "external" ]; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice consolidation work! One thing I noticed: clients-only only matches external, so ogx-client would get skipped in that mode. Same gap in the publish job around line 793. Adding || [ "$TYPE" == "openapi-sdk" ] to both should do it.

echo "skip=false" >> "$GITHUB_OUTPUT"
Expand All @@ -257,13 +258,13 @@ jobs:

# === LOCAL PACKAGE STEPS ===
- name: Checkout local repo
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'local'
if: steps.should-build.outputs.skip != 'true' && (matrix.type == 'local' || matrix.type == 'openapi-sdk')
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # for setuptools-scm

- name: Install dependent PRs if needed
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'local'
if: steps.should-build.outputs.skip != 'true' && (matrix.type == 'local' || matrix.type == 'openapi-sdk')
uses: depends-on/depends-on-action@826c144163ac67bf08347590a5f81afd45da63ca # main
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -350,6 +351,48 @@ jobs:
env:
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ needs.compute-version.outputs.version }}

# === OPENAPI SDK BUILD (ogx-client) ===
- name: Set up Java (openapi-sdk)
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'openapi-sdk'
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: 'temurin'
java-version: '11'

- name: Set up Node.js (openapi-sdk)
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'openapi-sdk'
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '20'

- name: Install openapi-generator-cli (openapi-sdk)
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'openapi-sdk'
run: npm install -g @openapitools/openapi-generator-cli

- name: Generate and build OpenAPI SDK
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'openapi-sdk'
working-directory: ${{ matrix.path }}
run: |
VERSION="${{ needs.compute-version.outputs.version }}"
echo "Generating SDK with OPEN=0 (ogx_client) at version ${VERSION}..."
make sdk OPEN=0 VERSION="${VERSION}"

cd sdks/python
echo "Building Python package..."
uv build --out-dir ../../dist --no-build-isolation

- name: Verify OpenAPI SDK generation
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'openapi-sdk'
working-directory: ${{ matrix.path }}
run: |
PY_FILE_COUNT=$(find sdks/python -name "*.py" | wc -l)
echo "Generated Python files: $PY_FILE_COUNT"
if [ "$PY_FILE_COUNT" -le 10 ]; then
echo "::error::Too few Python files generated (expected > 10, got $PY_FILE_COUNT)"
exit 1
fi
echo "SDK generated successfully"

# === EXTERNAL PYTHON PACKAGE BUILD ===
- name: Check and bump version if exists on PyPI
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'external' && matrix.registry == 'pypi'
Expand Down Expand Up @@ -525,15 +568,15 @@ jobs:
run: uv pip install --system twine check-wheel-contents

- name: Check wheel contents (local)
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'local' && matrix.registry == 'pypi'
if: steps.should-build.outputs.skip != 'true' && (matrix.type == 'local' || matrix.type == 'openapi-sdk') && matrix.registry == 'pypi'
run: check-wheel-contents --ignore W002,W004 ${{ matrix.path }}/dist/*.whl

- name: Check wheel contents (external)
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'external' && matrix.registry == 'pypi'
run: check-wheel-contents --ignore W002,W004 external-repo/dist/*.whl

- name: Validate package with twine (local)
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'local' && matrix.registry == 'pypi'
if: steps.should-build.outputs.skip != 'true' && (matrix.type == 'local' || matrix.type == 'openapi-sdk') && matrix.registry == 'pypi'
run: twine check ${{ matrix.path }}/dist/*

- name: Validate package with twine (external)
Expand All @@ -542,7 +585,7 @@ jobs:

# === LIST AND UPLOAD ARTIFACTS ===
- name: List dist contents (local)
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'local'
if: steps.should-build.outputs.skip != 'true' && (matrix.type == 'local' || matrix.type == 'openapi-sdk')
run: ls -la ${{ matrix.path }}/dist/

- name: List dist contents (external Python)
Expand All @@ -559,7 +602,7 @@ jobs:
ls -la dist/

- name: Upload artifacts (local)
if: steps.should-build.outputs.skip != 'true' && matrix.type == 'local'
if: steps.should-build.outputs.skip != 'true' && (matrix.type == 'local' || matrix.type == 'openapi-sdk')
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Packages-${{ matrix.package }}
Expand Down Expand Up @@ -611,14 +654,6 @@ jobs:
path: dist-stack
continue-on-error: true

- name: Download ogx-client-python artifacts
id: download-client-python
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: Packages-ogx-client-python
path: dist-client-python
continue-on-error: true

- name: Download ogx-client-typescript artifacts
id: download-client-ts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand All @@ -627,6 +662,14 @@ jobs:
path: dist-client-ts
continue-on-error: true

- name: Download ogx-client artifacts (OpenAPI SDK)
id: download-client-python
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: Packages-ogx-client
path: dist-client-python
continue-on-error: true

- name: Create venv and install Python packages
run: |
uv venv .venv
Expand Down Expand Up @@ -700,7 +743,7 @@ jobs:
fi

# Publish packages to PyPI/npm
# Order: ogx-client-python, ogx-client-typescript, ogx-api, ogx
# Order: ogx-client-typescript, ogx-client, ogx-api, ogx
publish-packages:
name: Publish ${{ matrix.package }}
if: |
Expand All @@ -721,12 +764,12 @@ jobs:
matrix:
include:
# Order matters! Dependencies are published first
- package: ogx-client-python
registry: pypi
type: external
- package: ogx-client-typescript
registry: npm
type: external
- package: ogx-client
registry: pypi
type: openapi-sdk
- package: ogx-api
registry: pypi
type: local
Expand All @@ -745,7 +788,7 @@ jobs:

if [ "$PACKAGES" == "all" ]; then
echo "skip=false" >> "$GITHUB_OUTPUT"
elif [ "$PACKAGES" == "ogx-only" ] && [ "$TYPE" == "local" ]; then
elif [ "$PACKAGES" == "ogx-only" ] && { [ "$TYPE" == "local" ] || [ "$TYPE" == "openapi-sdk" ]; }; then
echo "skip=false" >> "$GITHUB_OUTPUT"
elif [ "$PACKAGES" == "clients-only" ] && [ "$TYPE" == "external" ]; then
echo "skip=false" >> "$GITHUB_OUTPUT"
Expand Down
4 changes: 2 additions & 2 deletions client-sdks/openapi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ PROCESSED_SPEC := openapi-hierarchical.yml
HIERARCHY_FILE := api-hierarchy.yml
SDK_OUTPUT_DIR := sdks/python

# Extract version from root pyproject.toml
VERSION := $(shell grep 'fallback_version' ../../pyproject.toml | cut -d'"' -f2)
# Extract version from root pyproject.toml; override with make VERSION=X.Y.Z
VERSION ?= $(shell grep 'fallback_version' ../../pyproject.toml | cut -d'"' -f2)

.PHONY: all sdk openapi hierarchy clean help version check-generator generate-config

Expand Down
Loading