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
16 changes: 14 additions & 2 deletions installer/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,15 +846,27 @@ def halloy_test_members(names, kind):
return (next((n for n, b in low.items() if b == prog), None), next((n for n, b in low.items() if b == icon), None))


def halloy_test_latest_tag():
"""Newest published release, pre-releases included (drafts are skipped)."""
r = halloy_test_run(["gh", "release", "list", "--repo", HAL_TEST_REPO, "--exclude-drafts", "--limit", "1",
"--json", "tagName", "--jq", ".[0].tagName // empty"], 60)
return r.stdout.strip() if r.returncode == 0 else ""


def halloy_test_from_release(log):
import platform
import tempfile
import tarfile
if platform.machine().lower() not in ("x86_64", "amd64"):
return None
log("gh release download")
# NO: Testversjonene er forhåndsutgivelser, og de telles aldri som "latest", så taggen må hentes først.
# EN: Test builds are pre-releases, which never count as "latest", so look up the tag first.
tag = halloy_test_latest_tag()
if not tag:
return None
log("gh release download " + tag)
folder = Path(tempfile.mkdtemp(prefix="halloy-scoutlink-"))
r = halloy_test_run(["gh", "release", "download", "--repo", HAL_TEST_REPO, "--pattern", halloy_test_asset(),
r = halloy_test_run(["gh", "release", "download", tag, "--repo", HAL_TEST_REPO, "--pattern", halloy_test_asset(),
"--dir", str(folder)], 600)
files = [f for f in folder.iterdir() if f.is_file()] if r.returncode == 0 else []
if not files:
Expand Down
13 changes: 13 additions & 0 deletions tools/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re
import sys
import tempfile
import subprocess
import tomllib
import types

Expand Down Expand Up @@ -285,6 +286,18 @@ def test_installer():
("halloy-scoutlink.exe", "halloy-scoutlink.ico"))
check("halloy test desktop icon", "Icon=halloy-scoutlink\n" in setup.HAL_TEST_DESKTOP, True)
check("halloy test linux asset", setup.HAL_TEST_ASSET_LINUX, "halloy-scoutlink-linux-x86_64*")
# Test builds are prereleases: the download must name the tag, plain "latest" never finds them.
calls = []
real_run = setup.halloy_test_run
setup.halloy_test_run = lambda cmd, timeout=None, **kw: (
calls.append(cmd), subprocess.CompletedProcess(cmd, 0, "v9.9.9\n" if cmd[1:3] == ["release", "list"] else "", ""))[1]
try:
check("halloy test latest tag", setup.halloy_test_latest_tag(), "v9.9.9")
setup.halloy_test_from_release(lambda m: None)
dl = next((c for c in calls if c[1:3] == ["release", "download"]), [])
check("halloy test download names tag", dl[3:4], ["v9.9.9"])
finally:
setup.halloy_test_run = real_run
renick = setup.halloy_server_spec({"lang": "no"}, withsrv)
check("halloy update keeps chosen nick", renick["nickname"], "OlaNordmann")
mine = old + '\n[servers.sl]\nnickname = "me"\nserver = "CHAT.scoutlink.net"\n'
Expand Down