Skip to content

Commit

Permalink
Add Clippy and rustfmt CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbornholt committed Sep 3, 2022
1 parent 7947b12 commit dde62b3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
37 changes: 34 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: Rust Unit Tests
name: Rust Tests

on:
push:
pull_request:
branches: [ "main" ]

env:
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
S3_BUCKET_NAME: s3-file-connector-github-test-bucket
S3_BUCKET_TEST_PREFIX: github-actions-tmp/run-${{ github.run_id }}/attempt-${{ github.run_attempt }}

jobs:
test:
name: Tests
runs-on: ubuntu-22.04

permissions:
Expand All @@ -36,7 +39,35 @@ jobs:
submodules: true
- name: Install fuse
run: sudo apt-get install fuse libfuse2 libfuse-dev
- name: Build
run: cargo build --examples
- name: Check all targets
run: cargo check --all-targets
- name: Run tests
run: cargo test

rustfmt:
name: rustfmt
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install rustfmt
run: rustup component add rustfmt
- name: Check s3-client
run: cargo fmt --manifest-path s3-client/Cargo.toml -- --check
- name: Check s3-file-connector
run: cargo fmt --manifest-path s3-file-connector/Cargo.toml -- --check

clippy:
name: Clippy
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
- name: Install fuse
run: sudo apt-get install fuse libfuse2 libfuse-dev
- name: Run Clippy
run: cargo clippy -p s3-client -p aws-s3-fuse --no-deps --all-targets -- -D clippy::all
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_width = 120
1 change: 1 addition & 0 deletions s3-client/src/s3_client/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ impl GetObjectRequest {

/// Struct used as the `user_data` pointer for GetObject requests to the CRT
struct GetObjectRequestUserData {
#[allow(clippy::type_complexity)]
callback: Box<dyn FnMut(u64, &[u8]) + Send>,
finish_channel: Sender<Result<(), String>>,
}
Expand Down
1 change: 0 additions & 1 deletion s3-client/src/s3_client/list_objects_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,5 @@ extern "C" fn on_list_finished_callback(
.unwrap()
.send(Err(format!("aws_s3_paginator_continue error: {}", result)))
.unwrap();
return;
}
}

0 comments on commit dde62b3

Please sign in to comment.