This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
name: CLI Rust lint and build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'Cargo/**'
|
||||||
|
- '.gitea/workflows/cli.yml'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- 'Cargo/**'
|
||||||
|
- '.gitea/workflows/cli.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Configure Cargo Cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- name: Rustfmt
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
- name: Check
|
||||||
|
run: cargo check
|
||||||
|
|
||||||
|
- name: Clippy
|
||||||
|
run: cargo clippy -- -D warnings
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: cargo test
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo build
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
name: Server Rust lint and build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'server/src/**'
|
||||||
|
- 'server/Cargo/**'
|
||||||
|
- '.gitea/workflows/server.yml'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'server/src/**'
|
||||||
|
- 'server/Cargo/**'
|
||||||
|
- '.gitea/workflows/server.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: server
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Configure Cargo Cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
target/
|
||||||
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
components: rustfmt, clippy
|
||||||
|
|
||||||
|
- name: Rustfmt
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
- name: Check
|
||||||
|
run: cargo check
|
||||||
|
|
||||||
|
- name: Clippy
|
||||||
|
run: cargo clippy -- -D warnings
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: cargo test
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo build
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
/result
|
/result
|
||||||
|
*.swp
|
||||||
|
|||||||
+1
-2
@@ -183,9 +183,8 @@ fn sign_upload() -> String {
|
|||||||
io::stdin()
|
io::stdin()
|
||||||
.read_line(&mut input)
|
.read_line(&mut input)
|
||||||
.expect("Failed to read line");
|
.expect("Failed to read line");
|
||||||
let input = input.trim().to_string();
|
|
||||||
|
|
||||||
input
|
input.trim().to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn confirm_upload() -> bool {
|
fn confirm_upload() -> bool {
|
||||||
|
|||||||
+6
-8
@@ -25,7 +25,7 @@ pub trait Slime {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_from_values(&self, values: &Vec<String>) {
|
fn print_from_values(&self, values: &[String]) {
|
||||||
for (i, val) in values.iter().enumerate() {
|
for (i, val) in values.iter().enumerate() {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
print!(
|
print!(
|
||||||
@@ -42,7 +42,7 @@ pub trait Slime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_all_slimes() -> Vec<Box<dyn Slime>> {
|
pub fn get_all_slimes() -> Vec<Box<dyn Slime>> {
|
||||||
let mut slimes: Vec<Box<dyn Slime>> = vec![
|
let slimes: Vec<Box<dyn Slime>> = vec![
|
||||||
Box::new(OsSlime),
|
Box::new(OsSlime),
|
||||||
Box::new(KernelSlime),
|
Box::new(KernelSlime),
|
||||||
Box::new(HostnameSlime),
|
Box::new(HostnameSlime),
|
||||||
@@ -51,14 +51,12 @@ pub fn get_all_slimes() -> Vec<Box<dyn Slime>> {
|
|||||||
Box::new(GpuSlime),
|
Box::new(GpuSlime),
|
||||||
Box::new(RamSlime),
|
Box::new(RamSlime),
|
||||||
Box::new(NetworkSlime),
|
Box::new(NetworkSlime),
|
||||||
|
#[cfg(feature = "monitors")]
|
||||||
|
Box::new(MonitorSlime),
|
||||||
|
#[cfg(feature = "audio")]
|
||||||
|
Box::new(AudioSlime),
|
||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(feature = "monitors")]
|
|
||||||
slimes.push(Box::new(MonitorSlime));
|
|
||||||
|
|
||||||
#[cfg(feature = "audio")]
|
|
||||||
slimes.push(Box::new(AudioSlime));
|
|
||||||
|
|
||||||
slimes
|
slimes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user