Unverified Commit b547045a authored by Luca Palmieri's avatar Luca Palmieri Committed by GitHub
Browse files

Add a new CI job to check that smithy-rs compiles on 32bit Linux-based targets (#1812)

* Replace AtomicU64 with AtomicUsize to prevent compilation issues on 32 bits platforms.

* Make sure that Rust tests compile on MacOS.

* Add CHANGELOG next entry.

* Add a new CI job to check that smithy-rs compiles on 32bit Linux-based targets.

* No trailing commas pretty please.

* Point cross at the manifest explicitly.

* Skip crates with a Python dependency. Exercise all features.

* Install required dependencies.

* Do not fail fast, we want to see the result on all platforms.

* Set paths for both commands.

* Openssl must be installed inside the cross Docker container, not on the host machine.

* Fix connector setup if `rustls` feature is not enabled.

* Restrict feature set on powerpc.

* Pass openssl env variables to the cross Docker container

* Split in two commands.

* Enable debug level logs.

* Remove openssl feature (temporarily).

* Raise verbosity.

* Trigger CI

* `native-tls`, here we go again.

* Clean up.

* Trigger CI

* Trigger CI

* Add pkg-config.

* Change include path to include arch

* Trigger CI

* Allow workflow_dispatch on ci-pr to enable triggering this CI workflow from the GitHub web interface.

* Trigger CI? Why are you doing this to me GitHub?

* Trigger CI? Are you alive GitHub?

* Fix env variables for openssl

* Use features only for rust-runtime crates.

* Check all feature combinations for aws-smithy-client

* Dry-up env variables.

* A rogue `echo` was missing

* Feature-gate doc tests based on the features they require.

* Put .github folder under shared ownership.

* Fix docs.

* Fix feature selection for doctest.

* We are using methods that are only available if rustls is enabled - adjust feature gates accordingly.

* Remove workflow dispatch trigger.
parent 9db14463
Loading
Loading
Loading
Loading
+64 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ impl<M, R> 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)
    }
+25 −4
Original line number Diff line number Diff line
@@ -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<Self::Output> {
            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,