Skip to content

Commit

Permalink
Merge remote-tracking branch 'awslabs/main' into davidpz-migrate-from…
Browse files Browse the repository at this point in the history
…-`structopt`-to-`clap`-v3
  • Loading branch information
david-perez committed Apr 11, 2022
2 parents 5365a83 + aaed505 commit 959fc45
Show file tree
Hide file tree
Showing 59 changed files with 1,403 additions and 615 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
# Run normal CI, which should pick up the updated build image
ci:
needs: rebuild-docker-build-image
uses: awslabs/smithy-rs/.github/worfklows/ci.yaml@main
uses: ./.github/workflows/ci.yml
45 changes: 36 additions & 9 deletions .github/workflows/ci.yaml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
matrix:
# These correspond to scripts in tools/ci-build/scripts that will be run in the Docker build image
actions:
- action: check-style-and-lints
- action: generate-aws-sdk
- action: generate-aws-sdk-smoketest
- action: generate-smithy-rs-runtime-bundle
Expand All @@ -66,8 +65,40 @@ jobs:
with:
action: ${{ matrix.actions.action }}

test:
name: Test
# Test the code generator and other parts (styles and lints) that don't require
# code to have already been generated in order to run.
test-codegen:
name: Test Codegen
needs:
- acquire-base-image
runs-on: ubuntu-latest
# To avoid repeating setup boilerplate, we have the actual test commands
# in a matrix strategy. These commands get run in the steps after all the setup.
strategy:
fail-fast: false
matrix:
# These correspond to scripts in tools/ci-build/scripts that will be run in the Docker build image
test:
- action: check-client-codegen-integration-tests
- action: check-client-codegen-unit-tests
- action: check-sdk-codegen-unit-tests
- action: check-server-codegen-integration-tests
- action: check-server-codegen-unit-tests
- action: check-server-e2e-test
- action: check-style-and-lints
steps:
- uses: actions/checkout@v3
with:
path: smithy-rs
- name: Run ${{ matrix.test.action }}
uses: ./smithy-rs/.github/actions/docker-build
with:
action: ${{ matrix.test.action }}

