Skip to content

Test Installation Scripts #8

Test Installation Scripts

Test Installation Scripts #8

name: Test Installation Scripts
on:
workflow_dispatch:
inputs:
test_version:
description: 'Specific version to test (leave empty for latest)'
required: false
default: ''
jobs:
test-bash-install:
name: Test Bash Install Script
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
steps:
- name: Test curl installation method (Real User Experience)
run: |
echo "🌐 Testing real user experience - no repository checkout"
echo "This tests the exact command users will run"
# Create test directory
mkdir -p /tmp/wash-test
cd /tmp/wash-test
# Test the actual curl installation that users will run
echo "Running: curl -sSL https://raw.githubusercontent.com/cosmonic-labs/wash/main/install.sh | bash"
curl -sSL https://raw.githubusercontent.com/cosmonic-labs/wash/main/install.sh | INSTALL_DIR=/tmp/wash-test bash
# Verify installation
if [ -f "/tmp/wash-test/wash" ]; then
echo "βœ… Bash installation works!"
chmod +x /tmp/wash-test/wash
/tmp/wash-test/wash --help
else
echo "❌ Bash installation failed"
echo "πŸ“ Directory contents:"
ls -la /tmp/wash-test/
exit 1
fi
- name: Test with specific version
if: ${{ inputs.test_version != '' }}
run: |
echo "Testing with specific version: ${{ inputs.test_version }}"
# For version-specific testing, you would modify the script to accept a version parameter
# This is a placeholder for future enhancement
test-powershell-install:
name: Test PowerShell Install Script
runs-on: windows-latest
steps:
- name: Test PowerShell web installation
shell: powershell
run: |
# Create test directory
$testDir = "C:\temp\wash-test"
New-Item -ItemType Directory -Path $testDir -Force
# Set install directory via environment variable
$env:INSTALL_DIR = $testDir
# Test the actual PowerShell installation that users will run
iwr -useb https://raw.githubusercontent.com/cosmonic-labs/wash/main/install.ps1 | iex
# Verify installation
$washPath = Join-Path $testDir "wash.exe"
if (Test-Path $washPath) {
Write-Host "βœ… PowerShell installation successful"
& $washPath --help
} else {
Write-Host "❌ PowerShell installation failed"
Get-ChildItem $testDir -Force
exit 1
}
- name: Test PowerShell with PATH addition
shell: powershell
run: |
# Test adding to PATH
$testDir = "C:\temp\wash-path-test"
New-Item -ItemType Directory -Path $testDir -Force
$env:INSTALL_DIR = $testDir
$env:ADD_TO_PATH = "true"
iwr -useb https://raw.githubusercontent.com/cosmonic-labs/wash/main/install.ps1 | iex
$washPath = Join-Path $testDir "wash.exe"
if (Test-Path $washPath) {
Write-Host "βœ… PowerShell PATH installation successful"
} else {
Write-Host "❌ PowerShell PATH installation failed"
exit 1
}
summarize-results:
name: Summarize Test Results
runs-on: ubuntu-latest
needs: [test-bash-install, test-powershell-install]
if: always()
steps:
- name: Summary
run: |
echo "## Installation Script Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Test Configuration" >> $GITHUB_STEP_SUMMARY
echo "- Test Version: ${{ inputs.test_version || 'latest' }}" >> $GITHUB_STEP_SUMMARY
echo "- Repository: cosmonic-labs/wash (public)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Results" >> $GITHUB_STEP_SUMMARY
echo "- Bash Install (Unix): ${{ needs.test-bash-install.result }}" >> $GITHUB_STEP_SUMMARY
echo "- PowerShell Install (Windows): ${{ needs.test-powershell-install.result }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.test-bash-install.result }}" = "success" ] && \
[ "${{ needs.test-powershell-install.result }}" = "success" ]; then
echo "βœ… All installation script tests passed!" >> $GITHUB_STEP_SUMMARY
else
echo "❌ Some installation script tests failed. Check the job details above." >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Usage Instructions" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Linux/macOS:**" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo 'curl -sSL https://raw.githubusercontent.com/cosmonic-labs/wash/main/install.sh | bash' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Windows (PowerShell):**" >> $GITHUB_STEP_SUMMARY
echo '```powershell' >> $GITHUB_STEP_SUMMARY
echo 'iwr -useb https://raw.githubusercontent.com/cosmonic-labs/wash/main/install.ps1 | iex' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY