Add release check gate
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: build test fmt install package-release package-release-linux package-release-windows publish-release bench-report bench-local bench-local-json bench-docker-ssh bench-docker-mosh fuzz-smoke fuzz-deep soak-local tui-harness
|
.PHONY: build test fmt clippy release-check install package-release package-release-linux package-release-windows publish-release bench-report bench-local bench-local-json bench-docker-ssh bench-docker-mosh fuzz-smoke fuzz-deep soak-local tui-harness
|
||||||
|
|
||||||
build:
|
build:
|
||||||
cargo build --release
|
cargo build --release
|
||||||
@@ -9,6 +9,15 @@ test:
|
|||||||
fmt:
|
fmt:
|
||||||
cargo fmt
|
cargo fmt
|
||||||
|
|
||||||
|
clippy:
|
||||||
|
cargo clippy --all-targets -- -D warnings
|
||||||
|
|
||||||
|
release-check:
|
||||||
|
cargo fmt --check
|
||||||
|
cargo clippy --all-targets -- -D warnings
|
||||||
|
cargo test
|
||||||
|
$(MAKE) tui-harness
|
||||||
|
|
||||||
install:
|
install:
|
||||||
sh install.sh --from-current
|
sh install.sh --from-current
|
||||||
|
|
||||||
|
|||||||
+27
-13
@@ -1575,15 +1575,15 @@ fn latest_release_tag(repo: &str) -> Result<Option<String>> {
|
|||||||
Ok(release_tag_from_effective_url(web, &effective))
|
Ok(release_tag_from_effective_url(web, &effective))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn latest_release_tag_download_url(repo: &str, artifact: &str) -> Result<Option<String>> {
|
fn release_tag_download_url(repo: &str, tag: &str, artifact: &str) -> Option<String> {
|
||||||
let web = repo
|
let web = repo
|
||||||
.strip_suffix(".git")
|
.strip_suffix(".git")
|
||||||
.unwrap_or(repo)
|
.unwrap_or(repo)
|
||||||
.trim_end_matches('/');
|
.trim_end_matches('/');
|
||||||
if !web.starts_with("http://") && !web.starts_with("https://") {
|
if !web.starts_with("http://") && !web.starts_with("https://") {
|
||||||
return Ok(None);
|
return None;
|
||||||
}
|
}
|
||||||
Ok(latest_release_tag(repo)?.map(|tag| format!("{web}/releases/download/{tag}/{artifact}")))
|
Some(format!("{web}/releases/download/{tag}/{artifact}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn url_reachable(url: &str) -> Result<bool> {
|
fn url_reachable(url: &str) -> Result<bool> {
|
||||||
@@ -1608,12 +1608,13 @@ fn run_update(config: &dosh::config::ClientConfig, check_only: bool) -> Result<(
|
|||||||
let artifact = release_artifact_name();
|
let artifact = release_artifact_name();
|
||||||
if check_only {
|
if check_only {
|
||||||
let local_version = env!("CARGO_PKG_VERSION");
|
let local_version = env!("CARGO_PKG_VERSION");
|
||||||
|
let latest_tag = latest_release_tag(&repo)?;
|
||||||
println!("dosh {local_version}");
|
println!("dosh {local_version}");
|
||||||
println!("repo: {repo}");
|
println!("repo: {repo}");
|
||||||
println!("installer: {installer}");
|
println!("installer: {installer}");
|
||||||
match latest_release_tag(&repo)? {
|
match latest_tag.as_deref() {
|
||||||
Some(tag) => {
|
Some(tag) => {
|
||||||
let latest_version = release_version_from_tag(&tag);
|
let latest_version = release_version_from_tag(tag);
|
||||||
println!(
|
println!(
|
||||||
"latest: {latest_version} ({})",
|
"latest: {latest_version} ({})",
|
||||||
update_version_status(local_version, latest_version)
|
update_version_status(local_version, latest_version)
|
||||||
@@ -1624,7 +1625,9 @@ fn run_update(config: &dosh::config::ClientConfig, check_only: bool) -> Result<(
|
|||||||
if let Some(latest_url) = latest_release_download_url(&repo, artifact) {
|
if let Some(latest_url) = latest_release_download_url(&repo, artifact) {
|
||||||
let mut status = "missing";
|
let mut status = "missing";
|
||||||
let mut display_url = latest_url.clone();
|
let mut display_url = latest_url.clone();
|
||||||
if let Some(tag_url) = latest_release_tag_download_url(&repo, artifact)?
|
if let Some(tag_url) = latest_tag
|
||||||
|
.as_deref()
|
||||||
|
.and_then(|tag| release_tag_download_url(&repo, tag, artifact))
|
||||||
&& url_reachable(&tag_url)?
|
&& url_reachable(&tag_url)?
|
||||||
{
|
{
|
||||||
status = "available";
|
status = "available";
|
||||||
@@ -5619,13 +5622,13 @@ mod tests {
|
|||||||
load_first_native_identity_with_prompt, parse_dynamic_forward, parse_escape_key,
|
load_first_native_identity_with_prompt, parse_dynamic_forward, parse_escape_key,
|
||||||
parse_local_forward, parse_remote_forward, parse_ssh_config, post_submit_hold_duration,
|
parse_local_forward, parse_remote_forward, parse_ssh_config, post_submit_hold_duration,
|
||||||
queue_pending_user_input, raw_contains_host_table, recv_response_until, refresh_live_addr,
|
queue_pending_user_input, raw_contains_host_table, recv_response_until, refresh_live_addr,
|
||||||
release_tag_from_effective_url, release_version_from_tag, render_status_clear,
|
release_tag_download_url, release_tag_from_effective_url, release_version_from_tag,
|
||||||
render_status_overlay, requested_env, resolved_startup_command, retransmit_stream_opens,
|
render_status_clear, render_status_overlay, requested_env, resolved_startup_command,
|
||||||
rewrite_forward_command, selected_predict_mode, selected_udp_host, server_version_mismatch,
|
retransmit_stream_opens, rewrite_forward_command, selected_predict_mode, selected_udp_host,
|
||||||
should_hold_during_startup_gate, should_hold_post_submit_input, split_after_command_submit,
|
server_version_mismatch, should_hold_during_startup_gate, should_hold_post_submit_input,
|
||||||
ssh_destination_host, ssh_username, ssh_with_user, startup_command, status_ssh_target,
|
split_after_command_submit, ssh_destination_host, ssh_username, ssh_with_user,
|
||||||
strip_stale_mouse_reports, toml_bare_key_or_quoted, update_check_requested,
|
startup_command, status_ssh_target, strip_stale_mouse_reports, toml_bare_key_or_quoted,
|
||||||
update_version_status, valid_forward_host,
|
update_check_requested, update_version_status, valid_forward_host,
|
||||||
};
|
};
|
||||||
use dosh::config::{ClientConfig, CommandExtension, HostConfig};
|
use dosh::config::{ClientConfig, CommandExtension, HostConfig};
|
||||||
use dosh::native::EnvVar;
|
use dosh::native::EnvVar;
|
||||||
@@ -6510,6 +6513,17 @@ mod tests {
|
|||||||
);
|
);
|
||||||
assert_eq!(release_version_from_tag("v1.0.0"), "1.0.0");
|
assert_eq!(release_version_from_tag("v1.0.0"), "1.0.0");
|
||||||
assert_eq!(release_version_from_tag("2026.06.28"), "2026.06.28");
|
assert_eq!(release_version_from_tag("2026.06.28"), "2026.06.28");
|
||||||
|
assert_eq!(
|
||||||
|
release_tag_download_url(
|
||||||
|
"https://example.com/owner/dosh.git",
|
||||||
|
"v1.0.0",
|
||||||
|
"dosh-linux-x86_64.tar.gz"
|
||||||
|
)
|
||||||
|
.as_deref(),
|
||||||
|
Some(
|
||||||
|
"https://example.com/owner/dosh/releases/download/v1.0.0/dosh-linux-x86_64.tar.gz"
|
||||||
|
)
|
||||||
|
);
|
||||||
assert!(release_tag_from_effective_url("https://example.com/owner/dosh", "").is_none());
|
assert!(release_tag_from_effective_url("https://example.com/owner/dosh", "").is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user