Skip to content

Commit

Permalink
Issue #690: Add retries on dry-run brew install in CI (#698)
Browse files Browse the repository at this point in the history
  • Loading branch information
amalota authored Oct 17, 2022
1 parent 025bc44 commit 35b1584
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
command: bash ci/pypi/ci-deploy.sh

- run:
name: 'Update Homebrew with local installation test'
name: 'Update Homebrew formula'
# Prerequisites: artifacts must be released to PyPI first
command: bash ci/homebrew/ci-deploy.sh

Expand Down
18 changes: 16 additions & 2 deletions ci/homebrew/ci-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,22 @@ else
echo "Refraining from push since it's a dry run"
brew bump-formula-pr --write-only --no-browse --verbose --url "$url" --sha256 "$sha256" git-machete

echo "Install formula locally"
brew install --build-from-source --formula /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/git-machete.rb
echo "Attempt to install the formula locally"
attempts=3
i=1
while true; do
if brew install --build-from-source --formula /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/git-machete.rb; then
break
elif (( i < attempts )); then
echo "Retrying the installation..."
i=$((i + 1))
sleep 30
else
echo "Installing the formula locally did not succeed despite $attempts attempts"
exit 1
fi
done

if [[ "$version" != "$(git machete --version | cut -d' ' -f4)" ]]; then
echo "Something went wrong during brew installation: installed version does not match version from formula."
echo "Formula version: $version, installed version: $(git machete --version | cut -d' ' -f4)"
Expand Down

0 comments on commit 35b1584

Please sign in to comment.