Add server install verification steps
This commit is contained in:
@@ -37,6 +37,12 @@ zig build test
|
||||
zig build run -- --help
|
||||
```
|
||||
|
||||
Canonical server install verification for a selected profile:
|
||||
|
||||
```sh
|
||||
zig build verify-install-code --prefix /tmp/mim-install
|
||||
```
|
||||
|
||||
|
||||
## Work tracking
|
||||
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
# Install mim on an SSH server
|
||||
|
||||
`mim` is installed by copying one named local build profile to a server-side `bin/mim` path. There is no package manager integration, runtime config, plugin installer, or hidden bootstrap step.
|
||||
|
||||
From a clean checkout on the target server:
|
||||
|
||||
```sh
|
||||
zig build install-code --prefix "$HOME/.local"
|
||||
"$HOME/.local/bin/mim" --version
|
||||
```
|
||||
|
||||
Choose the smallest profile that matches the server job:
|
||||
|
||||
- `zig build install-min --prefix "$HOME/.local"` installs `mim-min` as `$HOME/.local/bin/mim`.
|
||||
- `zig build install-code --prefix "$HOME/.local"` installs `mim-code` as `$HOME/.local/bin/mim`.
|
||||
- `zig build install-full --prefix "$HOME/.local"` installs `mim-full` as `$HOME/.local/bin/mim`.
|
||||
|
||||
For CI or agent verification without relying on the shell to execute the copied path directly, use the matching verification step:
|
||||
|
||||
```sh
|
||||
zig build verify-install-code --prefix /tmp/mim-install
|
||||
```
|
||||
|
||||
That step installs the selected binary to `/tmp/mim-install/bin/mim` and runs the installed artifact with `--version`.
|
||||
@@ -71,12 +71,8 @@ pub fn build(b: *std.Build) void {
|
||||
.root_module = profileModule(b, target, optimize, profile),
|
||||
});
|
||||
b.installArtifact(profile_exe);
|
||||
const run_profile = b.addRunArtifact(profile_exe);
|
||||
run_profile.step.dependOn(b.getInstallStep());
|
||||
if (b.args) |args| run_profile.addArgs(args);
|
||||
const step_name = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "run-min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "run-code" else "run-full";
|
||||
const run_profile_step = b.step(step_name, "Run profile variant");
|
||||
run_profile_step.dependOn(&run_profile.step);
|
||||
addRunProfileStep(b, profile, profile_exe);
|
||||
addServerInstallSteps(b, profile, profile_exe);
|
||||
}
|
||||
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
@@ -95,6 +91,31 @@ pub fn build(b: *std.Build) void {
|
||||
test_step.dependOn(&test_cmd.step);
|
||||
}
|
||||
|
||||
fn addRunProfileStep(b: *std.Build, profile: Profile, exe: *std.Build.Step.Compile) void {
|
||||
const run_profile = b.addRunArtifact(exe);
|
||||
run_profile.step.dependOn(b.getInstallStep());
|
||||
if (b.args) |args| run_profile.addArgs(args);
|
||||
const step_name = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "run-min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "run-code" else "run-full";
|
||||
const run_profile_step = b.step(step_name, "Run profile variant");
|
||||
run_profile_step.dependOn(&run_profile.step);
|
||||
}
|
||||
|
||||
fn addServerInstallSteps(b: *std.Build, profile: Profile, exe: *std.Build.Step.Compile) void {
|
||||
const suffix = if (std.mem.eql(u8, profile.exe_name, "mim-min")) "min" else if (std.mem.eql(u8, profile.exe_name, "mim-code")) "code" else "full";
|
||||
const install_name = b.fmt("install-{s}", .{suffix});
|
||||
const verify_name = b.fmt("verify-install-{s}", .{suffix});
|
||||
|
||||
const install_file = b.addInstallBinFile(exe.getEmittedBin(), "mim");
|
||||
const install_step = b.step(install_name, "Install selected profile binary as bin/mim");
|
||||
install_step.dependOn(&install_file.step);
|
||||
|
||||
const installed_path = b.getInstallPath(.bin, "mim");
|
||||
const verify_cmd = b.addSystemCommand(&.{ installed_path, "--version" });
|
||||
verify_cmd.step.dependOn(&install_file.step);
|
||||
const verify_step = b.step(verify_name, "Verify installed selected profile binary");
|
||||
verify_step.dependOn(&verify_cmd.step);
|
||||
}
|
||||
|
||||
fn profileModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, profile: Profile) *std.Build.Module {
|
||||
const options = b.addOptions();
|
||||
options.addOption([]const u8, "active_profile", profile.name);
|
||||
|
||||
Reference in New Issue
Block a user