diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a443422a..461d05be2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -266,6 +266,39 @@ jobs: - name: Build CRT binding documentation run: cargo doc --no-deps -p mountpoint-s3-crt + doctests: + name: rustdoc tests + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + - name: Set up Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + # setup-rust-toolchain sets "-D warnings" by default, and Rust treats any warning as compile error. + # We need to this currently because `vendor/fuser` contains some warnings and it breaks the build. + rustflags: "" + - name: Install operating system dependencies + uses: ./.github/actions/install-dependencies + with: + fuseVersion: 2 + - name: Cargo cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-${{ runner.arch }}-${{ github.job }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Run doctests for all crates + # Some of the generated bindings seem to be interpretted as rustdoc tests, skip them for now. + run: cargo test --doc -- --skip=generated::aws_hash_table_foreach + deny: name: Licenses runs-on: ubuntu-latest diff --git a/mountpoint-s3-client/src/lib.rs b/mountpoint-s3-client/src/lib.rs index 68df66785..1dd5abfa3 100644 --- a/mountpoint-s3-client/src/lib.rs +++ b/mountpoint-s3-client/src/lib.rs @@ -16,12 +16,13 @@ //! To construct a new S3 client and download an object from a bucket in the `us-east-1` region: //! ```no_run //! # async fn test() { -//! use futures::TryStreamExt; +//! use futures::{TryFutureExt, TryStreamExt}; +//! use mountpoint_s3_client::types::GetObjectParams; //! use mountpoint_s3_client::{S3CrtClient, ObjectClient}; //! //! let client = S3CrtClient::new(Default::default()).expect("client construction failed"); //! -//! let response = client.get_object("my-bucket", "my-key", &GetObjectParams::new().await.expect("get_object failed")); +//! let response = client.get_object("my-bucket", "my-key", &GetObjectParams::new()).await.expect("get_object failed"); //! let body = response.map_ok(|(offset, body)| body.to_vec()).try_concat().await.expect("body streaming failed"); //! # } //! ``` @@ -33,8 +34,7 @@ //! //! let config = S3ClientConfig::new() //! .endpoint_config(EndpointConfig::new("us-west-2")) -//! .auth_config(S3ClientAuthConfig::NoSigning) -//! .user_agent_prefix("my-test-client"); +//! .auth_config(S3ClientAuthConfig::NoSigning); //! let client = S3CrtClient::new(config).expect("client construction failed"); //! ``` //!