ci: stage the Mac launch check on the internal volume
Build / macos (push) Successful in 26s

This commit is contained in:
2026-09-09 23:56:02 +02:00
parent cda28cc6be
commit 4d87288f2f
+48 -42
View File
@@ -10,47 +10,53 @@ import urllib.error
import urllib.request import urllib.request
from pathlib import Path from pathlib import Path
app = Path(sys.argv[1]) / "Contents/MacOS/Meetingnotes" # Launch from the Mac's internal volume; the runner checkout is on removable storage.
with socket.socket() as listener: cache = Path.home() / "Library/Caches/meetingnotes-ci"
listener.bind(("127.0.0.1", 0)) cache.mkdir(parents=True, exist_ok=True)
port = listener.getsockname()[1] with tempfile.TemporaryDirectory(prefix="smoke-", dir=cache) as directory:
with tempfile.TemporaryFile() as log: staged = Path(directory) / "Meetingnotes.app"
process = subprocess.Popen( subprocess.run(["ditto", sys.argv[1], str(staged)], check=True)
[str(app), "-muteDeckAPIEnabled", "YES", "-muteDeckAPIPort", str(port), "-hasCompletedOnboarding", "YES", "-hasAcceptedTerms", "YES", "-SUEnableAutomaticChecks", "NO"], app = staged / "Contents/MacOS/Meetingnotes"
stdout=log, stderr=subprocess.STDOUT, with socket.socket() as listener:
) listener.bind(("127.0.0.1", 0))
try: port = listener.getsockname()[1]
for attempt in range(30): with tempfile.TemporaryFile() as log:
if process.poll() is not None: process = subprocess.Popen(
raise RuntimeError("CI app exited before the API became ready") [str(app), "-muteDeckAPIEnabled", "YES", "-muteDeckAPIPort", str(port), "-hasCompletedOnboarding", "YES", "-hasAcceptedTerms", "YES", "-SUEnableAutomaticChecks", "NO"],
try: stdout=log, stderr=subprocess.STDOUT,
with urllib.request.urlopen(f"http://127.0.0.1:{port}/api/info", timeout=2) as response: )
info = json.load(response)
break
except (urllib.error.URLError, TimeoutError):
time.sleep(1)
else:
raise RuntimeError("CI API did not become ready")
assert info["name"] == "MeetingDebrief", "Unexpected API identity"
try: try:
urllib.request.urlopen(f"http://127.0.0.1:{port}/api/recording/status", timeout=2) for attempt in range(30):
except urllib.error.HTTPError as error: if process.poll() is not None:
assert error.code == 401, f"Unexpected status: {error.code}" raise RuntimeError("CI app exited before the API became ready")
else: try:
raise RuntimeError("Recording status allowed an unauthenticated request") with urllib.request.urlopen(f"http://127.0.0.1:{port}/api/info", timeout=2) as response:
print("Local API readiness and authentication checks passed") info = json.load(response)
except Exception: break
if process.poll() is None: except (urllib.error.URLError, TimeoutError):
sample = subprocess.run(["sample", str(process.pid), "1", "1"], capture_output=True, text=True, timeout=10) time.sleep(1)
print(sample.stdout[:14000], file=sys.stderr) else:
log.seek(0) raise RuntimeError("CI API did not become ready")
print(log.read().decode(errors="replace")[-8000:], file=sys.stderr) assert info["name"] == "MeetingDebrief", "Unexpected API identity"
raise
finally:
if process.poll() is None:
process.terminate()
try: try:
process.wait(timeout=10) urllib.request.urlopen(f"http://127.0.0.1:{port}/api/recording/status", timeout=2)
except subprocess.TimeoutExpired: except urllib.error.HTTPError as error:
process.kill() assert error.code == 401, f"Unexpected status: {error.code}"
process.wait() else:
raise RuntimeError("Recording status allowed an unauthenticated request")
print("Local API readiness and authentication checks passed")
except Exception:
if process.poll() is None:
sample = subprocess.run(["sample", str(process.pid), "1", "1"], capture_output=True, text=True, timeout=10)
print(sample.stdout[:14000], file=sys.stderr)
log.seek(0)
print(log.read().decode(errors="replace")[-8000:], file=sys.stderr)
raise
finally:
if process.poll() is None:
process.terminate()
try:
process.wait(timeout=10)
except subprocess.TimeoutExpired:
process.kill()
process.wait()