# Test all the things that require generated code. Note: the Rust runtimes require codegen
# to be checked since `aws-config` depends on the generated STS client.
test-runtimes-tools-and-sdk:
name: Test Rust Runtimes, Tools, and SDK
needs:
- acquire-base-image
- generate
Expand All @@ -83,12 +114,7 @@ jobs:
- action: check-aws-sdk-smoketest-additional-checks
- action: check-aws-sdk-smoketest-docs-clippy-udeps
- action: check-aws-sdk-smoketest-unit-tests
- action: check-client-codegen-integration-tests
- action: check-client-codegen-unit-tests
- action: check-rust-runtimes-and-tools
- action: check-sdk-codegen-unit-tests
- action: check-server-codegen-integration-tests
- action: check-server-codegen-unit-tests
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -150,7 +176,8 @@ jobs:
# Should NOT depend on check-sdk-examples since that's an optional check
needs:
- generate
- test
- test-codegen
- test-runtimes-tools-and-sdk
- test-rust-windows
# Run this job even if its dependency jobs fail
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
paths:
- design/**

name: Update GitHub Pages

# Allow only one doc pages build to run at a time for the entire smithy-rs repo
concurrency:
group: github-pages-yml
Expand Down
115 changes: 101 additions & 14 deletions .github/workflows/pull-request-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ concurrency:
env:
java_version: 11
rust_version: 1.56.1
rust_toolchain_components: clippy,rustfmt
apt_dependencies: libssl-dev gnuplot jq

jobs:
generate-diff:
Expand All @@ -27,6 +29,8 @@ jobs:
id-token: write
contents: read
pull-requests: write
outputs:
bot-message: ${{ steps.generate-diff.outputs.bot-message }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
Expand Down Expand Up @@ -67,17 +71,6 @@ jobs:
aws s3 cp tmp-codegen-diff/${{ github.event.pull_request.base.sha }} \
"s3://${S3_BUCKET_NAME}/codegen-diff/${{ github.event.pull_request.base.sha }}" --recursive
fi
- uses: actions/github-script@v5
# NOTE: if comments on each commit become bothersome, add a check that github.event.pull_request.action == "opened"
if: ${{ github.head_ref != null }}
with:
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.generate-diff.outputs.bot-message }}'
})
generate-doc-preview:
runs-on: ubuntu-latest
Expand All @@ -89,6 +82,8 @@ jobs:
id-token: write
contents: read
pull-requests: write
outputs:
bot-message: ${{ steps.generate-preview.outputs.bot-message }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
Expand All @@ -110,6 +105,7 @@ jobs:
toolchain: ${{ env.rust_version }}
default: true
- name: Generate doc preview
id: generate-preview
# Only generate three of the smallest services since the doc build can be very large. STS and SSO must be
# included since aws-config depends on them. Transcribe Streaming and DynamoDB (paginators/waiters) were chosen
# below to stay small while still representing most features. Combined, they are about ~20MB at time of writing.
Expand All @@ -130,6 +126,8 @@ jobs:
cargo doc --no-deps --all-features
popd
./tools/generate-doc-preview-index.sh ${{ github.event.pull_request.base.sha }}
echo '::set-output name=bot-message::A [new doc preview](https://d2luzm2xt3nokh.cloudfront.net/docs/'${{ github.event.pull_request.head.sha }}'/index.html) is ready to view.'
- uses: aws-actions/configure-aws-credentials@v1
name: Acquire credentials for uploading to S3
with:
Expand All @@ -139,14 +137,103 @@ jobs:
- name: Upload doc preview to S3
run: |
aws s3 cp target/doc "s3://${S3_BUCKET_NAME}/docs/${{ github.event.pull_request.head.sha }}" --recursive
- uses: actions/github-script@v5
# NOTE: if comments on each commit become bothersome, add a check that github.event.pull_request.action == "opened"
generate-server-benchmark:
name: Generate server benchmark
runs-on: ubuntu-latest
outputs:
bot-message: ${{ steps.run-benchmark.outputs.bot-message }}
steps:
- name: Checkout PR
uses: actions/checkout@v3
with:
path: pull-request
- name: Checkout origin/main
uses: actions/checkout@v3
with:
repository: awslabs/smithy-rs
path: origin-main
ref: main
- name: Checkout wrk
uses: actions/checkout@v3
with:
repository: wg/wrk
path: wrk-build
ref: 4.2.0
- uses: actions/cache@v2
name: Gradle Cache
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
# Pinned to the commit hash of v1.3.0
- name: Rust Cache
uses: Swatinem/rust-cache@842ef286fff290e445b90b4002cc9807c3669641
with:
sharedKey: ${{ runner.os }}-${{ env.rust_version }}-${{ github.job }}
target-dir: ./target
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ env.java_version }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rust_version }}
components: ${{ env.rust_toolchain_components }}
default: true
- name: Install benchmarks dependencies
run: sudo apt-get update && sudo apt-get install -y ${{ env.apt_dependencies }}
# Ubuntu 20.04 doesn't have wrk packaged, hence we need to build it 🤦
# This will go away as soon as GitHub supports Ubuntu 21.10.
- name: Install wrk
run: cd wrk-build && make -j8 wrk && sudo cp wrk /usr/local/bin
- name: Run benchmark
id: run-benchmark
run: |
mkdir -p ~/.wrk-api-bench
# run the benchmark on origin/main
pushd origin-main/rust-runtime/aws-smithy-http-server/examples
make && RUN_BENCHMARKS=1 cargo test --release
popd
# run the benchmark on current ref
pushd pull-request/rust-runtime/aws-smithy-http-server/examples
make && RUN_BENCHMARKS=1 cargo test --release
popd
# Uncomment this for debugging purposes. It will print out the
# content of all the benchmarks found in the cache + the last one
# produced by the current run.
# for x in ~/.wrk-api-bench/*; do echo "Benchmark $x content:"; jq . "$x"; echo; done
# Ensure the output is available for the PR bot.
echo "::set-output name=bot-message::$(cat /tmp/smithy_rs_benchmark_deviation.txt)"
post-bot-comment:
needs:
- generate-diff
- generate-doc-preview
- generate-server-benchmark
runs-on: ubuntu-latest
name: Post bot comment
permissions:
id-token: write
contents: read
pull-requests: write
steps:
- name: Post bot comment
uses: actions/github-script@v5
if: ${{ github.head_ref != null }}
with:
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'A [new doc preview](https://d2luzm2xt3nokh.cloudfront.net/docs/${{ github.event.pull_request.head.sha }}/index.html) is ready to view.'
body: '${{ needs.generate-diff.outputs.bot-message }}\n\n' +
'${{ needs.generate-doc-preview.outputs.bot-message }}\n\n' +
'${{ needs.generate-server-benchmark.outputs.bot-message }}\n\n'
})
136 changes: 0 additions & 136 deletions .github/workflows/server-benchmark.yml

This file was deleted.

Loading

0 comments on commit 959fc45

Please sign in to comment.