Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions .github/workflows/finalize-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,32 @@ jobs:
APP="$HOME/Applications/Microbridge.app"
test -x "$(brew --prefix DevVig/microbridge/microbridge)/bin/microbridged"
brew services start DevVig/microbridge/microbridge
for _ in {1..10}; do
for _ in {1..30}; do
[[ -f "$APP/.microbridge-brew" ]] && break
sleep 1
done
test -f "$APP/.microbridge-brew"
test "$(defaults read "$APP/Contents/Info" CFBundleShortVersionString)" = "$VERSION"
brew services list | grep -E '^microbridge[[:space:]]+(started|scheduled)'
open "$APP"
test "$(/usr/libexec/PlistBuddy -c 'Print:CFBundleShortVersionString' "$APP/Contents/Info.plist")" = "$VERSION"
SERVICE_STATE=""
for _ in {1..30}; do
SERVICE_STATE="$(brew services list | awk '$1 == "microbridge" { print $2; exit }')"
[[ "$SERVICE_STATE" == "started" || "$SERVICE_STATE" == "scheduled" ]] && break
sleep 1
done
if [[ "$SERVICE_STATE" != "started" && "$SERVICE_STATE" != "scheduled" ]]; then
brew services list
tail -200 "$(brew --prefix)/var/log/microbridge.log" || true
exit 1
fi
open -n "$APP"
APP_PID=""
for _ in {1..10}; do
for _ in {1..30}; do
APP_PID="$(pgrep -f "$APP/Contents/MacOS/" | head -1 || true)"
[[ -n "$APP_PID" ]] && break
sleep 1
done
test -n "$APP_PID"
kill "$APP_PID"
kill "$APP_PID" || true
brew services stop DevVig/microbridge/microbridge
HOMEBREW_NO_INSTALL_CLEANUP=1 brew uninstall DevVig/microbridge/microbridge
if brew services list | grep -q '^microbridge[[:space:]]'; then
Expand Down
47 changes: 40 additions & 7 deletions scripts/smoke-formula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ VERSION="${2:?usage: $0 path/to/microbridge.rb VERSION ARCH}"
EXPECTED_ARCH="${3:?usage: $0 path/to/microbridge.rb VERSION ARCH}"
TAP="devvig/microbridge-ci"
APP="$HOME/Applications/Microbridge.app"
BREW_LOG="$(brew --prefix)/var/log/microbridge.log"

cleanup() {
brew services stop "$TAP/microbridge" >/dev/null 2>&1 || true
Expand All @@ -18,7 +19,32 @@ cleanup() {
fi
brew untap "$TAP" >/dev/null 2>&1 || true
}
trap cleanup EXIT

diagnostics() {
echo "==> Microbridge formula smoke diagnostics" >&2
brew services list >&2 || true
if [[ -f "$BREW_LOG" ]]; then
echo "==> $BREW_LOG" >&2
tail -200 "$BREW_LOG" >&2 || true
fi
if [[ -d "$APP" ]]; then
echo "==> Installed app bundle" >&2
find "$APP/Contents" -maxdepth 2 -type f -print >&2 || true
/usr/libexec/PlistBuddy -c 'Print:CFBundleShortVersionString' \
"$APP/Contents/Info.plist" >&2 || true
fi
}

on_exit() {
local status=$?
trap - EXIT
if [[ "$status" -ne 0 ]]; then
diagnostics
fi
cleanup
exit "$status"
}
trap on_exit EXIT

test "$(uname -m)" = "$EXPECTED_ARCH"
brew tap-new "$TAP"
Expand All @@ -33,24 +59,31 @@ test -x "$PREFIX/bin/microbridged"
test -x "$PREFIX/bin/microbridgectl"

brew services start "$TAP/microbridge"
for _ in {1..10}; do
for _ in {1..30}; do
[[ -f "$APP/.microbridge-brew" ]] && break
sleep 1
done
test -d "$APP"
test -f "$APP/.microbridge-brew"
test "$(defaults read "$APP/Contents/Info" CFBundleShortVersionString)" = "$VERSION"
brew services list | grep -E '^microbridge[[:space:]]+(started|scheduled)'
test "$(/usr/libexec/PlistBuddy -c 'Print:CFBundleShortVersionString' "$APP/Contents/Info.plist")" = "$VERSION"

SERVICE_STATE=""
for _ in {1..30}; do
SERVICE_STATE="$(brew services list | awk '$1 == "microbridge" { print $2; exit }')"
[[ "$SERVICE_STATE" == "started" || "$SERVICE_STATE" == "scheduled" ]] && break
sleep 1
done
test "$SERVICE_STATE" = "started" || test "$SERVICE_STATE" = "scheduled"

open "$APP"
open -n "$APP"
APP_PID=""
for _ in {1..10}; do
for _ in {1..30}; do
APP_PID="$(pgrep -f "$APP/Contents/MacOS/" | head -1 || true)"
[[ -n "$APP_PID" ]] && break
sleep 1
done
test -n "$APP_PID"
kill "$APP_PID"
kill "$APP_PID" || true

brew services stop "$TAP/microbridge"
HOMEBREW_NO_INSTALL_CLEANUP=1 brew uninstall "$TAP/microbridge"
Expand Down
Loading