other: Add RISC-V to unofficially supported targets (#565)

Adds CI actions and documentation for RISC-V.
This commit is contained in:
Clement Tsang 2021-07-31 16:24:16 -04:00 committed by GitHub
parent d1e672f263
commit cb680dd12e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 106 additions and 54 deletions

View File

@ -10,21 +10,20 @@ on:
workflow_dispatch: workflow_dispatch:
pull_request: pull_request:
paths-ignore: paths-ignore:
- 'README.md' - "README.md"
- 'docs/**' - "docs/**"
- '.github/ISSUE_TEMPLATE/**' - ".github/ISSUE_TEMPLATE/**"
push: push:
branches: branches:
- master - master
paths-ignore: paths-ignore:
- 'README.md' - "README.md"
- 'docs/**' - "docs/**"
- '.github/ISSUE_TEMPLATE/**' - ".github/ISSUE_TEMPLATE/**"
- 'CHANGELOG.md' - "CHANGELOG.md"
- 'CONTRIBUTING.md' - "CONTRIBUTING.md"
jobs: jobs:
# Check rustfmt
rustfmt: rustfmt:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
@ -44,10 +43,9 @@ jobs:
components: rustfmt components: rustfmt
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
- run: cargo fmt --all -- --check - run: cargo fmt --all -- --check
# Check clippy. Note that this doesn't check ARM.
clippy: clippy:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
@ -69,8 +67,6 @@ jobs:
- uses: Swatinem/rust-cache@v1 - 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 - run: cargo clippy --all-targets --workspace -- -D warnings
# Compile/check/test. # Compile/check/test.
@ -174,6 +170,14 @@ jobs:
rust: stable, rust: stable,
} }
# Risc-V 64gc
- {
os: "ubuntu-latest",
target: "riscv64gc-unknown-linux-gnu",
cross: true,
rust: stable,
}
# macOS ARM # macOS ARM
- { - {
os: "macOS-latest", os: "macOS-latest",
@ -194,6 +198,8 @@ jobs:
target: ${{ matrix.triple.target }} target: ${{ matrix.triple.target }}
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.triple.target }}
- name: Check - name: Check
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1

View File

@ -75,6 +75,7 @@ jobs:
target: "x86_64-unknown-linux-gnu", target: "x86_64-unknown-linux-gnu",
cross: false, cross: false,
artifact: true, artifact: true,
strip: true,
} }
- { - {
os: "ubuntu-18.04", os: "ubuntu-18.04",
@ -82,31 +83,46 @@ jobs:
cross: false, cross: false,
container: quay.io/pypa/manylinux2014_x86_64, container: quay.io/pypa/manylinux2014_x86_64,
suffix: "2-17", suffix: "2-17",
strip: true,
} }
- { - {
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "i686-unknown-linux-gnu", target: "i686-unknown-linux-gnu",
cross: true, cross: true,
strip: true,
} }
- { - {
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "x86_64-unknown-linux-musl", target: "x86_64-unknown-linux-musl",
cross: false, cross: false,
artifact: true artifact: true,
strip: true,
} }
- { - {
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "i686-unknown-linux-musl", target: "i686-unknown-linux-musl",
cross: true, 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", os: "windows-2019",
target: "x86_64-pc-windows-msvc", target: "x86_64-pc-windows-msvc",
cross: false, cross: false,
artifact: true, 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", os: "windows-2019",
target: "x86_64-pc-windows-gnu", target: "x86_64-pc-windows-gnu",
@ -118,7 +134,7 @@ jobs:
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "aarch64-unknown-linux-gnu", target: "aarch64-unknown-linux-gnu",
cross: true, cross: true,
artifact: true artifact: true,
} }
# armv7 # armv7
@ -126,7 +142,7 @@ jobs:
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "armv7-unknown-linux-gnueabihf", target: "armv7-unknown-linux-gnueabihf",
cross: true, cross: true,
artifact: true artifact: true,
} }
# PowerPC 64 LE # PowerPC 64 LE
@ -136,6 +152,13 @@ jobs:
cross: true, cross: true,
} }
# Risc-V 64gc
- {
os: "ubuntu-18.04",
target: "riscv64gc-unknown-linux-gnu",
cross: true,
}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -188,6 +211,8 @@ jobs:
target: ${{ matrix.triple.target }} target: ${{ matrix.triple.target }}
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.triple.target }}
- name: Build - name: Build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
@ -202,7 +227,7 @@ jobs:
cp -r ./target/${{ matrix.triple.target }}/release/build/bottom-*/out completion cp -r ./target/${{ matrix.triple.target }}/release/build/bottom-*/out completion
- name: Strip release binary (macOS or Linux x86-64/i686) - 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: | run: |
strip target/${{ matrix.triple.target }}/release/btm strip target/${{ matrix.triple.target }}/release/btm

