Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
71 changes: 37 additions & 34 deletions .github/workflows/polyglot-validation/test-java-playground.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
# Polyglot SDK Validation - Java Playground Apps
# Iterates all Java playground apps under playground/polyglot/Java/,
# runs 'aspire restore' to regenerate the .modules/ SDK, and compiles the
# compact AppHost plus generated Java SDK sources to verify there are no
# regressions in the codegen API surface.
# Polyglot SDK Validation - Java validation AppHosts
# Iterates all Java validation AppHosts under tests/Polyglot/Java/,
# runs 'aspire restore --apphost' to regenerate the shared .modules/ SDK, and
# compiles each AppHost plus the generated Java SDK sources to verify there are
# no regressions in the codegen API surface.
set -euo pipefail

echo "=== Java Playground Codegen Validation ==="
echo "=== Java Validation AppHost Codegen Validation ==="

if ! command -v aspire &> /dev/null; then
echo "❌ Aspire CLI not found in PATH"
Expand All @@ -26,57 +26,52 @@ javac -version

SCRIPT_SOURCE="${BASH_SOURCE[0]:-$0}"
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
if [ -d "/workspace/playground/polyglot/Java" ]; then
PLAYGROUND_ROOT="/workspace/playground/polyglot/Java"
elif [ -d "$PWD/playground/polyglot/Java" ]; then
PLAYGROUND_ROOT="$(cd "$PWD/playground/polyglot/Java" && pwd)"
elif [ -d "$SCRIPT_DIR/../../../playground/polyglot/Java" ]; then
PLAYGROUND_ROOT="$(cd "$SCRIPT_DIR/../../../playground/polyglot/Java" && pwd)"
if [ -d "/workspace/tests/Polyglot/Java" ]; then
PLAYGROUND_ROOT="/workspace/tests/Polyglot/Java"
elif [ -d "$PWD/tests/Polyglot/Java" ]; then
PLAYGROUND_ROOT="$(cd "$PWD/tests/Polyglot/Java" && pwd)"
elif [ -d "$SCRIPT_DIR/../../../tests/Polyglot/Java" ]; then
PLAYGROUND_ROOT="$(cd "$SCRIPT_DIR/../../../tests/Polyglot/Java" && pwd)"
else
echo "❌ Cannot find playground/polyglot/Java directory"
echo "❌ Cannot find tests/Polyglot/Java directory"
exit 1
fi

echo "Playground root: $PLAYGROUND_ROOT"
echo "Validation root: $PLAYGROUND_ROOT"

