Go to file
Luca Palmieri e1991fa7c7
[release-branches] Fix working directory (#2298)
* Fix working directory.

* Build the Docker image using the latest commit on the invocation branch.

* We need a Docker image with the same SHA later in the process.
2023-02-03 12:26:20 +00:00
.cargo Include SDK example/test projects in CI and centralize Cargo target directory (#636) 2021-08-09 12:25:40 -07:00
.github Collect more diagnostics. (#2297) 2023-02-03 11:33:34 +00:00
.pre-commit-hooks Reduce Docker image rebuilds (#2269) 2023-02-01 18:41:31 +00:00
aws Simplify `AdHocSection` (#2272) 2023-02-02 22:35:09 +00:00
buildSrc Copy non-service integration tests into SDK root tests directory (#2255) 2023-01-27 21:13:25 +00:00
codegen-client Simplify `AdHocSection` (#2272) 2023-02-02 22:35:09 +00:00
codegen-client-test Enable streaming support for AwsJson (#2207) 2023-01-17 14:26:50 +00:00
codegen-core Simplify `AdHocSection` (#2272) 2023-02-02 22:35:09 +00:00
codegen-server Must set a member in unions (#2241) 2023-02-02 04:23:04 +00:00
codegen-server-test Add support for `@uniqueItems` (#2232) 2023-02-01 12:43:12 +00:00
design Update the event stream section in RFC30 (#2243) 2023-01-27 22:30:34 +00:00
gradle/wrapper Fix Gradle deprecation warnings (#1978) 2022-11-11 13:04:30 -08:00
rust-runtime Reduce Docker image rebuilds (#2269) 2023-02-01 18:41:31 +00:00
tools [release-branches] Fix working directory (#2298) 2023-02-03 12:26:20 +00:00
.cargo-deny-config.toml Add license checks to CI (#1687) 2022-09-01 14:40:29 -07:00
.editorconfig refactor: unify module writers (apologies for the churn 😅) (#1783) 2022-10-18 17:18:07 +00:00
.git-blame-ignore-revs Create initial `.git-blame-ignore-revs` (#1726) 2022-09-09 14:09:06 -07:00
.gitignore chore: upgrade dokka gradle plugin (#1722) 2022-09-13 15:16:14 -07:00
.pre-commit-config.yaml formatting: run pre-commit on all files (#2236) 2023-01-20 16:02:26 +00:00
CHANGELOG.md Update mentions to codegen configuration key in changelog (#2166) 2023-02-01 15:25:54 +00:00
CHANGELOG.next.toml Fix broken doc link to `tokio_stream::Stream` (#2271) 2023-02-02 18:56:29 +00:00
CODEOWNERS `CODEOWNERS`: Move Python related folders to `@awslabs/smithy-rs-python-server` team (#2033) 2022-11-30 10:21:42 +00:00
CODE_OF_CONDUCT.md Initial commit 2020-10-28 06:37:45 -07:00
CONTRIBUTING.md Update security disclosure instructions (#1758) 2022-09-22 17:05:45 +00:00
LICENSE Initial commit 2020-10-28 06:37:45 -07:00
NOTICE Initial commit 2020-10-28 06:37:45 -07:00
README.md Use plain cargo to test runtime crates instead of gradle (#1924) 2022-10-31 16:47:27 +00:00
build.gradle.kts formatting: run pre-commit on all files (#2236) 2023-01-20 16:02:26 +00:00
ci Add release metadata to `versions.toml` (#1400) 2022-05-23 23:31:23 +00:00
ci.mk Reduce Docker image rebuilds (#2269) 2023-02-01 18:41:31 +00:00
gradle.properties Change the release flow to use release branches (#2253) 2023-02-01 17:10:18 +00:00
gradlew Upgrade to Gradle 7 (#1411) 2022-06-23 12:27:43 -04:00
gradlew.bat Upgrade to Gradle 7 (#1411) 2022-06-23 12:27:43 -04:00
rust-toolchain.toml Remove our `base64` implementation in favour of `base64-simd` (#1938) 2022-11-09 12:08:17 +00:00
settings.gradle.kts fix: use idiomatic method of setting smithy gradle plugin version (#1995) 2022-11-16 21:58:04 +00:00

README.md

Smithy Rust CI on Branch main

Smithy code generators for Rust that generate clients, servers, and the entire AWS SDK. The latest unreleased SDK build can be found in aws-sdk-rust/next.

Design documentation

All internal and external interfaces are considered unstable and subject to change without notice.

Setup

  1. ./gradlew will setup gradle for you. JDK 17 is required.
  2. Running tests requires a working Rust installation. See Rust docs for installation instructions on your platform. The MSRV (Minimum Supported Rust Version) for the crates in this project is stable-2, i.e. the current stable Rust version and the prior two versions. Older versions may work.

Development

For development, pre-commit hooks make it easier to pass automated linting when opening a pull request. Setup:

brew install pre-commit # (or appropriate for your platform: https://pre-commit.com/)
pre-commit install

Project Layout

  • aws: AWS specific codegen & Rust code (signing, endpoints, customizations, etc.) Common commands:
    • ./gradlew :aws:sdk:assemble: Generate (but do not test / compile etc.) a fresh SDK into sdk/build/aws-sdk
    • ./gradlew :aws:sdk:test: Generate & run all tests for a fresh SDK
    • ./gradlew :aws:sdk:{cargoCheck, cargoTest, cargoDocs, cargoClippy}: Generate & run specified cargo command.
  • codegen-core: Common code generation logic useful for clients and servers
  • codegen-client: Whitelabel Smithy client code generation
  • codegen-client-test: Smithy protocol test generation & integration tests for Smithy client whitelabel code
  • design: Design documentation. See the design/README.md for details about building / viewing.
  • codegen-server: Whitelabel Smithy server code generation
  • codegen-server-test: Smithy protocol test generation & integration tests for Smithy server whitelabel code

Testing

Running all of smithy-rs's tests can take a very long time, so it's better to know which parts to test based on the changes being made, and allow continuous integration to find other issues when posting a pull request.

In general, the components of smithy-rs affect each other in the following order (with earlier affecting later):

  1. rust-runtime
  2. codegen and codegen-server
  3. aws/rust-runtime
  4. aws/sdk-codegen

Some components, such as codegen-client-test and codegen-server-test, are purely for testing other components.

Testing rust-runtime and aws/rust-runtime

To test the rust-runtime crates:

# Run all Rust tests for `rust-runtime/` (from repo root):
cargo test --manifest-path=rust-runtime/Cargo.toml
# Run clippy for `rust-runtime/` (from repo root):
cargo clippy --manifest-path=rust-runtime/Cargo.toml

# Or
cd rust-runtime
cargo test
cargo clippy

To test the aws/rust-runtime crates:

# Run all Rust tests for `aws/rust-runtime/` (from repo root):
cargo test --manifest-path=aws/rust-runtime/Cargo.toml
# Run clippy for `aws/rust-runtime/` (from repo root):
cargo clippy --manifest-path=aws/rust-runtime/Cargo.toml

# Or
cd aws/rust-runtime
cargo test
cargo clippy

Some runtime crates have a additional-ci script that can also be run. These scripts often require cargo-hack and cargo-udeps to be installed.

Testing Client/Server Codegen

To test the code generation, the following can be used:

# Run Kotlin codegen unit tests
./gradlew codegen-core:check
./gradlew codegen-client:check
./gradlew codegen-server:check
# Run client codegen tests
./gradlew codegen-client-test:check
# Run server codegen tests
./gradlew codegen-server-test:check

Several Kotlin unit tests generate Rust projects and compile them. When these fail, they typically output links to the location of the generated code so that it can be inspected.

To look at generated code when the codegen tests fail, check these paths depending on the test suite that's failing:

  • For codegen-client-test: codegen-client-test/build/smithyprojections/codegen-client-test
  • For codegen-server-test: codegen-server-test/build/smithyprojections/codegen-server-test

Testing SDK Codegen

See the readme in aws/sdk/ for more information about these targets as they can be configured to generate more or less AWS service clients.

# Run Kotlin codegen unit tests
./gradlew aws:sdk-codegen:check
# Generate an SDK, but do not attempt to compile / run tests. Useful for inspecting generated code
./gradlew :aws:sdk:assemble
# Run all the tests
./gradlew :aws:sdk:test
# Validate that the generated code compiles
./gradlew :aws:sdk:cargoCheck
# Validate that the generated code passes Clippy
./gradlew :aws:sdk:cargoClippy
# Validate the generated docs
./gradlew :aws:sdk:cargoDoc

The generated SDK will be placed in aws/sdk/build/aws-sdk.