Install Pipelines natively by default on macOS and Linux
Add scripts/setup-native.py and make ./install (and --native) build the server, the CLI and ntfy from source into ~/.local/share/pipelines, detect an existing host OpenCode and Pi instead of installing them, install the packaged authoring skill, migrate an existing Docker database and ntfy auth store, save the host client default and start both services. ./install --docker keeps the previous Docker server + ntfy installation unchanged. ntfy is compiled from its pinned Go module on every host because upstream publishes no macOS server binary (its darwin asset is built with -tags noserver); its cgo SQLite driver is why a C compiler is now required natively. The ntfy credential bootstrap and the client default writer are shared by both installers, installation.Load resolves symlinked prefixes, the Docker migration copies the SQLite write-ahead log so the newest definitions and runs are not lost, and the account subcommands read the generated configuration through NTFY_CONFIG_FILE. Verified on macOS: 115 Python tests, go build/vet/test, and scratch installs that migrate 9 pipelines and 31 runs, build ntfy v2.30.0 and start both services healthy on spare ports before stopping them.
This commit is contained in:
@@ -7,13 +7,19 @@ import manage
|
||||
|
||||
|
||||
class InstallationTests(unittest.TestCase):
|
||||
def test_docker_installer_is_available_through_main_entrypoint(self):
|
||||
def test_native_installer_is_the_default_entrypoint(self):
|
||||
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install"),"--help"],capture_output=True,text=True)
|
||||
self.assertEqual(result.returncode,0)
|
||||
self.assertIn("--prefix",result.stdout)
|
||||
self.assertIn("--ntfy-url",result.stdout)
|
||||
|
||||
def test_docker_installer_is_available_explicitly(self):
|
||||
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install"),"--docker","--help"],capture_output=True,text=True)
|
||||
self.assertEqual(result.returncode,0)
|
||||
self.assertIn("--ntfy-url",result.stdout)
|
||||
self.assertIn("--relogin",result.stdout)
|
||||
|
||||
def test_default_installer_delegates_to_docker_without_terminal(self):
|
||||
def dispatch(self,*args):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root=Path(directory)
|
||||
capture=root/"args"
|
||||
@@ -21,27 +27,21 @@ class InstallationTests(unittest.TestCase):
|
||||
executable.write_text('#!/bin/sh\nprintf "%s\\n" "$@" > "'+str(capture)+'"\n')
|
||||
executable.chmod(0o700)
|
||||
env=dict(os.environ,PATH=str(root)+os.pathsep+os.environ["PATH"])
|
||||
subprocess.run([str(Path(__file__).resolve().parents[1]/"install")],env=env,stdin=subprocess.DEVNULL,check=True)
|
||||
self.assertEqual(capture.read_text().splitlines(),["scripts/setup-docker.py"])
|
||||
subprocess.run([str(Path(__file__).resolve().parents[1]/"install"),*args],env=env,stdin=subprocess.DEVNULL,check=True)
|
||||
return capture.read_text().splitlines()
|
||||
|
||||
def test_default_installer_forwards_docker_options(self):
|
||||
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh"),"--help"],capture_output=True,text=True)
|
||||
self.assertEqual(result.returncode,0)
|
||||
self.assertIn("--ntfy-url",result.stdout)
|
||||
def test_default_installer_delegates_to_native_without_terminal(self):
|
||||
self.assertEqual(self.dispatch(),["scripts/setup-native.py"])
|
||||
|
||||
def test_native_installer_is_rejected_without_running_go(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root=Path(directory)
|
||||
capture=root/"args"
|
||||
executable=root/"go"
|
||||
executable.write_text('#!/bin/sh\nprintf "%s\\n" "$GOBIN" "$@" >> "'+str(capture)+'"\n')
|
||||
executable.chmod(0o700)
|
||||
env=dict(os.environ,PATH=str(root)+os.pathsep+os.environ["PATH"],GOBIN=str(root/"bin"))
|
||||
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install"),"--native"],env=env,capture_output=True,text=True)
|
||||
self.assertEqual(result.returncode,2)
|
||||
self.assertIn("Run ./install",result.stderr)
|
||||
self.assertFalse(capture.exists())
|
||||
self.assertFalse((root/"bin").exists())
|
||||
def test_explicit_modes_dispatch_to_the_right_installer(self):
|
||||
self.assertEqual(self.dispatch("--native"),["scripts/setup-native.py"])
|
||||
self.assertEqual(self.dispatch("native"),["scripts/setup-native.py"])
|
||||
self.assertEqual(self.dispatch("--docker"),["scripts/setup-docker.py"])
|
||||
self.assertEqual(self.dispatch("docker"),["scripts/setup-docker.py"])
|
||||
|
||||
def test_docker_mode_forwards_docker_options(self):
|
||||
self.assertEqual(self.dispatch("--docker","--ntfy-url","http://192.168.1.20:8090"),
|
||||
["scripts/setup-docker.py","--ntfy-url","http://192.168.1.20:8090"])
|
||||
|
||||
def test_standard_installer_rejects_legacy_provisioning_flags(self):
|
||||
result=subprocess.run([str(Path(__file__).resolve().parents[1]/"install.sh"),"--system-command"],capture_output=True,text=True)
|
||||
|
||||
Reference in New Issue
Block a user