View File

@ -84,6 +84,7 @@ jobs:
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "x86_64-unknown-linux-gnu", target: "x86_64-unknown-linux-gnu",
cross: false, cross: false,
strip: true,
} }
- { - {
os: "ubuntu-18.04", os: "ubuntu-18.04",
@ -91,23 +92,32 @@ jobs:
cross: false, cross: false,
container: quay.io/pypa/manylinux2014_x86_64, container: quay.io/pypa/manylinux2014_x86_64,
suffix: "2-17", suffix: "2-17",
strip: true,
} }
- { - {
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "i686-unknown-linux-gnu", target: "i686-unknown-linux-gnu",
cross: true, cross: true,
strip: true,
} }
- { - {
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "x86_64-unknown-linux-musl", target: "x86_64-unknown-linux-musl",
cross: false, cross: false,
strip: true,
} }
- { - {
os: "ubuntu-18.04", os: "ubuntu-18.04",
target: "i686-unknown-linux-musl", target: "i686-unknown-linux-musl",
cross: true, 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", os: "windows-2019",
target: "x86_64-pc-windows-msvc", target: "x86_64-pc-windows-msvc",
@ -141,6 +151,13 @@ jobs:
cross: true, cross: true,
} }
# Risc-V 64gc
- {
os: "ubuntu-18.04",
target: "riscv64gc-unknown-linux-gnu",
cross: true,
}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -188,6 +205,8 @@ jobs:
target: ${{ matrix.triple.target }} target: ${{ matrix.triple.target }}
- uses: Swatinem/rust-cache@v1 - uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.triple.target }}
- name: Build - name: Build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
@ -202,7 +221,7 @@ jobs:
cp -r ./target/${{ matrix.triple.target }}/release/build/bottom-*/out completion cp -r ./target/${{ matrix.triple.target }}/release/build/bottom-*/out completion
- name: Strip release binary (macOS or Linux x86-64/i686) - 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: | run: |
strip target/${{ matrix.triple.target }}/release/btm strip target/${{ matrix.triple.target }}/release/btm

View File