APP_DIRS=()
for integration_dir in "$PLAYGROUND_ROOT"/*/; do
if [ -f "$integration_dir/ValidationAppHost/AppHost.java" ]; then
APP_DIRS+=("$integration_dir/ValidationAppHost")
fi
done
mapfile -t APP_HOSTS < <(find "$PLAYGROUND_ROOT" -maxdepth 1 -type f -name '*.apphost.java' | sort)

if [ ${#APP_DIRS[@]} -eq 0 ]; then
echo "❌ No Java playground apps found"
if [ ${#APP_HOSTS[@]} -eq 0 ]; then
echo "❌ No Java validation AppHosts found"
exit 1
fi

echo "Found ${#APP_DIRS[@]} Java playground apps:"
for dir in "${APP_DIRS[@]}"; do
echo " - $(basename "$(dirname "$dir")")/$(basename "$dir")"
echo "Found ${#APP_HOSTS[@]} Java validation AppHosts:"
for app_host in "${APP_HOSTS[@]}"; do
echo " - $(basename "$app_host")"
done
echo ""

FAILED=()
PASSED=()

for app_dir in "${APP_DIRS[@]}"; do
app_name="$(basename "$(dirname "$app_dir")")/$(basename "$app_dir")"
for app_host in "${APP_HOSTS[@]}"; do
app_name="$(basename "$app_host")"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Testing: $app_name"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

cd "$app_dir"
cd "$PLAYGROUND_ROOT"

echo " → aspire restore..."
if ! aspire restore --non-interactive 2>&1; then
echo " → aspire restore --apphost $app_name..."
if ! aspire restore --non-interactive --apphost "$app_host" 2>&1; then
echo " ❌ aspire restore failed for $app_name"
FAILED+=("$app_name (aspire restore)")
continue
fi

echo " → javac..."
build_dir="$app_dir/.java-build"
build_dir="$PLAYGROUND_ROOT/.java-build"
rm -rf "$build_dir"
mkdir -p "$build_dir"

Expand All @@ -87,7 +82,15 @@ for app_dir in "${APP_DIRS[@]}"; do
continue
fi

if ! javac --enable-preview --source 25 -d "$build_dir" @.modules/sources.txt AppHost.java 2>&1; then
temp_apphost="$build_dir/AppHost.java"
if ! cp "$app_host" "$temp_apphost"; then
echo " ❌ Failed to prepare AppHost.java for $app_name"
FAILED+=("$app_name (prepare apphost)")
rm -rf "$build_dir"
continue
fi

if ! javac --enable-preview --source 25 -d "$build_dir" @.modules/sources.txt "$temp_apphost" 2>&1; then
echo " ❌ javac compilation failed for $app_name"
FAILED+=("$app_name (javac)")
rm -rf "$build_dir"
Expand All @@ -102,7 +105,7 @@ done

echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Results: ${#PASSED[@]} passed, ${#FAILED[@]} failed out of ${#APP_DIRS[@]} apps"
echo "Results: ${#PASSED[@]} passed, ${#FAILED[@]} failed out of ${#APP_HOSTS[@]} AppHosts"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

if [ ${#FAILED[@]} -gt 0 ]; then
Expand All @@ -114,5 +117,5 @@ if [ ${#FAILED[@]} -gt 0 ]; then
exit 1
fi

echo "✅ All Java playground apps validated successfully!"
echo "✅ All Java validation AppHosts validated successfully!"
exit 0
58 changes: 27 additions & 31 deletions .github/workflows/polyglot-validation/test-python-playground.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
# Polyglot SDK Validation - Python Playground Apps
# Iterates all Python playground apps under playground/polyglot/Python/,
# runs 'aspire restore' to regenerate the .modules/ SDK, and compiles the
# apphost and generated Python modules to verify there are no syntax regressions.
# Polyglot SDK Validation - Python validation AppHosts
# Iterates all Python validation AppHosts under tests/Polyglot/Python/,
# runs 'aspire restore --apphost' to regenerate the shared .modules/ SDK, and
# compiles each AppHost with the generated Python modules to verify syntax.
set -euo pipefail

echo "=== Python Playground Codegen Validation ==="
echo "=== Python Validation AppHost Codegen Validation ==="

if ! command -v aspire &> /dev/null; then
echo "ERROR: Aspire CLI not found in PATH"
Expand All @@ -21,48 +21,43 @@ echo "Aspire CLI version:"
aspire --version

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -d "/workspace/playground/polyglot/Python" ]; then
PLAYGROUND_ROOT="/workspace/playground/polyglot/Python"
elif [ -d "$SCRIPT_DIR/../../../playground/polyglot/Python" ]; then
PLAYGROUND_ROOT="$(cd "$SCRIPT_DIR/../../../playground/polyglot/Python" && pwd)"
if [ -d "/workspace/tests/Polyglot/Python" ]; then
PLAYGROUND_ROOT="/workspace/tests/Polyglot/Python"
elif [ -d "$SCRIPT_DIR/../../../tests/Polyglot/Python" ]; then
PLAYGROUND_ROOT="$(cd "$SCRIPT_DIR/../../../tests/Polyglot/Python" && pwd)"
else
echo "ERROR: Cannot find playground/polyglot/Python directory"
echo "ERROR: Cannot find tests/Polyglot/Python directory"
exit 1
fi

echo "Playground root: $PLAYGROUND_ROOT"
echo "Validation root: $PLAYGROUND_ROOT"

APP_DIRS=()
for integration_dir in "$PLAYGROUND_ROOT"/*/; do
if [ -f "$integration_dir/ValidationAppHost/apphost.py" ]; then
APP_DIRS+=("$integration_dir/ValidationAppHost")
fi
done
mapfile -t APP_HOSTS < <(find "$PLAYGROUND_ROOT" -maxdepth 1 -type f -name '*.apphost.py' | sort)

