mirror of
https://github.com/Valkyrie00/bold-brew.git
synced 2026-03-14 14:25:53 +01:00
fix(ci): properly detect and remove pre-installed Homebrew
GitHub Actions runners have Homebrew pre-installed but not in PATH. Check for directory existence, not just command availability. Force remove all Homebrew directories to ensure clean state.
This commit is contained in:
parent
298c59327d
commit
4be99a16b5
1 changed files with 31 additions and 7 deletions
38
.github/workflows/test-install.yml
vendored
38
.github/workflows/test-install.yml
vendored
|
|
@ -21,10 +21,21 @@ jobs:
|
|||
|
||||
- name: Ensure clean state (no Homebrew)
|
||||
run: |
|
||||
if command -v brew &> /dev/null; then
|
||||
# Check both PATH and direct path
|
||||
if command -v brew &> /dev/null || [ -d /home/linuxbrew/.linuxbrew ]; then
|
||||
echo "Removing existing Homebrew..."
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" -- --force || true
|
||||
# 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"
|
||||
|
||||
|
|
@ -52,11 +63,17 @@ jobs:
|
|||
|
||||
- name: Ensure clean state (no Homebrew)
|
||||
run: |
|
||||
if command -v brew &> /dev/null; then
|
||||
if command -v brew &> /dev/null || [ -d /opt/homebrew ]; then
|
||||
echo "Removing existing Homebrew..."
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" -- --force || true
|
||||
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
|
||||
|
|
@ -83,12 +100,19 @@ jobs:
|
|||
|
||||
- name: Ensure clean state (no Homebrew)
|
||||
run: |
|
||||
if command -v brew &> /dev/null; then
|
||||
if command -v brew &> /dev/null || [ -d /usr/local/Homebrew ]; then
|
||||
echo "Removing existing Homebrew..."
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" -- --force || true
|
||||
if [ -x /usr/local/bin/brew ]; then
|
||||
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" || true
|
||||
fi
|
||||
sudo rm -rf /usr/local/Homebrew
|
||||
sudo rm -rf /usr/local/Cellar
|
||||
sudo rm -rf /usr/local/bin/brew
|
||||
sudo rm -rf /usr/local/Caskroom
|
||||
sudo rm -f /usr/local/bin/brew
|
||||
fi
|
||||
if [ -d /usr/local/Homebrew ]; then
|
||||
echo "ERROR: Failed to remove Homebrew"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Clean state confirmed"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue