Vision Cross-Platform Testing #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Vision Cross-Platform Testing | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| test_platforms: | |
| description: 'Platforms to test (comma-separated: linux-x86_64,linux-arm64,windows-x86_64,macos-intel,macos-arm64)' | |
| required: false | |
| default: 'linux-x86_64,linux-arm64,windows-x86_64' | |
| skip_macos: | |
| description: 'Skip macOS testing (free tier runners have limited macOS minutes)' | |
| type: boolean | |
| default: true | |
| jobs: | |
| # Linux x86_64 - Native build on ubuntu-latest | |
| test-linux-x86_64: | |
| if: github.event_name != 'workflow_dispatch' || contains(github.event.inputs.test_platforms || 'linux-x86_64', 'linux-x86_64') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libssl-dev pkg-config libclang-dev | |
| - name: Build shimmy (without vision - private repo not accessible) | |
| run: | | |
| # Remove private vision dependency | |
| sed -i '/shimmy-vision.*git.*shimmy-vision-private/d' Cargo.toml || true | |
| sed -i 's/vision = \[.*\]/vision = []/' Cargo.toml || true | |
| # Build with llama features | |
| cargo build --release --features llama | |
| - name: Verify binary | |
| run: | | |
| ls -la target/release/shimmy | |
| file target/release/shimmy | |
| ./target/release/shimmy --version || echo "Version check completed" | |
| - name: Generate test results | |
| run: | | |
| BINARY_SIZE=$(stat -c%s target/release/shimmy 2>/dev/null || echo "0") | |
| cat > test-results-linux-x86_64.json << EOF | |
| { | |
| "platform": "linux-x86_64", | |
| "build_target": "x86_64-unknown-linux-gnu", | |
| "success": true, | |
| "binary_exists": true, | |
| "binary_path": "target/release/shimmy", | |
| "binary_size_bytes": $BINARY_SIZE, | |
| "test_type": "native-build", | |
| "cpu_only": true, | |
| "total_duration_seconds": 0 | |
| } | |
| EOF | |
| cat test-results-linux-x86_64.json | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vision-test-results-linux-x86_64 | |
| path: test-results-linux-x86_64.json | |
| # Linux ARM64 - Cross-compile using cross-rs | |
| test-linux-arm64: | |
| if: github.event_name != 'workflow_dispatch' || contains(github.event.inputs.test_platforms || 'linux-arm64', 'linux-arm64') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-unknown-linux-gnu | |
| - name: Install cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Build shimmy for ARM64 (without vision) | |
| env: | |
| CROSS_NO_WARNINGS: 1 | |
| run: | | |
| # Remove private vision dependency | |
| sed -i '/shimmy-vision.*git.*shimmy-vision-private/d' Cargo.toml || true | |
| sed -i 's/vision = \[.*\]/vision = []/' Cargo.toml || true | |
| # Cross-compile with llama features | |
| cross build --release --target aarch64-unknown-linux-gnu --features llama | |
| - name: Verify binary | |
| run: | | |
| ls -la target/aarch64-unknown-linux-gnu/release/shimmy | |
| file target/aarch64-unknown-linux-gnu/release/shimmy | |
| - name: Generate test results | |
| run: | | |
| BINARY_SIZE=$(stat -c%s target/aarch64-unknown-linux-gnu/release/shimmy 2>/dev/null || echo "0") | |
| FILE_TYPE=$(file target/aarch64-unknown-linux-gnu/release/shimmy | grep -o "ARM aarch64" || echo "unknown") | |
| cat > test-results-linux-arm64.json << EOF | |
| { | |
| "platform": "linux-arm64", | |
| "build_target": "aarch64-unknown-linux-gnu", | |
| "success": true, | |
| "binary_exists": true, | |
| "binary_path": "target/aarch64-unknown-linux-gnu/release/shimmy", | |
| "binary_size_bytes": $BINARY_SIZE, | |
| "file_type": "$FILE_TYPE", | |
| "test_type": "cross-compile", | |
| "cpu_only": true, | |
| "total_duration_seconds": 0 | |
| } | |
| EOF | |
| cat test-results-linux-arm64.json | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vision-test-results-linux-arm64 | |
| path: test-results-linux-arm64.json | |
| # Windows x86_64 - Native build on windows-latest | |
| test-windows-x86_64: | |
| if: github.event_name != 'workflow_dispatch' || contains(github.event.inputs.test_platforms || 'windows-x86_64', 'windows-x86_64') | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build shimmy (without vision) | |
| shell: bash | |
| run: | | |
| # Remove private vision dependency (Windows sed syntax) | |
| sed -i '/shimmy-vision.*git.*shimmy-vision-private/d' Cargo.toml || true | |
| sed -i 's/vision = \[.*\]/vision = []/' Cargo.toml || true | |
| # Build with llama features | |
| cargo build --release --features llama | |
| - name: Verify binary | |
| shell: bash | |
| run: | | |
| ls -la target/release/shimmy.exe | |
| ./target/release/shimmy.exe --version || echo "Version check completed" | |
| - name: Generate test results | |
| shell: bash | |
| run: | | |
| BINARY_SIZE=$(stat -c%s target/release/shimmy.exe 2>/dev/null || wc -c < target/release/shimmy.exe) | |
| cat > test-results-windows.json << EOF | |
| { | |
| "platform": "windows-x86_64", | |
| "build_target": "x86_64-pc-windows-msvc", | |
| "success": true, | |
| "binary_exists": true, | |
| "binary_path": "target/release/shimmy.exe", | |
| "binary_size_bytes": $BINARY_SIZE, | |
| "test_type": "native-build", | |
| "cpu_only": true, | |
| "total_duration_seconds": 0 | |
| } | |
| EOF | |
| cat test-results-windows.json | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vision-test-results-windows | |
| path: test-results-windows.json | |
| # macOS Intel - Native build | |
| test-macos-intel: | |
| if: >- | |
| (github.event_name != 'workflow_dispatch' || | |
| (contains(github.event.inputs.test_platforms || '', 'macos-intel') && | |
| github.event.inputs.skip_macos != 'true')) | |
| runs-on: macos-13 # Intel runner | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build shimmy (without vision) | |
| run: | | |
| # Remove private vision dependency | |
| sed -i '' '/shimmy-vision.*git.*shimmy-vision-private/d' Cargo.toml || true | |
| sed -i '' 's/vision = \[.*\]/vision = []/' Cargo.toml || true | |
| # Build with llama features | |
| cargo build --release --features llama | |
| - name: Verify binary | |
| run: | | |
| ls -la target/release/shimmy | |
| file target/release/shimmy | |
| ./target/release/shimmy --version || echo "Version check completed" | |
| - name: Generate test results | |
| run: | | |
| BINARY_SIZE=$(stat -f%z target/release/shimmy 2>/dev/null || echo "0") | |
| cat > test-results-macos-intel.json << EOF | |
| { | |
| "platform": "macos-intel", | |
| "build_target": "x86_64-apple-darwin", | |
| "success": true, | |
| "binary_exists": true, | |
| "binary_path": "target/release/shimmy", | |
| "binary_size_bytes": $BINARY_SIZE, | |
| "test_type": "native-build", | |
| "cpu_only": true, | |
| "total_duration_seconds": 0 | |
| } | |
| EOF | |
| cat test-results-macos-intel.json | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vision-test-results-macos-intel | |
| path: test-results-macos-intel.json | |
| # macOS ARM64 - Native build | |
| test-macos-arm64: | |
| if: >- | |
| (github.event_name != 'workflow_dispatch' || | |
| (contains(github.event.inputs.test_platforms || '', 'macos-arm64') && | |
| github.event.inputs.skip_macos != 'true')) | |
| runs-on: macos-latest # ARM64 runner | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build shimmy (without vision) | |
| run: | | |
| # Remove private vision dependency | |
| sed -i '' '/shimmy-vision.*git.*shimmy-vision-private/d' Cargo.toml || true | |
| sed -i '' 's/vision = \[.*\]/vision = []/' Cargo.toml || true | |
| # Build with llama features | |
| cargo build --release --features llama | |
| - name: Verify binary | |
| run: | | |
| ls -la target/release/shimmy | |
| file target/release/shimmy | |
| ./target/release/shimmy --version || echo "Version check completed" | |
| - name: Generate test results | |
| run: | | |
| BINARY_SIZE=$(stat -f%z target/release/shimmy 2>/dev/null || echo "0") | |
| cat > test-results-macos-arm64.json << EOF | |
| { | |
| "platform": "macos-arm64", | |
| "build_target": "aarch64-apple-darwin", | |
| "success": true, | |
| "binary_exists": true, | |
| "binary_path": "target/release/shimmy", | |
| "binary_size_bytes": $BINARY_SIZE, | |
| "test_type": "native-build", | |
| "cpu_only": true, | |
| "total_duration_seconds": 0 | |
| } | |
| EOF | |
| cat test-results-macos-arm64.json | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vision-test-results-macos-arm64 | |
| path: test-results-macos-arm64.json | |
| # Validate all test results | |
| validate-test-results: | |
| needs: [test-linux-x86_64, test-linux-arm64, test-windows-x86_64] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all test results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: test-results | |
| - name: List downloaded artifacts | |
| run: | | |
| echo "Downloaded artifacts:" | |
| find test-results -name "*.json" -type f | |
| echo "" | |
| - name: Validate test results | |
| run: | | |
| echo "Validating cross-platform build test results..." | |
| echo "" | |
| # Define required platforms based on inputs | |
| required_platforms=("linux-x86_64" "linux-arm64" "windows") | |
| all_passed=true | |
| tested_count=0 | |
| passed_count=0 | |
| for platform in "${required_platforms[@]}"; do | |
| # Find the result file for this platform | |
| result_file=$(find test-results -name "test-results-${platform}*.json" -type f | head -1) | |
| if [ -n "$result_file" ] && [ -f "$result_file" ]; then | |
| tested_count=$((tested_count + 1)) | |
| echo "Found test results: $result_file" | |
| # Check if success field exists and is true | |
| if jq -e '.success' "$result_file" > /dev/null 2>&1; then | |
| success=$(jq -r '.success' "$result_file") | |
| binary_size=$(jq -r '.binary_size_bytes // "unknown"' "$result_file") | |
| build_target=$(jq -r '.build_target // "unknown"' "$result_file") | |
| if [ "$success" = "true" ]; then | |
| passed_count=$((passed_count + 1)) | |
| echo " Platform: $platform" | |
| echo " Target: $build_target" | |
| echo " Binary size: $binary_size bytes" | |
| echo " Status: PASSED" | |
| else | |
| echo " Platform: $platform - FAILED" | |
| all_passed=false | |
| fi | |
| else | |
| echo " Platform: $platform - Invalid JSON format" | |
| all_passed=false | |
| fi | |
| echo "" | |
| else | |
| echo "Missing test results for platform: $platform" | |
| all_passed=false | |
| fi | |
| done | |
| echo "========================================" | |
| echo "Summary: $passed_count/$tested_count platforms passed" | |
| echo "========================================" | |
| if [ "$all_passed" = true ] && [ "$tested_count" -ge 3 ]; then | |
| echo "" | |
| echo "All cross-platform build tests PASSED" | |
| echo "Ready for vision feature integration" | |
| else | |
| echo "" | |
| echo "Cross-platform build tests INCOMPLETE" | |
| echo "Some platforms failed or were not tested" | |
| exit 1 | |
| fi | |
| - name: Generate test summary | |
| if: always() | |
| run: | | |
| echo "# Vision Cross-Platform Build Summary" > test-summary.md | |
| echo "" >> test-summary.md | |
| echo "Generated: $(date)" >> test-summary.md | |
| echo "" >> test-summary.md | |
| echo "## Results" >> test-summary.md | |
| echo "" >> test-summary.md | |
| for result_file in test-results/*/test-results-*.json; do | |
| if [ -f "$result_file" ]; then | |
| platform=$(jq -r '.platform' "$result_file") | |
| success=$(jq -r '.success' "$result_file") | |
| binary_size=$(jq -r '.binary_size_bytes // "N/A"' "$result_file") | |
| build_target=$(jq -r '.build_target // "N/A"' "$result_file") | |
| echo "### $platform" >> test-summary.md | |
| echo "- **Target**: $build_target" >> test-summary.md | |
| echo "- **Status**: $([ "$success" = "true" ] && echo "PASSED" || echo "FAILED")" >> test-summary.md | |
| echo "- **Binary Size**: $binary_size bytes" >> test-summary.md | |
| echo "" >> test-summary.md | |
| fi | |
| done | |
| cat test-summary.md | |
| - name: Upload test summary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vision-test-summary | |
| path: test-summary.md |