if [ ${#APP_DIRS[@]} -eq 0 ]; then
echo "ERROR: No Python playground apps found"
if [ ${#APP_HOSTS[@]} -eq 0 ]; then
echo "ERROR: No Python validation AppHosts found"
exit 1
fi

echo "Found ${#APP_DIRS[@]} Python playground apps:"
for dir in "${APP_DIRS[@]}"; do
echo " - $(basename "$(dirname "$dir")")/$(basename "$dir")"
echo "Found ${#APP_HOSTS[@]} Python validation AppHosts:"
for app_host in "${APP_HOSTS[@]}"; do
echo " - $(basename "$app_host")"
done
echo ""

FAILED=()
PASSED=()

for app_dir in "${APP_DIRS[@]}"; do
app_name="$(basename "$(dirname "$app_dir")")/$(basename "$app_dir")"
for app_host in "${APP_HOSTS[@]}"; do
app_name="$(basename "$app_host")"
echo "----------------------------------------"
echo "Testing: $app_name"
echo "----------------------------------------"

cd "$app_dir"
cd "$PLAYGROUND_ROOT"

echo " -> aspire restore..."
if ! aspire restore 2>&1; then
echo " -> aspire restore --apphost $app_name..."
if ! aspire restore --non-interactive --apphost "$app_host" 2>&1; then
echo " ERROR: aspire restore failed for $app_name"
FAILED+=("$app_name (aspire restore)")
continue
Expand All @@ -75,10 +70,11 @@ for app_dir in "${APP_DIRS[@]}"; do
fi

echo " -> python syntax validation..."
if ! python3 - <<'INNERPY'
if ! python3 - "$app_name" <<'INNERPY'
from pathlib import Path
import sys

files = [Path('apphost.py')]
files = [Path(sys.argv[1])]
files.extend(sorted(Path('.modules').rglob('*.py')))
for file in files:
compile(file.read_text(encoding='utf-8'), str(file), 'exec')
Expand All @@ -96,7 +92,7 @@ done

echo ""
echo "----------------------------------------"
echo "Results: ${#PASSED[@]} passed, ${#FAILED[@]} failed out of ${#APP_DIRS[@]} apps"
echo "Results: ${#PASSED[@]} passed, ${#FAILED[@]} failed out of ${#APP_HOSTS[@]} AppHosts"
echo "----------------------------------------"

if [ ${#FAILED[@]} -gt 0 ]; then
Expand All @@ -108,5 +104,5 @@ if [ ${#FAILED[@]} -gt 0 ]; then
exit 1
fi

echo "All Python playground apps validated successfully!"
echo "All Python validation AppHosts validated successfully!"
exit 0
95 changes: 49 additions & 46 deletions .github/workflows/polyglot-validation/test-typescript-playground.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
# Polyglot SDK Validation - TypeScript Playground Apps
# Iterates all TypeScript playground apps under playground/polyglot/TypeScript/,
# runs 'aspire restore' to regenerate the .modules/ SDK, and compiles with 'tsc'
# to verify there are no regressions in the codegen API surface.
# Polyglot SDK Validation - TypeScript validation AppHosts
# Iterates all TypeScript validation AppHosts under tests/Polyglot/TypeScript/,
# runs 'aspire restore --apphost' to regenerate the shared .modules/ SDK, and
# type-checks each AppHost against the generated API surface.
set -euo pipefail

echo "=== TypeScript Playground Codegen Validation ==="
echo "=== TypeScript Validation AppHost Codegen Validation ==="

# Verify prerequisites
if ! command -v aspire &> /dev/null; then
Expand All @@ -21,70 +21,73 @@ fi
echo "Aspire CLI version:"
aspire --version

# Locate playground root (works from repo root or /workspace mount)
# Locate validation root (works from repo root or /workspace mount)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -d "/workspace/playground/polyglot/TypeScript" ]; then
PLAYGROUND_ROOT="/workspace/playground/polyglot/TypeScript"
elif [ -d "$SCRIPT_DIR/../../../playground/polyglot/TypeScript" ]; then
PLAYGROUND_ROOT="$(cd "$SCRIPT_DIR/../../../playground/polyglot/TypeScript" && pwd)"
if [ -d "/workspace/tests/Polyglot/TypeScript" ]; then
VALIDATION_ROOT="/workspace/tests/Polyglot/TypeScript"
elif [ -d "$SCRIPT_DIR/../../../tests/Polyglot/TypeScript" ]; then
VALIDATION_ROOT="$(cd "$SCRIPT_DIR/../../../tests/Polyglot/TypeScript" && pwd)"
else
echo "❌ Cannot find playground/polyglot/TypeScript directory"
echo "❌ Cannot find tests/Polyglot/TypeScript directory"
exit 1
fi

echo "Playground root: $PLAYGROUND_ROOT"
echo "Validation root: $VALIDATION_ROOT"

# Discover all TypeScript ValidationAppHost apps
APP_DIRS=()
for integration_dir in "$PLAYGROUND_ROOT"/*/; do
if [ -f "$integration_dir/ValidationAppHost/apphost.ts" ]; then
APP_DIRS+=("$integration_dir/ValidationAppHost")
fi
done
cd "$VALIDATION_ROOT"

echo "→ npm install..."
npm_output=$(npm install --ignore-scripts --no-audit --no-fund 2>&1) || {
echo "$npm_output" | tail -5
echo "❌ npm install failed for $VALIDATION_ROOT"
exit 1
}
echo "$npm_output" | tail -3

if [ ${#APP_DIRS[@]} -eq 0 ]; then
echo "❌ No TypeScript playground apps found"
mapfile -t APP_HOSTS < <(find "$VALIDATION_ROOT" -maxdepth 1 -type f -name '*.apphost.ts' -exec basename {} \; | sort)

if [ ${#APP_HOSTS[@]} -eq 0 ]; then
echo "❌ No TypeScript validation AppHosts found"
exit 1
fi

echo "Found ${#APP_DIRS[@]} TypeScript playground apps:"
for dir in "${APP_DIRS[@]}"; do
echo " - $(basename "$(dirname "$dir")")/$(basename "$dir")"
echo "Found ${#APP_HOSTS[@]} TypeScript validation AppHosts:"
for app_host in "${APP_HOSTS[@]}"; do
echo " - $(basename "$app_host")"
done
echo ""

FAILED=()
PASSED=()
TEMP_TSCONFIG="$VALIDATION_ROOT/.validation.tsconfig.json"
trap 'rm -f "$TEMP_TSCONFIG"' EXIT

for app_dir in "${APP_DIRS[@]}"; do
app_name="$(basename "$(dirname "$app_dir")")/$(basename "$app_dir")"
for app_name in "${APP_HOSTS[@]}"; do
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Testing: $app_name"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

cd "$app_dir"

# Step 1: Install npm dependencies
echo " → npm install..."
npm_output=$(npm install --ignore-scripts --no-audit --no-fund 2>&1) || {
echo "$npm_output" | tail -5
echo " ❌ npm install failed for $app_name"
FAILED+=("$app_name (npm install)")
continue
}
echo "$npm_output" | tail -3

# Step 2: Regenerate SDK code
echo " → aspire restore..."
if ! aspire restore 2>&1; then
# Step 1: Regenerate SDK code for the selected AppHost
echo " → aspire restore --apphost $app_name..."
if ! aspire restore --non-interactive --apphost "$app_name" 2>&1; then
echo " ❌ aspire restore failed for $app_name"
FAILED+=("$app_name (aspire restore)")
continue
fi

# Step 3: Type-check with TypeScript compiler
echo " → tsc --noEmit..."
if ! npx tsc --noEmit 2>&1; then
cat > "$TEMP_TSCONFIG" <<EOF
{
"extends": "./tsconfig.json",
"include": [
"$app_name",
".modules/**/*.ts"
]
}
EOF

# Step 2: Type-check the selected AppHost with the generated modules
echo " → tsc --noEmit --project $(basename "$TEMP_TSCONFIG")..."
if ! npx tsc --noEmit --project "$TEMP_TSCONFIG" 2>&1; then
echo " ❌ tsc compilation failed for $app_name"
FAILED+=("$app_name (tsc)")
continue
Expand All @@ -97,7 +100,7 @@ done

echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "Results: ${#PASSED[@]} passed, ${#FAILED[@]} failed out of ${#APP_DIRS[@]} apps"
echo "Results: ${#PASSED[@]} passed, ${#FAILED[@]} failed out of ${#APP_HOSTS[@]} AppHosts"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

if [ ${#FAILED[@]} -gt 0 ]; then
Expand All @@ -109,5 +112,5 @@ if [ ${#FAILED[@]} -gt 0 ]; then
exit 1
fi

echo "✅ All TypeScript playground apps validated successfully!"
echo "✅ All TypeScript validation AppHosts validated successfully!"
exit 0
Loading
Loading