3030 id : configure
3131 shell : bash
3232 run : |
33- # If sdk_install_url is provided (e.g., from Stainless preview) , use it directly
33+ # If sdk_install_url is provided, use it directly
3434 if [ -n "${{ inputs.sdk_install_url }}" ]; then
3535 echo "Using provided sdk_install_url: ${{ inputs.sdk_install_url }}"
36+ echo "generate=false" >> $GITHUB_OUTPUT
3637 echo "install-after-sync=true" >> $GITHUB_OUTPUT
3738 echo "install-source=${{ inputs.sdk_install_url }}" >> $GITHUB_OUTPUT
3839 exit 0
@@ -51,28 +52,60 @@ runs:
5152
5253 echo "Working with branch: $BRANCH"
5354
54- # On release branches: install client from the matching release branch in the client repo
55- # On non-release branches: install based on client-version after sync
55+ # The ogx-client Python SDK is generated in-repo from client-sdks/openapi.
56+ # On release branches and when client-version=latest, generate the SDK from
57+ # the current checkout so tests run against the client built from this source.
58+ # When client-version=published, use the version resolved by uv sync from PyPI.
5659 if [[ "$BRANCH" =~ ^release-[0-9]+\.[0-9]+\.x$ ]]; then
57- echo "Detected release branch: $BRANCH"
58-
59- # Check if matching branch exists in client repo
60- if ! git ls-remote --exit-code --heads https://github.com/ogx-ai/ogx-client-python.git "$BRANCH" > /dev/null 2>&1; then
61- echo "::error::Branch $BRANCH not found in ogx-client-python repository"
62- echo "::error::Please create the matching release branch in ogx-client-python before testing"
63- exit 1
64- fi
65-
60+ echo "Detected release branch: $BRANCH — generating client from checkout"
61+ echo "generate=true" >> $GITHUB_OUTPUT
6662 echo "install-after-sync=true" >> $GITHUB_OUTPUT
67- echo "install-source=git+https:// github.com/ogx-ai/ogx- client-python.git@$BRANCH " >> $GITHUB_OUTPUT
63+ echo "install-source=${{ github.workspace }}/ client-sdks/openapi/sdks/ python" >> $GITHUB_OUTPUT
6864 elif [ "${{ inputs.client-version }}" = "latest" ]; then
69- # Install from main git after sync
65+ echo "Generating client from checkout (client-version=latest)"
66+ echo "generate=true" >> $GITHUB_OUTPUT
7067 echo "install-after-sync=true" >> $GITHUB_OUTPUT
71- echo "install-source=git+https:// github.com/ogx-ai/ogx- client-python.git@main " >> $GITHUB_OUTPUT
68+ echo "install-source=${{ github.workspace }}/ client-sdks/openapi/sdks/ python" >> $GITHUB_OUTPUT
7269 elif [ "${{ inputs.client-version }}" = "published" ]; then
7370 # Use published version from PyPI (installed by sync)
71+ echo "generate=false" >> $GITHUB_OUTPUT
7472 echo "install-after-sync=false" >> $GITHUB_OUTPUT
7573 elif [ -n "${{ inputs.client-version }}" ]; then
7674 echo "::error::Invalid client-version: ${{ inputs.client-version }}"
7775 exit 1
76+ else
77+ echo "generate=false" >> $GITHUB_OUTPUT
78+ fi
79+
80+ - name : Set up Java (SDK generation)
81+ if : steps.configure.outputs.generate == 'true'
82+ uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
83+ with :
84+ distribution : ' temurin'
85+ java-version : ' 11'
86+
87+ - name : Set up Node.js (SDK generation)
88+ if : steps.configure.outputs.generate == 'true'
89+ uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
90+ with :
91+ node-version : ' 20'
92+
93+ - name : Install openapi-generator-cli (SDK generation)
94+ if : steps.configure.outputs.generate == 'true'
95+ shell : bash
96+ run : npm install -g @openapitools/openapi-generator-cli
97+
98+ - name : Generate ogx-client SDK
99+ if : steps.configure.outputs.generate == 'true'
100+ shell : bash
101+ working-directory : client-sdks/openapi
102+ run : |
103+ echo "Generating ogx-client SDK (OPEN=0) from checkout..."
104+ make sdk OPEN=0
105+
106+ PY_FILE_COUNT=$(find sdks/python -name "*.py" | wc -l)
107+ echo "Generated Python files: $PY_FILE_COUNT"
108+ if [ "$PY_FILE_COUNT" -le 10 ]; then
109+ echo "::error::Too few Python files generated (expected > 10, got $PY_FILE_COUNT)"
110+ exit 1
78111 fi
0 commit comments