mirror of
https://github.com/narrrl/proton-sdk-rs.git
synced 2026-11-03 16:41:26 +01:00
added ci
This commit is contained in:
1 parent
ec7de59851
commit
800fe7b612
4 files changed
+50
-6
No files matched your search
@@ -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
|
||||
@@ -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<R: Read + Send>(
|
||||
&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<R: Read + Send>(
|
||||
&self,
|
||||
name: &str,
|
||||
|
||||
@@ -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<R: Read + Send>(
|
||||
&self,
|
||||
name: &str,
|
||||
|
||||
@@ -219,8 +219,9 @@ fn read_dotenv() -> Result<(String, String), Box<dyn std::error::Error>> {
|
||||
/// `PROTON_TOTP_SECRET=` line in `.env`.
|
||||
fn read_totp_secret() -> Option<String> {
|
||||
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<String> {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user