Unverified Commit 21df7234 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Include SDK example/test projects in CI and centralize Cargo target directory (#636)

* Create workspaces for AWS SDK examples and tests and add CI step to verify them

* Centralize the Cargo target directory

* Remove the separate example workspace for now since it conflicts with the generated one

* Fix the rustfmt step

* Fix build path

* Fix mkdir in standalone tests
parent 04e09c2d
Loading
Loading
Loading
Loading

.cargo/config.toml

0 → 100644
+3 −0
Original line number Diff line number Diff line
[build]
# Share one `target` directory at the project root for all Cargo projects and workspaces in smithy-rs
target-dir = "target"
+53 −13
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ jobs:
          ${{ runner.os }}-gradle-
    - name: ktlint
      run: ./gradlew ktlint

  unit-tests:
    name: Codegen unit tests
    runs-on: ubuntu-latest
@@ -64,6 +65,7 @@ jobs:
      run: ./gradlew :codegen:test
    - name: aws tests
      run: ./gradlew :aws:sdk-codegen:test

  integration-tests:
    name: Codegen integration tests
    runs-on: ubuntu-latest
@@ -106,6 +108,7 @@ jobs:
        path: |
          codegen-test/build/smithyprojections/codegen-test/*/rust-codegen/
          codegen-test/build/smithyprojections/codegen-test/Cargo.toml

  runtime-tests:
    name: Rust runtime tests
    strategy:
@@ -128,7 +131,7 @@ jobs:
        components: ${{ env.rust_toolchain_components }}
        default: true
    - name: Format Check
      run: rustfmt --check --edition 2018 $(find -name '*.rs' -print)
      run: rustfmt --check --edition 2018 $(find -name '*.rs' -print | grep -v /target/)
      # windows doesn't support using --check like this
      if: ${{ matrix.os == 'ubuntu-latest' }}
    - name: clippy check
@@ -146,7 +149,7 @@ jobs:
        RUSTDOCFLAGS: -D warnings

  generate-sdk:
    name: Generate an AWS SDK
    name: AWS Rust SDK Tier 1 - Generate
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
@@ -170,8 +173,6 @@ jobs:
        java-version: ${{ env.java_version }}
    - name: Generate the SDK
      run: ./gradlew :aws:sdk:assemble
    - name: Generate the SDK...again?
      run: ./gradlew :aws:sdk:assemble
    - name: Generate a list of services with tests
      run: python aws/sdk/test-services.py > aws/sdk/build/aws-sdk/services-with-tests
    - name: Generate a name for the SDK
@@ -186,7 +187,7 @@ jobs:
        path: sdk.tar

  check-sdk:
    name: cargo check AWS SDK
    name: AWS Rust SDK Tier 1 - cargo check
    needs: generate-sdk
    runs-on: ubuntu-latest
    steps:
@@ -219,10 +220,11 @@ jobs:
      run: cargo check --lib --tests --benches
      working-directory: aws-sdk
      env:
        RUSTC_FORCE_INCREMENTAL: 1
        RUSTFLAGS: -D warnings
        CARGO_TARGET_DIR: ../target

  test-sdk:
    name: cargo test AWS SDK
    name: AWS Rust SDK Tier 1 - cargo test
    needs: generate-sdk
    runs-on: ubuntu-latest
    steps:
@@ -252,14 +254,14 @@ jobs:
          ${{ runner.os }}-${{ env.rust_version }}-${{ github.job }}-
          ${{ runner.os }}-${{ env.rust_version }}-
    - name: Cargo Test
      run: cargo test $(cat services-with-tests)
      run: cargo test $(cat service-with-tests)
      working-directory: aws-sdk
      env:
        RUSTC_FORCE_INCREMENTAL: 1
        RUSTFLAGS: -D warnings
        CARGO_TARGET_DIR: ../target

  docs-sdk:
    name: cargo docs AWS SDK
    name: AWS Rust SDK Tier 1 - cargo docs
    needs: generate-sdk
    runs-on: ubuntu-latest
    steps:
@@ -290,8 +292,9 @@ jobs:
      working-directory: aws-sdk
      env:
        RUSTDOCFLAGS: -D warnings

  clippy-sdk:
    name: cargo clippy AWS SDK
    name: AWS Rust SDK Tier 1 - cargo clippy
    needs: generate-sdk
    runs-on: ubuntu-latest
    steps:
@@ -321,8 +324,45 @@ jobs:
      run: cargo clippy -- -D warnings
      working-directory: aws-sdk

  standalone-integration-tests-check:
    name: AWS Rust SDK Standalone Integration Tests - cargo check
    needs: generate-sdk
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/cache@v2
      name: Gradle Cache
      with:
        path: |
          ~/.gradle/caches
          ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
        restore-keys: |
          ${{ runner.os }}-gradle-
    - uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ env.rust_version }}
        components: ${{ env.rust_toolchain_components }}
        default: true
    - name: Generate a name for the SDK
      id: gen-name
      run: echo "name=${GITHUB_REF##*/}" >> $GITHUB_ENV
    - uses: actions/download-artifact@v2
      name: Download SDK Artifact
      with:
        name: aws-sdk-${{ env.name }}-tier1-${{ github.sha }}
        path: artifact
    - name: untar
      run: mkdir -p aws/sdk/build/aws-sdk && cd aws/sdk/build/aws-sdk && tar -xvf ../../../../artifact/sdk.tar
    - name: Check integration tests
      run: cargo check
      working-directory: aws/sdk/integration-tests
      env:
        RUSTC_FORCE_INCREMENTAL: 1
        RUSTFLAGS: -D warnings

  all-services-check:
    name: cargo check all services
    name: AWS Rust SDK Tier 2 - Generate and cargo check
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
@@ -344,7 +384,7 @@ jobs:
      uses: actions/setup-java@v1
      with:
        java-version: ${{ env.java_version }}
    - name: generate a check all services
    - name: Generate and check all services
      run: ./gradlew -Paws.fullsdk=true :aws:sdk:cargoCheck
    - name: Generate a name for the SDK
      id: gen-name
+10 −0
Original line number Diff line number Diff line
# Note: this workspace exists solely for the convenience of running tests. These packages will all eventually
# end up in the final SDK workspace.
[workspace]
members = [
    "dynamodb",
    "iam",
    "kms",
    "qldbsession",
    "s3",
]