fix: CI validation scripts and example exit codes
lint-all-sdks.sh: - Update paths to find SDKs in clients/ directory structure - Add checks for Python, JavaScript, Ruby, Go, Rust, PHP, Perl, Lua, Bash, C - Exit non-zero on lint failures (previously always exit 0) validate-examples.sh: - Fix race condition with parallel execution - aggregate results from temp files after all jobs complete (subshell variables don't propagate to parent) - Add aggregate_results() function to collect stats from result JSON files Python async SDK: - Make aiohttp import optional with DependencyError exception - Add _check_aiohttp() helper for clear error messages Python examples (async + sync): - Exit with code 0 when API keys missing (CI-friendly skip) - Change "Error:" to "Skipping:" for missing credentials - Wrap un_async imports in try/except for aiohttp ImportError
This commit is contained in:
parent
fee81266a7
commit
35bbd37877
15 changed files with 250 additions and 85 deletions
|
|
@ -44,9 +44,9 @@ print(f"fib(10) = {fib(10)}")
|
|||
secret_key = os.environ.get("UNSANDBOX_SECRET_KEY")
|
||||
|
||||
if not public_key or not secret_key:
|
||||
print("Error: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("Run with: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(1)
|
||||
print("Skipping: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("To run: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(0) # Exit gracefully for CI
|
||||
|
||||
# Execute the code synchronously
|
||||
print("Calculating fibonacci(10)...")
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ except Exception as e:
|
|||
secret_key = os.environ.get("UNSANDBOX_SECRET_KEY")
|
||||
|
||||
if not public_key or not secret_key:
|
||||
print("Error: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("Run with: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(1)
|
||||
print("Skipping: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("To run: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(0) # Exit gracefully for CI
|
||||
|
||||
# Execute the code
|
||||
print("Executing file operations in sandbox...")
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ def main():
|
|||
secret_key = os.environ.get("UNSANDBOX_SECRET_KEY")
|
||||
|
||||
if not public_key or not secret_key:
|
||||
print("Error: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("Run with: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(1)
|
||||
print("Skipping: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("To run: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(0) # Exit gracefully for CI
|
||||
|
||||
# Execute the code synchronously
|
||||
print("Executing code synchronously...")
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ except Exception as e:
|
|||
secret_key = os.environ.get("UNSANDBOX_SECRET_KEY")
|
||||
|
||||
if not public_key or not secret_key:
|
||||
print("Error: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("Run with: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(1)
|
||||
print("Skipping: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("To run: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(0) # Exit gracefully for CI
|
||||
|
||||
# Execute the code
|
||||
print("Executing HTTP request in sandbox...")
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ except Exception as e:
|
|||
secret_key = os.environ.get("UNSANDBOX_SECRET_KEY")
|
||||
|
||||
if not public_key or not secret_key:
|
||||
print("Error: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("Run with: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(1)
|
||||
print("Skipping: UNSANDBOX_PUBLIC_KEY and UNSANDBOX_SECRET_KEY environment variables required")
|
||||
print("To run: export UNSANDBOX_PUBLIC_KEY=your-key UNSANDBOX_SECRET_KEY=your-key")
|
||||
sys.exit(0) # Exit gracefully for CI
|
||||
|
||||
# Execute the code
|
||||
print("Executing JSON processing in sandbox...")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue