From 800fe7b612f4b0200b885a7a770dd141aa8a58d7 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Tue, 30 Jun 2026 04:26:37 +0200 Subject: [PATCH] added ci --- .github/workflows/ci.yml | 39 ++++++++++++++++++++++ crates/proton-drive-rs/src/client.rs | 2 ++ crates/proton-drive-rs/src/photos.rs | 1 + crates/proton-drive-rs/tests/common/mod.rs | 14 ++++---- 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..18fbbee --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build_and_test: + name: Build & Test + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + + - name: Format Check + run: cargo fmt --all -- --check + + - name: Clippy Lints + run: cargo clippy --all-targets --all-features -- -D warnings + + - name: Build (Debug) + run: cargo build --all-targets + + - name: Run Offline Tests + run: cargo test --all-targets diff --git a/crates/proton-drive-rs/src/client.rs b/crates/proton-drive-rs/src/client.rs index 0369e25..411f8ed 100644 --- a/crates/proton-drive-rs/src/client.rs +++ b/crates/proton-drive-rs/src/client.rs @@ -971,6 +971,7 @@ impl ProtonDriveClient { /// /// `reader` is a blocking [`Read`]; reads happen between block uploads, so a /// slow reader stalls the upload but never buffers more than one block. + #[allow(clippy::too_many_arguments)] pub async fn upload_file_from( &self, parent_uid: &NodeUid, @@ -1048,6 +1049,7 @@ impl ProtonDriveClient { /// photos share's membership address), and the seal adds a `Photo` attribute /// block. Errors when the account has no photos volume. Live validation /// pending. + #[allow(clippy::too_many_arguments)] pub(crate) async fn upload_photo_from( &self, name: &str, diff --git a/crates/proton-drive-rs/src/photos.rs b/crates/proton-drive-rs/src/photos.rs index 4a87c07..8908770 100644 --- a/crates/proton-drive-rs/src/photos.rs +++ b/crates/proton-drive-rs/src/photos.rs @@ -157,6 +157,7 @@ impl ProtonPhotosClient { /// `reader` / `intended_size` / `thumbnails` / `aead` semantics; the seal /// additionally records the photo metadata (capture time, content hash, /// tags). + #[allow(clippy::too_many_arguments)] pub async fn upload_photo_from( &self, name: &str, diff --git a/crates/proton-drive-rs/tests/common/mod.rs b/crates/proton-drive-rs/tests/common/mod.rs index 16f37e4..c27850d 100644 --- a/crates/proton-drive-rs/tests/common/mod.rs +++ b/crates/proton-drive-rs/tests/common/mod.rs @@ -219,8 +219,9 @@ fn read_dotenv() -> Result<(String, String), Box> { /// `PROTON_TOTP_SECRET=` line in `.env`. fn read_totp_secret() -> Option { if let Ok(s) = std::env::var("PROTON_TOTP_SECRET") { - if !s.trim().is_empty() { - return Some(s.trim().to_owned()); + let trimmed = s.trim(); + if !trimmed.is_empty() { + return Some(trimmed.to_owned()); } } let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../../.env"); @@ -231,10 +232,11 @@ fn read_totp_secret() -> Option { continue; } if let Some((k, v)) = line.split_once('=') { - if k.trim() == "PROTON_TOTP_SECRET" { - let v = v.trim(); - if !v.is_empty() { - return Some(v.to_owned()); + let key = k.trim(); + if key == "PROTON_TOTP_SECRET" { + let val = v.trim(); + if !val.is_empty() { + return Some(val.to_owned()); } } }