added CI and fixed clippy errors
CLI Rust lint and build / ci (push) Failing after 45s

This commit is contained in:
2026-06-03 10:28:26 +02:00
parent f9e6f5fca3
commit ff34bbaefb
5 changed files with 122 additions and 10 deletions
+55
View File
@@ -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
+59
View File
@@ -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
View File
@@ -1,2 +1,3 @@
/target
/result
*.swp
+1 -2
View File
@@ -183,9 +183,8 @@ fn sign_upload() -> String {
io::stdin()
.read_line(&mut input)
.expect("Failed to read line");
let input = input.trim().to_string();
input
input.trim().to_string();
}
fn confirm_upload() -> bool {
+5 -7
View File
@@ -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() {
if i == 0 {
print!(
@@ -42,7 +42,7 @@ pub trait 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(KernelSlime),
Box::new(HostnameSlime),
@@ -51,13 +51,11 @@ pub fn get_all_slimes() -> Vec<Box<dyn Slime>> {
Box::new(GpuSlime),
Box::new(RamSlime),
Box::new(NetworkSlime),
];
#[cfg(feature = "monitors")]
slimes.push(Box::new(MonitorSlime));
Box::new(MonitorSlime),
#[cfg(feature = "audio")]
slimes.push(Box::new(AudioSlime));
Box::new(AudioSlime),
];
slimes
}