feat: wire Stainless preview SDK into integration tests (#4360)

# What does this PR do?

Enable stainless-builds workflow to test preview SDKs by calling
integration-tests workflow with python_url parameter. Add stainless
matrix config for faster CI runs on SDK changes.

  - Make integration-tests.yml reusable with workflow_call inputs
  - Thread python_url through test setup actions to install preview SDK
- Add matrix_key parameter to generate_ci_matrix.py for custom matrices
- Update stainless-builds.yml to call integration tests with preview URL

This allows us to test a client on the PR introducing the new changes
before merging. Contributors can even write new tests using the
generated client which should pass on the PR, indicating that they will
pass on main upon merge

## Test Plan

see triggered action using the workflows on this branch:
5810594042
which installs the stainless SDK from the given url.

---------

Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
Charlie Doern 2025-12-16 12:20:40 -05:00 committed by GitHub
parent 12116467f5
commit 66f3cf4002
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 102 additions and 12 deletions

View file

@ -24,24 +24,30 @@ DEFAULT_MATRIX = matrix_config["default"]
SCHEDULE_MATRICES: dict[str, list[dict[str, str]]] = matrix_config.get("schedules", {})
def generate_matrix(schedule="", test_setup=""):
def generate_matrix(schedule="", test_setup="", matrix_key="default"):
"""
Generate test matrix based on schedule or manual input.
Generate test matrix based on schedule, manual input, or matrix key.
Args:
schedule: GitHub cron schedule string (e.g., "1 0 * * 0" for weekly)
test_setup: Manual test setup input (e.g., "ollama-vision")
matrix_key: Matrix configuration key from ci_matrix.json (e.g., "default", "stainless")
Returns:
Matrix configuration as JSON string
"""
# Weekly scheduled test matrices
# Weekly scheduled test matrices (highest priority)
if schedule and schedule in SCHEDULE_MATRICES:
matrix = SCHEDULE_MATRICES[schedule]
# Manual input for specific setup
elif test_setup == "ollama-vision":
matrix = [{"suite": "vision", "setup": "ollama-vision"}]
# Default: use JSON-defined matrix
# Use specified matrix key from ci_matrix.json
elif matrix_key:
if matrix_key not in matrix_config:
raise ValueError(f"Invalid matrix_key '{matrix_key}'. Available keys: {list(matrix_config.keys())}")
matrix = matrix_config[matrix_key]
# Default: use JSON-defined default matrix
else:
matrix = DEFAULT_MATRIX
@ -55,7 +61,8 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate CI test matrix")
parser.add_argument("--schedule", default="", help="GitHub schedule cron string")
parser.add_argument("--test-setup", default="", help="Manual test setup input")
parser.add_argument("--matrix-key", default="default", help="Matrix configuration key from ci_matrix.json")
args = parser.parse_args()
print(generate_matrix(args.schedule, args.test_setup))
print(generate_matrix(args.schedule, args.test_setup, args.matrix_key))