diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5ff8f53..0819a07 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,10 @@ jobs: build_and_test: name: yup-oauth2 runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + features: ["hyper-rustls", "hyper-tls", "hyper-rustls,hyper-tls", ""] steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -16,18 +20,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: test - - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features - - uses: actions-rs/cargo@v1 - with: - command: test - args: --no-default-features --tests --examples - - uses: actions-rs/cargo@v1 - with: - command: build - args: --examples + args: --no-default-features --features=${{ matrix.features }} doc: name: yup-oauth2 diff --git a/Cargo.toml b/Cargo.toml index 82535c2..4f3c828 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,10 @@ edition = "2018" name = "custom_flow" required-features = ["hyper-rustls"] +[[example]] +name = "custom_storage" +required-features = ["hyper-rustls"] + [[test]] name = "tests" required-features = ["hyper-rustls"] diff --git a/src/authenticator.rs b/src/authenticator.rs index c7cb3a2..d3d72e4 100644 --- a/src/authenticator.rs +++ b/src/authenticator.rs @@ -141,6 +141,7 @@ pub struct AuthenticatorBuilder { /// Create an authenticator that uses the installed flow. /// ``` +/// # #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] /// # async fn foo() { /// # use yup_oauth2::InstalledFlowReturnMethod; /// # let custom_flow_delegate = yup_oauth2::authenticator_delegate::DefaultInstalledFlowDelegate; @@ -181,6 +182,7 @@ impl InstalledFlowAuthenticator { /// Create an authenticator that uses the device flow. /// ``` +/// # #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] /// # async fn foo() { /// # let app_secret = yup_oauth2::read_application_secret("/tmp/foo").await.unwrap(); /// let authenticator = yup_oauth2::DeviceFlowAuthenticator::builder(app_secret) @@ -214,6 +216,7 @@ impl DeviceFlowAuthenticator { /// Create an authenticator that uses a service account. /// ``` +/// # #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] /// # async fn foo() { /// # let service_account_key = yup_oauth2::read_service_account_key("/tmp/foo").await.unwrap(); /// let authenticator = yup_oauth2::ServiceAccountAuthenticator::builder(service_account_key) @@ -253,6 +256,7 @@ impl ServiceAccountAuthenticator { /// ## Methods available when building any Authenticator. /// ``` +/// # #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] /// # async fn foo() { /// # let custom_hyper_client = hyper::Client::new(); /// # let app_secret = yup_oauth2::read_application_secret("/tmp/foo").await.unwrap(); @@ -330,6 +334,7 @@ impl AuthenticatorBuilder { /// ## Methods available when building a device flow Authenticator. /// ``` +/// # #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] /// # async fn foo() { /// # let custom_flow_delegate = yup_oauth2::authenticator_delegate::DefaultDeviceFlowDelegate; /// # let app_secret = yup_oauth2::read_application_secret("/tmp/foo").await.unwrap(); @@ -392,6 +397,7 @@ impl AuthenticatorBuilder { /// ## Methods available when building an installed flow Authenticator. /// ``` +/// # #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] /// # async fn foo() { /// # use yup_oauth2::InstalledFlowReturnMethod; /// # let custom_flow_delegate = yup_oauth2::authenticator_delegate::DefaultInstalledFlowDelegate; @@ -434,6 +440,7 @@ impl AuthenticatorBuilder { /// ## Methods available when building a service account authenticator. /// ``` +/// # #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] /// # async fn foo() { /// # let service_account_key = yup_oauth2::read_service_account_key("/tmp/foo").await.unwrap(); /// let authenticator = yup_oauth2::ServiceAccountAuthenticator::builder( @@ -597,10 +604,10 @@ enum StorageType { #[cfg(test)] mod tests { - use super::*; #[test] #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] fn ensure_send_sync() { + use super::*; fn is_send_sync() {} is_send_sync::::Connector>>() } diff --git a/src/lib.rs b/src/lib.rs index cf9a7ee..78d7491 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,6 +39,7 @@ //! ```test_harness,no_run //! use yup_oauth2::{InstalledFlowAuthenticator, InstalledFlowReturnMethod}; //! +//! # #[cfg(any(feature = "hyper-rustls", feature = "hyper-tls"))] //! #[tokio::main] //! async fn main() { //! // Read application secret from a file. Sometimes it's easier to compile it directly into