@ -29,13 +29,15 @@ bottom from the repo/source, then please try that as well.
## Unofficial support ## Unofficial support
Systems and architectures that aren't officially supported may still work, but there are no guarantees on how much will work. Furthermore, 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.
while it will depend on the problem at the end of the day, _issues on unsupported platforms are likely to go unfixed_. 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), - Linux on ARMv7 and ARMv6 (tested to compile in [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. - 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 ### Known problems

View File

@ -534,7 +534,7 @@ impl App {
*mapping = is_ignoring_case; *mapping = is_ignoring_case;
flags.search_case_enabled_widgets = flags.search_case_enabled_widgets =
Some(WidgetIdEnabled::create_from_hashmap(&map)); Some(WidgetIdEnabled::create_from_hashmap(map));
} else { } else {
// Map doesn't exist yet... initialize ourselves. // Map doesn't exist yet... initialize ourselves.
let mut map = HashMap::default(); let mut map = HashMap::default();
@ -592,7 +592,7 @@ impl App {
*mapping = is_searching_whole_word; *mapping = is_searching_whole_word;
flags.search_whole_word_enabled_widgets = flags.search_whole_word_enabled_widgets =
Some(WidgetIdEnabled::create_from_hashmap(&map)); Some(WidgetIdEnabled::create_from_hashmap(map));
} else { } else {
// Map doesn't exist yet... initialize ourselves. // Map doesn't exist yet... initialize ourselves.
let mut map = HashMap::default(); let mut map = HashMap::default();
@ -650,7 +650,7 @@ impl App {
*mapping = is_searching_whole_word; *mapping = is_searching_whole_word;
flags.search_regex_enabled_widgets = flags.search_regex_enabled_widgets =
Some(WidgetIdEnabled::create_from_hashmap(&map)); Some(WidgetIdEnabled::create_from_hashmap(map));
} else { } else {
// Map doesn't exist yet... initialize ourselves. // Map doesn't exist yet... initialize ourselves.
let mut map = HashMap::default(); let mut map = HashMap::default();
@ -1763,7 +1763,7 @@ impl App {
WidgetDirection::Up => self.current_widget.up_neighbour, WidgetDirection::Up => self.current_widget.up_neighbour,
WidgetDirection::Down => self.current_widget.down_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 { match &new_widget.widget_type {
BottomWidgetType::Temp BottomWidgetType::Temp
| BottomWidgetType::Proc | BottomWidgetType::Proc
@ -2909,7 +2909,7 @@ impl App {
(widget.top_left_corner, widget.bottom_right_corner) (widget.top_left_corner, widget.bottom_right_corner)
{ {
if (x >= tlc_x && y >= tlc_y) && (x < brc_x && y < brc_y) { 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(); self.current_widget = new_widget.clone();
match &self.current_widget.widget_type { match &self.current_widget.widget_type {

View File

@ -238,7 +238,7 @@ impl DataCollector {
if let Some(battery_manager) = &self.battery_manager { if let Some(battery_manager) = &self.battery_manager {
if let Some(battery_list) = &mut self.battery_list { if let Some(battery_list) = &mut self.battery_list {
self.data.list_of_batteries = self.data.list_of_batteries =
Some(batteries::refresh_batteries(&battery_manager, battery_list)); Some(batteries::refresh_batteries(battery_manager, battery_list));
} }
} }

View File

@ -102,7 +102,7 @@ pub async fn get_cpu_data_list(
.enumerate() .enumerate()
.map(|(itx, (current_cpu, (past_cpu_work, past_cpu_total)))| { .map(|(itx, (current_cpu, (past_cpu_work, past_cpu_total)))| {
if let Ok(cpu_time) = current_cpu { 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, present_times,

View File

@ -25,7 +25,7 @@ pub async fn get_network_data(
if filter.is_list_ignored { if filter.is_list_ignored {
let mut ret = true; let mut ret = true;
for r in &filter.list { for r in &filter.list {
if r.is_match(&io.interface()) { if r.is_match(io.interface()) {
ret = false; ret = false;
break; break;
} }

View File

@ -22,7 +22,7 @@ pub async fn get_network_data(
let to_keep = if let Some(filter) = filter { let to_keep = if let Some(filter) = filter {
let mut ret = filter.is_list_ignored; let mut ret = filter.is_list_ignored;
for r in &filter.list { for r in &filter.list {
if r.is_match(&name) { if r.is_match(name) {
ret = !filter.is_list_ignored; ret = !filter.is_list_ignored;
break; break;
} }

View File

@ -137,7 +137,7 @@ fn read_proc(
first_part first_part
.rsplit_once('/') .rsplit_once('/')
.map(|(_prefix, suffix)| suffix) .map(|(_prefix, suffix)| suffix)
.unwrap_or(&truncated_name) .unwrap_or(truncated_name)
.to_string() .to_string()
} else { } else {
truncated_name.to_string() truncated_name.to_string()
@ -155,7 +155,7 @@ fn read_proc(
let process_state_char = stat.state; let process_state_char = stat.state;
let process_state = ProcessStatus::from(process_state_char).to_string(); let process_state = ProcessStatus::from(process_state_char).to_string();
let (cpu_usage_percent, new_process_times) = get_linux_cpu_usage( let (cpu_usage_percent, new_process_times) = get_linux_cpu_usage(
&stat, stat,
cpu_usage, cpu_usage,
cpu_fraction, cpu_fraction,
prev_proc.cpu_time, prev_proc.cpu_time,
@ -258,7 +258,7 @@ pub fn get_process_data(
} }
if let Ok((process_harvest, new_process_times)) = read_proc( if let Ok((process_harvest, new_process_times)) = read_proc(
&prev_proc_details, prev_proc_details,
stat, stat,
cpu_usage, cpu_usage,
cpu_fraction, cpu_fraction,

View File

@ -383,7 +383,7 @@ impl ProcColumn {
self.ordered_columns self.ordered_columns
.iter() .iter()
.filter_map(|column_type| { .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 { if col_map.enabled {
Some(1) Some(1)
} else { } else {
@ -429,7 +429,7 @@ impl ProcColumn {
self.ordered_columns self.ordered_columns
.iter() .iter()
.filter_map(|column_type| { .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(); let mut command_str = String::default();
if let Some(command) = mapping.shortcut { if let Some(command) = mapping.shortcut {
command_str = format!("({})", command); command_str = format!("({})", command);

View File

@ -701,7 +701,7 @@ impl Painter {
&mut f, &mut f,
app_state, app_state,
widgets, widgets,
&widget_draw_locs, widget_draw_locs,
); );
}); });
} }

View File

@ -156,7 +156,7 @@ impl MemGraphWidget for Painter {
Marker::Braille Marker::Braille
}) })
.style(self.colours.ram_style) .style(self.colours.ram_style)
.data(&mem_data) .data(mem_data)
.graph_type(tui::widgets::GraphType::Line), .graph_type(tui::widgets::GraphType::Line),
); );
} }
@ -172,7 +172,7 @@ impl MemGraphWidget for Painter {
Marker::Braille Marker::Braille
}) })
.style(self.colours.swap_style) .style(self.colours.swap_style)
.data(&swap_data) .data(swap_data)
.graph_type(tui::widgets::GraphType::Line), .graph_type(tui::widgets::GraphType::Line),
); );
} }

View File

@ -618,7 +618,7 @@ impl NetworkGraphWidget for Painter {
Marker::Braille Marker::Braille
}) })
.style(self.colours.rx_style) .style(self.colours.rx_style)
.data(&network_data_rx) .data(network_data_rx)
.graph_type(tui::widgets::GraphType::Line), .graph_type(tui::widgets::GraphType::Line),
Dataset::default() Dataset::default()
.name(format!("TX: {:7}", app_state.canvas_data.tx_display)) .name(format!("TX: {:7}", app_state.canvas_data.tx_display))
@ -628,7 +628,7 @@ impl NetworkGraphWidget for Painter {
Marker::Braille Marker::Braille
}) })
.style(self.colours.tx_style) .style(self.colours.tx_style)
.data(&network_data_tx) .data(network_data_tx)
.graph_type(tui::widgets::GraphType::Line), .graph_type(tui::widgets::GraphType::Line),
Dataset::default() Dataset::default()
.name(format!( .name(format!(
@ -653,7 +653,7 @@ impl NetworkGraphWidget for Painter {
Marker::Braille Marker::Braille
}) })
.style(self.colours.rx_style) .style(self.colours.rx_style)
.data(&network_data_rx) .data(network_data_rx)
.graph_type(tui::widgets::GraphType::Line), .graph_type(tui::widgets::GraphType::Line),
Dataset::default() Dataset::default()
.name(&app_state.canvas_data.tx_display) .name(&app_state.canvas_data.tx_display)
@ -663,7 +663,7 @@ impl NetworkGraphWidget for Painter {
Marker::Braille Marker::Braille
}) })
.style(self.colours.tx_style) .style(self.colours.tx_style)
.data(&network_data_tx) .data(network_data_tx)
.graph_type(tui::widgets::GraphType::Line), .graph_type(tui::widgets::GraphType::Line),
] ]
}; };

View File

@ -419,7 +419,7 @@ impl ProcessTableWidget for Painter {
proc_widget_state.table_width_state.calculated_column_widths = proc_widget_state.table_width_state.calculated_column_widths =
get_column_widths( get_column_widths(
draw_loc.width, draw_loc.width,
&hard_widths, hard_widths,
&soft_widths_min, &soft_widths_min,
soft_widths_max, soft_widths_max,
&(proc_widget_state &(proc_widget_state
@ -803,7 +803,7 @@ impl ProcessTableWidget for Painter {
proc_widget_state proc_widget_state
.columns .columns
.column_mapping .column_mapping
.get(&column_type) .get(column_type)
.unwrap() .unwrap()
.enabled .enabled
}) })

View File

@ -409,7 +409,7 @@ fn update_final_process_list(app: &mut App, widget_id: u64) {
.filter_map(|(_pid, process)| { .filter_map(|(_pid, process)| {
if !is_invalid_or_blank { if !is_invalid_or_blank {
if let Some(process_filter) = process_filter { 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) Some(process)
} else { } else {
None None
@ -455,7 +455,7 @@ fn update_final_process_list(app: &mut App, widget_id: u64) {
app.canvas_data.stringified_process_data_map.insert( app.canvas_data.stringified_process_data_map.insert(
widget_id, widget_id,
stringify_process_data(&proc_widget_state, &finalized_process_data), stringify_process_data(proc_widget_state, &finalized_process_data),
); );
app.canvas_data app.canvas_data
.finalized_process_data_map .finalized_process_data_map

View File

@ -249,10 +249,10 @@ pub fn build_app(
config_path: Option<PathBuf>, config_path: Option<PathBuf>,
) -> Result<App> { ) -> Result<App> {
use BottomWidgetType::*; use BottomWidgetType::*;
let autohide_time = get_autohide_time(&matches, &config); let autohide_time = get_autohide_time(matches, config);
let default_time_value = get_default_time_value(&matches, &config) let default_time_value = get_default_time_value(matches, config)
.context("Update 'default_time_value' in your config file.")?; .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 // For processes
let is_grouped = get_app_grouping(matches, config); let is_grouped = get_app_grouping(matches, config);