name: Test Install Script on: push: paths: - 'install.sh' - '.github/workflows/test-install.yml' pull_request: paths: - 'install.sh' - '.github/workflows/test-install.yml' workflow_dispatch: # Allow manual trigger jobs: test-linux: name: Test on Linux (Ubuntu) runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Ensure clean state (no Homebrew) run: | # Check both PATH and direct path if command -v brew &> /dev/null || [ -d /home/linuxbrew/.linuxbrew ]; then echo "Removing existing Homebrew..." # Try official uninstaller first if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" || true fi # Force remove directories sudo rm -rf /home/linuxbrew/.linuxbrew sudo rm -rf /home/linuxbrew fi # Verify clean if [ -d /home/linuxbrew ]; then echo "ERROR: Failed to remove Homebrew" exit 1 fi echo "✓ Clean state confirmed" - name: Run install script run: | chmod +x install.sh ./install.sh - name: Verify installation run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" echo "==> Checking brew..." brew --version echo "==> Checking bbrew..." which bbrew bbrew --help | head -3 echo "✓ All checks passed!" test-macos-arm: name: Test on macOS (Apple Silicon) runs-on: macos-14 # M1 runner steps: - name: Checkout uses: actions/checkout@v4 - name: Ensure clean state (no Homebrew) run: | if command -v brew &> /dev/null || [ -d /opt/homebrew ]; then echo "Removing existing Homebrew..." if [ -x /opt/homebrew/bin/brew ]; then NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" || true fi sudo rm -rf /opt/homebrew fi if [ -d /opt/homebrew ]; then echo "ERROR: Failed to remove Homebrew" exit 1 fi echo "✓ Clean state confirmed" - name: Run install script run: | chmod +x install.sh ./install.sh - name: Verify installation run: | eval "$(/opt/homebrew/bin/brew shellenv)" echo "==> Checking brew..." brew --version echo "==> Checking bbrew..." which bbrew bbrew --help | head -3 echo "✓ All checks passed!" test-already-installed: name: Test upgrade path (Homebrew already installed) runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Pre-install Homebrew run: | NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" brew --version echo "✓ Homebrew pre-installed" - name: Run install script (should detect existing install) run: | chmod +x install.sh ./install.sh - name: Verify bbrew installed run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" which bbrew bbrew --help | head -3 echo "✓ Upgrade path works!"