Add lints, new website publish (#428)

* Add lints and new website

* Fix droplet CI

* Fix droplet ci again

* Fix clippy lints
This commit is contained in:
DecDuck
2026-06-21 11:16:39 +10:00
committed by GitHub
parent 796abf478f
commit 2e86422004
13 changed files with 110 additions and 430 deletions
-53
View File
@@ -1,53 +0,0 @@
name: Rust CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
env:
CARGO_TERM_COLOR: always
jobs:
ci:
name: Build, Test, Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 3 # fix for when this gets triggered by tag
fetch-tags: true
ref: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install libarchive
run: |
sudo apt-get install libarchive-dev -y
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy (lint)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-features --all --verbose
-2
View File
@@ -1,7 +1,5 @@
#![deny(clippy::all)]
#![feature(impl_trait_in_bindings)]
#![feature(nonpoison_mutex)]
#![feature(sync_nonpoison)]
pub mod file_utils;
pub mod manifest;
pub mod ssl;
+1 -1
View File
@@ -1,6 +1,6 @@
use std::{env, path::PathBuf};
use droplet_rs::manifest::{ManifestWriterFactory, generate_manifest_rusty};
use droplet_rs::manifest::{generate_manifest_rusty, ManifestWriterFactory};
use tokio::runtime::Handle;
struct SinkFactory {}
+2 -3
View File
@@ -2,6 +2,7 @@ use std::{collections::HashMap, ops::Not, path::Path};
use anyhow::anyhow;
use async_trait::async_trait;
pub use droplet_types::{ChunkData, FileEntry, Manifest};
use futures::StreamExt;
use hex::ToHex as _;
use humansize::{format_size, BINARY};
@@ -9,8 +10,6 @@ use sha2::{Digest as _, Sha256};
use tokio::io::AsyncWriteExt;
use tokio::io::{AsyncReadExt as _, AsyncWrite};
use tokio::sync::Semaphore;
pub use droplet_types::{ChunkData, FileEntry, Manifest};
pub const CHUNK_SIZE: u64 = 1024 * 1024 * 64;
pub const MAX_FILE_COUNT: usize = 512;
@@ -44,7 +43,7 @@ where
"Could not create backend for path. Is this structure supported?"
))?()?;
let mut files = backend.list_files().await?;
files.sort_by(|a, b| b.size.cmp(&a.size));
files.sort_by_key(|b| std::cmp::Reverse(b.size));
log_sfn("organising files into chunks...".to_string());
+6 -4
View File
@@ -34,9 +34,11 @@ const SUPPORTED_FILE_EXTENSIONS: [&str; 11] = [
];
pub mod types;
pub fn create_backend_constructor<'a, P>(
path: P,
) -> Option<Box<dyn FnOnce() -> Result<Box<dyn VersionBackend + Send + Sync + 'a>>>>
type BackendConstructor<'a> =
Box<dyn FnOnce() -> Result<Box<dyn VersionBackend + Send + Sync + 'a>>>;
pub fn create_backend_constructor<'a, P>(path: P) -> Option<BackendConstructor<'a>>
where
P: AsRef<Path>,
{
@@ -53,7 +55,7 @@ where
}));
};
let file_extension = path.extension().map(|v| v.to_str()).flatten()?;
let file_extension = path.extension().and_then(|v| v.to_str())?;
if SUPPORTED_FILE_EXTENSIONS.contains(&file_extension) {
let buf = path.to_path_buf();
return Some(Box::new(move || Ok(Box::new(ZipVersionBackend::new(buf)?))));
-1
View File
@@ -24,4 +24,3 @@ pub struct Manifest {
pub size: u64,
pub key: [u8; 16],
}