Test Installation Scripts #8
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: 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 |