-
Notifications
You must be signed in to change notification settings - Fork 1
add experimental self-update functionality #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -21,31 +21,31 @@ jobs: | |||||
| os: ubuntu-latest | ||||||
| target: x86_64-unknown-linux-musl | ||||||
| bin: coman | ||||||
| name: coman-Linux-x86_64-musl.tar.gz | ||||||
| name: coman-x86_64-unknown-linux-musl.tar.gz | ||||||
| cargo_command: cargo | ||||||
| squash: true | ||||||
|
|
||||||
| - os_name: Linux-aarch64 | ||||||
| os: ubuntu-24.04-arm | ||||||
| target: aarch64-unknown-linux-musl | ||||||
| bin: coman | ||||||
| name: coman-Linux-aarch64-musl.tar.gz | ||||||
| name: coman-aarch64-unknown-linux-musl.tar.gz | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming convention for the Linux aarch64 artifact has been updated for consistency.
Suggested change
#ai-review-inline |
||||||
| cargo_command: cargo | ||||||
| squash: true | ||||||
|
|
||||||
| - os_name: Windows-aarch64 | ||||||
| os: windows-latest | ||||||
| target: aarch64-pc-windows-msvc | ||||||
| bin: coman.exe | ||||||
| name: coman-Windows-aarch64.zip | ||||||
| name: coman-aarch64-pc-windows-msvc.zip | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming convention for the Windows aarch64 artifact has been updated for consistency.
Suggested change
#ai-review-inline |
||||||
| cargo_command: cargo | ||||||
| squash: false | ||||||
|
|
||||||
| - os_name: macOS-x86_64 | ||||||
| os: macOS-latest | ||||||
| target: x86_64-apple-darwin | ||||||
| bin: coman | ||||||
| name: coman-Darwin-x86_64.tar.gz | ||||||
| name: coman-x86_64-apple-darwin.tar.gz | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming convention for the macOS x86_64 artifact has been updated for consistency.
Suggested change
#ai-review-inline |
||||||
| cargo_command: cargo | ||||||
| squash: false | ||||||
|
|
||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -93,6 +93,7 @@ tarpc = { version = "0.37.0", features = [ | |||||
| tokio-duplex = "1.0.1" | ||||||
| sysinfo = "0.38.0" | ||||||
| bytesize = "2.3.1" | ||||||
| self_update = { version = "0.42.0", features = ["archive-tar", "archive-zip"] } | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added self_update crate with archive features, ensure these features are necessary for the intended use case.
Suggested change
#ai-review-inline |
||||||
|
|
||||||
| [build-dependencies] | ||||||
| anyhow = "1.0.90" | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,8 @@ pub struct Cli { | |
| pub enum CliCommands { | ||
| #[clap(about = "Show version and config file locations")] | ||
| Version, | ||
| #[clap(about = "Self-update coman. Experimental", hide = true)] | ||
| Update, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Update command is marked as experimental and hidden, which might cause confusion for users expecting it to be available. #ai-review-inline |
||
| #[clap(about = "Subcommands related to CSCS")] | ||
| Cscs { | ||
| #[command(subcommand)] | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ use clap::{CommandFactory, Parser}; | |||||||||||||||||||||||||||
| use clap_complete::CompleteEnv; | ||||||||||||||||||||||||||||
| use color_eyre::Result; | ||||||||||||||||||||||||||||
| use keyring::set_global_service_name; | ||||||||||||||||||||||||||||
| use self_update::cargo_crate_version; | ||||||||||||||||||||||||||||
| use tokio::{runtime::Handle, sync::mpsc}; | ||||||||||||||||||||||||||||
| use tuirealm::{ | ||||||||||||||||||||||||||||
| Application, EventListenerCfg, PollStrategy, Sub, SubClause, SubEventClause, Update, | ||||||||||||||||||||||||||||
|
|
@@ -67,6 +68,12 @@ async fn main() -> Result<()> { | |||||||||||||||||||||||||||
| match args.command { | ||||||||||||||||||||||||||||
| Some(command) => match command { | ||||||||||||||||||||||||||||
| CliCommands::Version => println!("{}", version()), | ||||||||||||||||||||||||||||
| CliCommands::Update => { | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding error handling for the update task instead of using
Suggested change
#ai-review-inline |
||||||||||||||||||||||||||||
| tokio::task::spawn_blocking(move || { | ||||||||||||||||||||||||||||
| update().unwrap(); | ||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||
| .await? | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| CliCommands::Completions { generator } => { | ||||||||||||||||||||||||||||
| let mut cmd = Cli::command(); | ||||||||||||||||||||||||||||
| print_completions(generator, &mut cmd); | ||||||||||||||||||||||||||||
|
|
@@ -372,3 +379,20 @@ fn popup_exclusion_clause() -> SubClause<Id> { | |||||||||||||||||||||||||||
| SubClause::IsMounted(Id::SystemSelectPopup), | ||||||||||||||||||||||||||||
| ]))) | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| fn update() -> Result<()> { | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The update function should handle errors more gracefully instead of panicking with
Suggested change
#ai-review-inline |
||||||||||||||||||||||||||||
| let status = self_update::backends::github::Update::configure() | ||||||||||||||||||||||||||||
| .repo_owner("SwissDataScienceCenter") | ||||||||||||||||||||||||||||
| .repo_name("coman") | ||||||||||||||||||||||||||||
| .bin_name("coman") | ||||||||||||||||||||||||||||
| .show_download_progress(true) | ||||||||||||||||||||||||||||
| .current_version(cargo_crate_version!()) | ||||||||||||||||||||||||||||
| .build()? | ||||||||||||||||||||||||||||
| .update()?; | ||||||||||||||||||||||||||||
| if status.updated() { | ||||||||||||||||||||||||||||
| println!("Successfully updated to version: `{}`", status.version()); | ||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||
| println!("Already up to date at version: `{}`", status.version()); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| Ok(()) | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The naming convention for the Linux x86_64 artifact has been updated for consistency.
#ai-review-inline