From 7fa7edd4059d69befb06976048bec343fd961a0f Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Sat, 18 Jan 2025 18:18:35 -0800 Subject: [PATCH] ci: Minor fix so that if gettext/libsodium is cached, don't warn Previously when we try to set up a cached package, Homebrew generates an annoying "already installed, it's just not linked" warning which is distracting when parsing CI logs. Just make sure to run `brew install` if we don't have the package cached. Note that when a package is not cached and we have to rebuild it, Homebrew will still warn needlessly because we have HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK set. This is mostly ok because most of the time our packages should be cached in CI. --- .github/actions/universal-package/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/universal-package/action.yml b/.github/actions/universal-package/action.yml index 466b8bf030..5b10af62e6 100644 --- a/.github/actions/universal-package/action.yml +++ b/.github/actions/universal-package/action.yml @@ -72,8 +72,9 @@ runs: # which cause brew install to return non-zero and fail the build. export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 - # This will be a no-op if formula was cached - brew install --quiet --formula -s ./${formula}.rb + # This will be a no-op if formula was cached. We check if the package + # exists first just to avoid an "already installed" warning. + brew list ${formula} &>/dev/null || brew install --quiet --formula -s ./${formula}.rb # If formula was cached, this step is necessary to relink it to brew prefix (e.g. /usr/local) brew unlink ${formula} && brew link ${formula}