diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46f28cda..69041fe6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,21 +10,20 @@ on: workflow_dispatch: pull_request: paths-ignore: - - 'README.md' - - 'docs/**' - - '.github/ISSUE_TEMPLATE/**' + - "README.md" + - "docs/**" + - ".github/ISSUE_TEMPLATE/**" push: branches: - master paths-ignore: - - 'README.md' - - 'docs/**' - - '.github/ISSUE_TEMPLATE/**' - - 'CHANGELOG.md' - - 'CONTRIBUTING.md' + - "README.md" + - "docs/**" + - ".github/ISSUE_TEMPLATE/**" + - "CHANGELOG.md" + - "CONTRIBUTING.md" jobs: - # Check rustfmt rustfmt: runs-on: ${{ matrix.os }} strategy: @@ -44,10 +43,9 @@ jobs: components: rustfmt - uses: Swatinem/rust-cache@v1 - + - run: cargo fmt --all -- --check - # Check clippy. Note that this doesn't check ARM. clippy: runs-on: ${{ matrix.os }} strategy: @@ -69,8 +67,6 @@ jobs: - uses: Swatinem/rust-cache@v1 - # TODO: Can probably put cache here in the future; I'm worried if this will cause issues with clippy though since cargo check breaks it; maybe wait until 1.52, when fix lands. - - run: cargo clippy --all-targets --workspace -- -D warnings # Compile/check/test. @@ -174,6 +170,14 @@ jobs: rust: stable, } + # Risc-V 64gc + - { + os: "ubuntu-latest", + target: "riscv64gc-unknown-linux-gnu", + cross: true, + rust: stable, + } + # macOS ARM - { os: "macOS-latest", @@ -194,6 +198,8 @@ jobs: target: ${{ matrix.triple.target }} - uses: Swatinem/rust-cache@v1 + with: + key: ${{ matrix.triple.target }} - name: Check uses: actions-rs/cargo@v1 diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 189041c8..e29d1a9a 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -75,6 +75,7 @@ jobs: target: "x86_64-unknown-linux-gnu", cross: false, artifact: true, + strip: true, } - { os: "ubuntu-18.04", @@ -82,31 +83,46 @@ jobs: cross: false, container: quay.io/pypa/manylinux2014_x86_64, suffix: "2-17", + strip: true, } - { os: "ubuntu-18.04", target: "i686-unknown-linux-gnu", cross: true, + strip: true, } - { os: "ubuntu-18.04", target: "x86_64-unknown-linux-musl", cross: false, - artifact: true + artifact: true, + strip: true, } - { os: "ubuntu-18.04", target: "i686-unknown-linux-musl", cross: true, + strip: true, + } + - { + os: "macOS-latest", + target: "x86_64-apple-darwin", + cross: false, + artifact: true, + strip: true, } - - { os: "macOS-latest", target: "x86_64-apple-darwin", cross: false, artifact: true } - { os: "windows-2019", target: "x86_64-pc-windows-msvc", cross: false, artifact: true, } - - { os: "windows-2019", target: "i686-pc-windows-msvc", cross: false, artifact: true } + - { + os: "windows-2019", + target: "i686-pc-windows-msvc", + cross: false, + artifact: true, + } - { os: "windows-2019", target: "x86_64-pc-windows-gnu", @@ -118,7 +134,7 @@ jobs: os: "ubuntu-18.04", target: "aarch64-unknown-linux-gnu", cross: true, - artifact: true + artifact: true, } # armv7 @@ -126,7 +142,7 @@ jobs: os: "ubuntu-18.04", target: "armv7-unknown-linux-gnueabihf", cross: true, - artifact: true + artifact: true, } # PowerPC 64 LE @@ -136,6 +152,13 @@ jobs: cross: true, } + # Risc-V 64gc + - { + os: "ubuntu-18.04", + target: "riscv64gc-unknown-linux-gnu", + cross: true, + } + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -188,6 +211,8 @@ jobs: target: ${{ matrix.triple.target }} - uses: Swatinem/rust-cache@v1 + with: + key: ${{ matrix.triple.target }} - name: Build uses: actions-rs/cargo@v1 @@ -202,7 +227,7 @@ jobs: cp -r ./target/${{ matrix.triple.target }}/release/build/bottom-*/out completion - name: Strip release binary (macOS or Linux x86-64/i686) - if: matrix.triple.os != 'windows-2019' && matrix.triple.target != 'aarch64-unknown-linux-gnu' && matrix.triple.target != 'armv7-unknown-linux-gnueabihf' && matrix.triple.target != 'powerpc64le-unknown-linux-gnu' + if: matrix.triple.strip == true run: | strip target/${{ matrix.triple.target }}/release/btm diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4c13af32..817750ad 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -84,6 +84,7 @@ jobs: os: "ubuntu-18.04", target: "x86_64-unknown-linux-gnu", cross: false, + strip: true, } - { os: "ubuntu-18.04", @@ -91,23 +92,32 @@ jobs: cross: false, container: quay.io/pypa/manylinux2014_x86_64, suffix: "2-17", + strip: true, } - { os: "ubuntu-18.04", target: "i686-unknown-linux-gnu", cross: true, + strip: true, } - { os: "ubuntu-18.04", target: "x86_64-unknown-linux-musl", cross: false, + strip: true, } - { os: "ubuntu-18.04", target: "i686-unknown-linux-musl", cross: true, + strip: true, + } + - { + os: "macOS-latest", + target: "x86_64-apple-darwin", + cross: false, + strip: true, } - - { os: "macOS-latest", target: "x86_64-apple-darwin", cross: false } - { os: "windows-2019", target: "x86_64-pc-windows-msvc", @@ -141,6 +151,13 @@ jobs: cross: true, } + # Risc-V 64gc + - { + os: "ubuntu-18.04", + target: "riscv64gc-unknown-linux-gnu", + cross: true, + } + steps: - name: Checkout repository uses: actions/checkout@v2 @@ -188,6 +205,8 @@ jobs: target: ${{ matrix.triple.target }} - uses: Swatinem/rust-cache@v1 + with: + key: ${{ matrix.triple.target }} - name: Build uses: actions-rs/cargo@v1 @@ -202,7 +221,7 @@ jobs: cp -r ./target/${{ matrix.triple.target }}/release/build/bottom-*/out completion - name: Strip release binary (macOS or Linux x86-64/i686) - if: matrix.triple.os != 'windows-2019' && matrix.triple.target != 'aarch64-unknown-linux-gnu' && matrix.triple.target != 'armv7-unknown-linux-gnueabihf' && matrix.triple.target != 'powerpc64le-unknown-linux-gnu' + if: matrix.triple.strip == true run: | strip target/${{ matrix.triple.target }}/release/btm diff --git a/docs/content/support.md b/docs/content/support.md index ad1281aa..41e8e3f1 100644 --- a/docs/content/support.md +++ b/docs/content/support.md @@ -29,13 +29,15 @@ bottom from the repo/source, then please try that as well. ## Unofficial support -Systems and architectures that aren't officially supported may still work, but there are no guarantees on how much will work. Furthermore, -while it will depend on the problem at the end of the day, _issues on unsupported platforms are likely to go unfixed_. +Systems and architectures that aren't officially supported may still work, but there are no guarantees on how much will work. For example, it might only compile, or it might run with bugs/broken features. +Furthermore, while it will depend on the problem at the end of the day, _issues on unsupported platforms are likely to go unfixed_. -!!! note +Unofficially supported platforms known to compile/work: - bottom is tested to build on other ARM and PowerPC architectures through [CI](https://github.com/ClementTsang/bottom/blob/master/.github/workflows/ci.yml), - but since they are not officially tested to work on a sample platform, they are only unofficially supported. +- Linux on ARMv7 and ARMv6 (tested to compile in [CI](https://github.com/ClementTsang/bottom/blob/master/.github/workflows/ci.yml)) +- macOS `AArch64` (tested to compile in [CI](https://github.com/ClementTsang/bottom/blob/master/.github/workflows/ci.yml)) +- Linux on PowerPC 64 LE (tested to compile in [CI](https://github.com/ClementTsang/bottom/blob/master/.github/workflows/ci.yml)) +- Linux on an RISC-V (tested to compile in [CI](https://github.com/ClementTsang/bottom/blob/master/.github/workflows/ci.yml), tested to run on an [Allwinner D1 Nezha](https://github.com/ClementTsang/bottom/issues/564)) ### Known problems diff --git a/src/app.rs b/src/app.rs index 822d4a1d..b6bca61d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -534,7 +534,7 @@ impl App { *mapping = is_ignoring_case; flags.search_case_enabled_widgets = - Some(WidgetIdEnabled::create_from_hashmap(&map)); + Some(WidgetIdEnabled::create_from_hashmap(map)); } else { // Map doesn't exist yet... initialize ourselves. let mut map = HashMap::default(); @@ -592,7 +592,7 @@ impl App { *mapping = is_searching_whole_word; flags.search_whole_word_enabled_widgets = - Some(WidgetIdEnabled::create_from_hashmap(&map)); + Some(WidgetIdEnabled::create_from_hashmap(map)); } else { // Map doesn't exist yet... initialize ourselves. let mut map = HashMap::default(); @@ -650,7 +650,7 @@ impl App { *mapping = is_searching_whole_word; flags.search_regex_enabled_widgets = - Some(WidgetIdEnabled::create_from_hashmap(&map)); + Some(WidgetIdEnabled::create_from_hashmap(map)); } else { // Map doesn't exist yet... initialize ourselves. let mut map = HashMap::default(); @@ -1763,7 +1763,7 @@ impl App { WidgetDirection::Up => self.current_widget.up_neighbour, WidgetDirection::Down => self.current_widget.down_neighbour, }) { - if let Some(new_widget) = self.widget_map.get(&new_widget_id) { + if let Some(new_widget) = self.widget_map.get(new_widget_id) { match &new_widget.widget_type { BottomWidgetType::Temp | BottomWidgetType::Proc @@ -2909,7 +2909,7 @@ impl App { (widget.top_left_corner, widget.bottom_right_corner) { if (x >= tlc_x && y >= tlc_y) && (x < brc_x && y < brc_y) { - if let Some(new_widget) = self.widget_map.get(&new_widget_id) { + if let Some(new_widget) = self.widget_map.get(new_widget_id) { self.current_widget = new_widget.clone(); match &self.current_widget.widget_type { diff --git a/src/app/data_harvester.rs b/src/app/data_harvester.rs index 5d2bebfe..32482537 100644 --- a/src/app/data_harvester.rs +++ b/src/app/data_harvester.rs @@ -238,7 +238,7 @@ impl DataCollector { if let Some(battery_manager) = &self.battery_manager { if let Some(battery_list) = &mut self.battery_list { self.data.list_of_batteries = - Some(batteries::refresh_batteries(&battery_manager, battery_list)); + Some(batteries::refresh_batteries(battery_manager, battery_list)); } } diff --git a/src/app/data_harvester/cpu/heim/mod.rs b/src/app/data_harvester/cpu/heim/mod.rs index 73a97b5b..6941dd0c 100644 --- a/src/app/data_harvester/cpu/heim/mod.rs +++ b/src/app/data_harvester/cpu/heim/mod.rs @@ -102,7 +102,7 @@ pub async fn get_cpu_data_list( .enumerate() .map(|(itx, (current_cpu, (past_cpu_work, past_cpu_total)))| { if let Ok(cpu_time) = current_cpu { - let present_times = convert_cpu_times(&cpu_time); + let present_times = convert_cpu_times(cpu_time); ( present_times, diff --git a/src/app/data_harvester/network/heim.rs b/src/app/data_harvester/network/heim.rs index d18287c8..3c12fd73 100644 --- a/src/app/data_harvester/network/heim.rs +++ b/src/app/data_harvester/network/heim.rs @@ -25,7 +25,7 @@ pub async fn get_network_data( if filter.is_list_ignored { let mut ret = true; for r in &filter.list { - if r.is_match(&io.interface()) { + if r.is_match(io.interface()) { ret = false; break; } diff --git a/src/app/data_harvester/network/sysinfo.rs b/src/app/data_harvester/network/sysinfo.rs index c7a7db00..cb8e260a 100644 --- a/src/app/data_harvester/network/sysinfo.rs +++ b/src/app/data_harvester/network/sysinfo.rs @@ -22,7 +22,7 @@ pub async fn get_network_data( let to_keep = if let Some(filter) = filter { let mut ret = filter.is_list_ignored; for r in &filter.list { - if r.is_match(&name) { + if r.is_match(name) { ret = !filter.is_list_ignored; break; } diff --git a/src/app/data_harvester/processes/linux.rs b/src/app/data_harvester/processes/linux.rs index 79c77190..87297837 100644 --- a/src/app/data_harvester/processes/linux.rs +++ b/src/app/data_harvester/processes/linux.rs @@ -137,7 +137,7 @@ fn read_proc( first_part .rsplit_once('/') .map(|(_prefix, suffix)| suffix) - .unwrap_or(&truncated_name) + .unwrap_or(truncated_name) .to_string() } else { truncated_name.to_string() @@ -155,7 +155,7 @@ fn read_proc( let process_state_char = stat.state; let process_state = ProcessStatus::from(process_state_char).to_string(); let (cpu_usage_percent, new_process_times) = get_linux_cpu_usage( - &stat, + stat, cpu_usage, cpu_fraction, prev_proc.cpu_time, @@ -258,7 +258,7 @@ pub fn get_process_data( } if let Ok((process_harvest, new_process_times)) = read_proc( - &prev_proc_details, + prev_proc_details, stat, cpu_usage, cpu_fraction, diff --git a/src/app/states.rs b/src/app/states.rs index 28d1323b..bf0b87af 100644 --- a/src/app/states.rs +++ b/src/app/states.rs @@ -383,7 +383,7 @@ impl ProcColumn { self.ordered_columns .iter() .filter_map(|column_type| { - if let Some(col_map) = self.column_mapping.get(&column_type) { + if let Some(col_map) = self.column_mapping.get(column_type) { if col_map.enabled { Some(1) } else { @@ -429,7 +429,7 @@ impl ProcColumn { self.ordered_columns .iter() .filter_map(|column_type| { - let mapping = self.column_mapping.get(&column_type).unwrap(); + let mapping = self.column_mapping.get(column_type).unwrap(); let mut command_str = String::default(); if let Some(command) = mapping.shortcut { command_str = format!("({})", command); diff --git a/src/canvas.rs b/src/canvas.rs index 79118e3b..495e5b8f 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -701,7 +701,7 @@ impl Painter { &mut f, app_state, widgets, - &widget_draw_locs, + widget_draw_locs, ); }); } diff --git a/src/canvas/widgets/mem_graph.rs b/src/canvas/widgets/mem_graph.rs index 6b5bc5ab..b60fcdcb 100644 --- a/src/canvas/widgets/mem_graph.rs +++ b/src/canvas/widgets/mem_graph.rs @@ -156,7 +156,7 @@ impl MemGraphWidget for Painter { Marker::Braille }) .style(self.colours.ram_style) - .data(&mem_data) + .data(mem_data) .graph_type(tui::widgets::GraphType::Line), ); } @@ -172,7 +172,7 @@ impl MemGraphWidget for Painter { Marker::Braille }) .style(self.colours.swap_style) - .data(&swap_data) + .data(swap_data) .graph_type(tui::widgets::GraphType::Line), ); } diff --git a/src/canvas/widgets/network_graph.rs b/src/canvas/widgets/network_graph.rs index 74509224..8cdf9449 100644 --- a/src/canvas/widgets/network_graph.rs +++ b/src/canvas/widgets/network_graph.rs @@ -618,7 +618,7 @@ impl NetworkGraphWidget for Painter { Marker::Braille }) .style(self.colours.rx_style) - .data(&network_data_rx) + .data(network_data_rx) .graph_type(tui::widgets::GraphType::Line), Dataset::default() .name(format!("TX: {:7}", app_state.canvas_data.tx_display)) @@ -628,7 +628,7 @@ impl NetworkGraphWidget for Painter { Marker::Braille }) .style(self.colours.tx_style) - .data(&network_data_tx) + .data(network_data_tx) .graph_type(tui::widgets::GraphType::Line), Dataset::default() .name(format!( @@ -653,7 +653,7 @@ impl NetworkGraphWidget for Painter { Marker::Braille }) .style(self.colours.rx_style) - .data(&network_data_rx) + .data(network_data_rx) .graph_type(tui::widgets::GraphType::Line), Dataset::default() .name(&app_state.canvas_data.tx_display) @@ -663,7 +663,7 @@ impl NetworkGraphWidget for Painter { Marker::Braille }) .style(self.colours.tx_style) - .data(&network_data_tx) + .data(network_data_tx) .graph_type(tui::widgets::GraphType::Line), ] }; diff --git a/src/canvas/widgets/process_table.rs b/src/canvas/widgets/process_table.rs index 2abab933..0a87ae3e 100644 --- a/src/canvas/widgets/process_table.rs +++ b/src/canvas/widgets/process_table.rs @@ -419,7 +419,7 @@ impl ProcessTableWidget for Painter { proc_widget_state.table_width_state.calculated_column_widths = get_column_widths( draw_loc.width, - &hard_widths, + hard_widths, &soft_widths_min, soft_widths_max, &(proc_widget_state @@ -803,7 +803,7 @@ impl ProcessTableWidget for Painter { proc_widget_state .columns .column_mapping - .get(&column_type) + .get(column_type) .unwrap() .enabled }) diff --git a/src/lib.rs b/src/lib.rs index 835af242..71f6c078 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -409,7 +409,7 @@ fn update_final_process_list(app: &mut App, widget_id: u64) { .filter_map(|(_pid, process)| { if !is_invalid_or_blank { if let Some(process_filter) = process_filter { - if process_filter.check(&process, is_using_command) { + if process_filter.check(process, is_using_command) { Some(process) } else { None @@ -455,7 +455,7 @@ fn update_final_process_list(app: &mut App, widget_id: u64) { app.canvas_data.stringified_process_data_map.insert( widget_id, - stringify_process_data(&proc_widget_state, &finalized_process_data), + stringify_process_data(proc_widget_state, &finalized_process_data), ); app.canvas_data .finalized_process_data_map diff --git a/src/options.rs b/src/options.rs index facd42fe..483d0631 100644 --- a/src/options.rs +++ b/src/options.rs @@ -249,10 +249,10 @@ pub fn build_app( config_path: Option, ) -> Result { use BottomWidgetType::*; - let autohide_time = get_autohide_time(&matches, &config); - let default_time_value = get_default_time_value(&matches, &config) + let autohide_time = get_autohide_time(matches, config); + let default_time_value = get_default_time_value(matches, config) .context("Update 'default_time_value' in your config file.")?; - let use_basic_mode = get_use_basic_mode(&matches, &config); + let use_basic_mode = get_use_basic_mode(matches, config); // For processes let is_grouped = get_app_grouping(matches, config);