diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4ab973ea7..92f145542f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,6 +143,69 @@ jobs: popd &>/dev/null done + # We make sure that Smithy-rs can be compiled on platforms that are not natively supported by GitHub actions. + # We do not run tests on those platforms (yet) because it'd require a more complicated setup involving architecture + # emulation via QEMU, likely to cause a significant degradation on CI completion time. + test-exotic-platform-support: + name: Exotic platform support + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - target: i686-unknown-linux-gnu + non_aws_features: --all-features + aws_excludes: '' + # We only test `native-tls` here because `rustls` depends on `ring` which in turn does not support powerpc + # as a target platform (see https://github.com/briansmith/ring/issues/389) + # We also exclude all first-party crates that have a non-optional dependency on `ring`. + - target: powerpc-unknown-linux-gnu + non_aws_features: --features native-tls + aws_excludes: --exclude aws-inlineable --exclude aws-sigv4 --exclude aws-sig-auth + env: + CROSS_CONFIG: Cross.toml + OPENSSL_LIB_DIR: /usr/lib/i386-linux-gnu + OPENSSL_INCLUDE_DIR: /usr/include/i386-linux-gnu + steps: + - name: Checkout + uses: actions/checkout@v1 + # Pinned to the commit hash of v1.3.0 + - uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641 + with: + sharedKey: ${{ runner.os }}-${{ env.rust_version }}-${{ github.job }}-${{ matrix.target }} + target-dir: ./target + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.rust_version }} + components: ${{ env.rust_toolchain_components }} + profile: minimal + override: true + target: ${{ matrix.target }} + - name: Configure cross + shell: bash + run: | + cat > Cross.toml << EOF + [build] + pre-build = ["dpkg --add-architecture i386", "apt-get update && apt-get install --assume-yes pkg-config:i386 libssl-dev:i386"] + [build.env] + passthrough = [ + "OPENSSL_LIB_DIR", + "OPENSSL_INCLUDE_DIR", + ] + EOF + - name: Build rust-runtime crates + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --target ${{ matrix.target }} --manifest-path "rust-runtime/Cargo.toml" --exclude aws-smithy-http-server-python --workspace ${{ matrix.non_aws_features }} + - name: Build AWS rust-runtime crates + uses: actions-rs/cargo@v1 + with: + use-cross: true + command: build + args: --target ${{ matrix.target }} --manifest-path "aws/rust-runtime/Cargo.toml" ${{ matrix.aws_excludes }} --workspace + # This job is split out from the rest since it is not required to pass for merge check-sdk-examples: name: Check SDK Examples @@ -166,6 +229,7 @@ jobs: - test-codegen - test-sdk - test-rust-windows + - test-exotic-platform-support # Run this job even if its dependency jobs fail if: always() runs-on: ubuntu-latest diff --git a/CODEOWNERS b/CODEOWNERS index 19506644ac..20265881e6 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -7,6 +7,7 @@ /rust-runtime/aws-smithy-http-server/ @awslabs/smithy-rs-server # Shared ownership +/.github/ @awslabs/rust-sdk-owners @awslabs/smithy-rs-server /CHANGELOG.md @awslabs/rust-sdk-owners @awslabs/smithy-rs-server /CHANGELOG.next.toml @awslabs/rust-sdk-owners @awslabs/smithy-rs-server /README.md @awslabs/rust-sdk-owners @awslabs/smithy-rs-server diff --git a/rust-runtime/aws-smithy-client/additional-ci b/rust-runtime/aws-smithy-client/additional-ci index c1fd7ce406..fde542e9fc 100755 --- a/rust-runtime/aws-smithy-client/additional-ci +++ b/rust-runtime/aws-smithy-client/additional-ci @@ -10,3 +10,6 @@ set -e echo "### Checking for duplicate dependency versions in the normal dependency graph with all features enabled" cargo tree -d --edges normal --all-features + +echo "### Testing every combination of features (excluding --all-features)" +cargo hack test --feature-powerset --exclude-all-features diff --git a/rust-runtime/aws-smithy-client/src/builder.rs b/rust-runtime/aws-smithy-client/src/builder.rs index 017ae04e7b..4a1b62fb85 100644 --- a/rust-runtime/aws-smithy-client/src/builder.rs +++ b/rust-runtime/aws-smithy-client/src/builder.rs @@ -135,7 +135,7 @@ impl Builder<(), M, R> { let with_https = |b: Builder<_, M, R>| b.rustls_connector(connector_settings); // If we are compiling this function & rustls is not enabled, then native-tls MUST be enabled #[cfg(not(feature = "rustls"))] - let with_https = |b: Builder<_, M, R>| b.native_tls_connector(); + let with_https = |b: Builder<_, M, R>| b.native_tls_connector(connector_settings); with_https(self) } diff --git a/rust-runtime/aws-smithy-client/src/hyper_ext.rs b/rust-runtime/aws-smithy-client/src/hyper_ext.rs index 18acf75526..27caf43ad3 100644 --- a/rust-runtime/aws-smithy-client/src/hyper_ext.rs +++ b/rust-runtime/aws-smithy-client/src/hyper_ext.rs @@ -17,7 +17,20 @@ //! with `rustls` will be constructed during client creation. However, if you are creating a Smithy //! [`Client`](crate::Client), directly, use the `dyn_https_https()` method to match that default behavior: //! -//! ```no_run +#![cfg_attr( + not(all( + any(feature = "rustls", feature = "native-tls"), + feature = "client-hyper" + )), + doc = "```no_run,ignore" +)] +#![cfg_attr( + all( + any(feature = "rustls", feature = "native-tls"), + feature = "client-hyper" + ), + doc = "```no_run" +)] //! use aws_smithy_client::Client; //! //! let client = Client::builder() @@ -34,7 +47,11 @@ //! A use case for where you may want to use the [`Adapter`] is when settings Hyper client settings //! that aren't otherwise exposed by the `Client` builder interface. //! -//! ```no_run +#![cfg_attr( + not(all(feature = "rustls", feature = "client-hyper")), + doc = "```no_run,ignore" +)] +#![cfg_attr(all(feature = "rustls", feature = "client-hyper"), doc = "```no_run")] //! use std::time::Duration; //! use aws_smithy_client::{Client, conns, hyper_ext}; //! use aws_smithy_client::erase::DynConnector; @@ -186,7 +203,11 @@ fn find_source<'a, E: Error + 'static>(err: &'a (dyn Error + 'static)) -> Option /// Construct a HyperAdapter with the default HTTP implementation (rustls). This can be useful when you want to share a Hyper connector /// between multiple Smithy clients. /// -/// ```no_run +#[cfg_attr( + not(all(feature = "rustls", feature = "client-hyper")), + doc = "```no_run,ignore" +)] +#[cfg_attr(all(feature = "rustls", feature = "client-hyper"), doc = "```no_run")] /// use tower::layer::util::Identity; /// use aws_smithy_client::{conns, hyper_ext}; /// use aws_smithy_client::erase::DynConnector; @@ -428,7 +449,7 @@ mod timeout_middleware { fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let (timeout_future, kind, &mut duration) = match self.project() { MaybeTimeoutFutureProj::NoTimeout { future } => { - return future.poll(cx).map_err(|err| err.into()) + return future.poll(cx).map_err(|err| err.into()); } MaybeTimeoutFutureProj::Timeout { timeout,