Skip to content

Commit 63e59f8

Browse files
Merge commit 'c2c6a66a8b701b1da3888c773b7be3d04fe90684' into unstable-serde-support
2 parents e5f8e18 + c2c6a66 commit 63e59f8

File tree

717 files changed

+41635
-22555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

717 files changed

+41635
-22555
lines changed

.editorconfig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@ indent_size = 4
99
indent_style = space
1010
insert_final_newline = true
1111
max_line_length = 120
12+
1213
# Ktlint-specific config
13-
disabled_rules = filename, max-line-length, argument-list-wrapping, parameter-list-wrapping
14+
ktlint_standard = enabled
15+
ktlint_experimental = disabled
16+
ktlint_standard_filename = disabled
17+
ktlint_standard_max-line-length = disabled
18+
ktlint_standard_argument-list-wrapping = disabled
19+
ktlint_standard_parameter-list-wrapping = disabled

.github/scripts/docker-image-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ set -eo pipefail
1111
cd "$(dirname "$0")"
1212
cd "$(git rev-parse --show-toplevel)"
1313

14-
git ls-files -s --full-name "tools" | git hash-object --stdin
14+
git ls-files -s --full-name "tools/ci-build" | git hash-object --stdin

.github/scripts/get-or-create-release-branch.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ set -eux
88
# Compute the name of the release branch starting from the version that needs to be released ($SEMANTIC_VERSION).
99
# If it's the beginning of a new release series, the branch is created and pushed to the remote (chosen according to
1010
# the value $DRY_RUN).
11-
# If it isn't the beginning of a new release series, the script makes sure that the commit that will be tagged is at
12-
# the tip of the (pre-existing) release branch.
1311
#
1412
# The script populates an output file with key-value pairs that are needed in the release CI workflow to carry out
1513
# the next steps in the release flow: the name of the release branch and a boolean flag that is set to 'true' if this
@@ -57,16 +55,7 @@ if [[ "${DRY_RUN}" == "true" ]]; then
5755
git push --force origin "HEAD:refs/heads/${branch_name}"
5856
else
5957
commit_sha=$(git rev-parse --short HEAD)
60-
if git ls-remote --exit-code --heads origin "${branch_name}"; then
61-
# The release branch already exists, we need to make sure that our commit is its current tip
62-
branch_head_sha=$(git rev-parse --verify --short "refs/heads/${branch_name}")
63-
if [[ "${branch_head_sha}" != "${commit_sha}" ]]; then
64-
echo "The release branch - ${branch_name} - already exists. ${commit_sha}, the commit you chose when "
65-
echo "launching this release, is not its current HEAD (${branch_head_sha}). This is not allowed: you "
66-
echo "MUST release from the HEAD of the release branch if it already exists."
67-
exit 1
68-
fi
69-
else
58+
if ! git ls-remote --exit-code --heads origin "${branch_name}"; then
7059
# The release branch does not exist.
7160
# We need to make sure that the commit SHA that we are releasing is on `main`.
7261
git fetch origin main
@@ -75,7 +64,7 @@ else
7564
git checkout -b "${branch_name}"
7665
git push origin "${branch_name}"
7766
else
78-
echo "You must choose a commit from main to create a new release series!"
67+
echo "You must choose a commit from main to create a new release branch!"
7968
exit 1
8069
fi
8170
fi

.github/workflows/ci-merge-queue.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This workflow runs CI for the GitHub merge queue.
5+
6+
name: Merge Queue CI
7+
on:
8+
merge_group:
9+
types: [checks_requested]
10+
11+
# Allow one instance of this workflow per merge
12+
concurrency:
13+
group: ci-merge-queue-yml-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
ecr_repository: public.ecr.aws/w0m4q9l7/github-awslabs-smithy-rs-ci
18+
19+
jobs:
20+
# This job will, if possible, save a docker login password to the job outputs. The token will
21+
# be encrypted with the passphrase stored as a GitHub secret. The login password expires after 12h.
22+
# The login password is encrypted with the repo secret DOCKER_LOGIN_TOKEN_PASSPHRASE
23+
save-docker-login-token:
24+
name: Save a docker login token
25+
outputs:
26+
docker-login-password: ${{ steps.set-token.outputs.docker-login-password }}
27+
permissions:
28+
id-token: write
29+
contents: read
30+
continue-on-error: true
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Attempt to load a docker login password
34+
uses: aws-actions/configure-aws-credentials@v1-node16
35+
with:
36+
role-to-assume: ${{ secrets.SMITHY_RS_PUBLIC_ECR_PUSH_ROLE_ARN }}
37+
role-session-name: GitHubActions
38+
aws-region: us-west-2
39+
- name: Save the docker login password to the output
40+
id: set-token
41+
run: |
42+
ENCRYPTED_PAYLOAD=$(
43+
gpg --symmetric --batch --passphrase "${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }}" --output - <(aws ecr-public get-login-password --region us-east-1) | base64 -w0
44+
)
45+
echo "docker-login-password=$ENCRYPTED_PAYLOAD" >> $GITHUB_OUTPUT
46+
47+
# This job detects if the PR made changes to build tools. If it did, then it builds a new
48+
# build Docker image. Otherwise, it downloads a build image from Public ECR. In both cases,
49+
# it uploads the image as a build artifact for other jobs to download and use.
50+
acquire-base-image:
51+
name: Acquire Base Image
52+
needs: save-docker-login-token
53+
runs-on: ubuntu-latest
54+
env:
55+
ENCRYPTED_DOCKER_PASSWORD: ${{ needs.save-docker-login-token.outputs.docker-login-password }}
56+
DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }}
57+
permissions:
58+
id-token: write
59+
contents: read
60+
steps:
61+
- uses: actions/checkout@v3
62+
with:
63+
path: smithy-rs
64+
- name: Acquire base image
65+
id: acquire
66+
env:
67+
DOCKER_BUILDKIT: 1
68+
run: ./smithy-rs/.github/scripts/acquire-build-image
69+
- name: Acquire credentials
70+
uses: aws-actions/configure-aws-credentials@v1-node16
71+
with:
72+
role-to-assume: ${{ secrets.SMITHY_RS_PUBLIC_ECR_PUSH_ROLE_ARN }}
73+
role-session-name: GitHubActions
74+
aws-region: us-west-2
75+
- name: Upload image
76+
run: |
77+
IMAGE_TAG="$(./smithy-rs/.github/scripts/docker-image-hash)"
78+
docker tag "smithy-rs-base-image:${IMAGE_TAG}" "${{ env.ecr_repository }}:${IMAGE_TAG}"
79+
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
80+
docker push "${{ env.ecr_repository }}:${IMAGE_TAG}"
81+
82+
# Run shared CI after the Docker build image has either been rebuilt or found in ECR
83+
ci:
84+
needs:
85+
- save-docker-login-token
86+
- acquire-base-image
87+
if: ${{ github.event.pull_request.head.repo.full_name == 'awslabs/smithy-rs' || toJSON(github.event.merge_group) != '{}' }}
88+
uses: ./.github/workflows/ci.yml
89+
with:
90+
run_sdk_examples: true
91+
secrets:
92+
ENCRYPTED_DOCKER_PASSWORD: ${{ needs.save-docker-login-token.outputs.docker-login-password }}
93+
DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
required: false
3030

3131
env:
32-
rust_version: 1.62.1
32+
rust_version: 1.66.1
3333
rust_toolchain_components: clippy,rustfmt
3434
ENCRYPTED_DOCKER_PASSWORD: ${{ secrets.ENCRYPTED_DOCKER_PASSWORD }}
3535
DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }}

.github/workflows/claim-crate-names.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
env:
13-
rust_version: 1.62.1
13+
rust_version: 1.66.1
1414

1515
name: Claim unpublished crate names on crates.io
1616
run-name: ${{ github.workflow }}

.github/workflows/pull-request-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ concurrency:
2828

2929
env:
3030
java_version: 11
31-
rust_version: 1.62.1
31+
rust_version: 1.66.1
3232
rust_toolchain_components: clippy,rustfmt
3333
apt_dependencies: libssl-dev gnuplot jq
3434

.github/workflows/release-scripts/create-release.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ module.exports = async ({
4444
isDryRun,
4545
// Release manifest file path
4646
releaseManifestPath,
47+
// The commit-like reference that we want to release (e.g. a commit SHA or a branch name)
48+
releaseCommitish,
4749
}) => {
4850
assert(github !== undefined, "The `github` argument is required");
4951
assert(isDryRun !== undefined, "The `isDryRun` argument is required");
5052
assert(releaseManifestPath !== undefined, "The `releaseManifestPath` argument is required");
53+
assert(releaseCommitish !== undefined, "The `releaseCommitish` argument is required");
5154

5255
console.info(`Starting GitHub release creation with isDryRun: ${isDryRun}, and releaseManifestPath: '${releaseManifestPath}'`);
5356

@@ -74,6 +77,7 @@ module.exports = async ({
7477
name: releaseManifest.name,
7578
body: releaseManifest.body,
7679
prerelease: releaseManifest.prerelease,
80+
target_commitish: releaseCommitish,
7781
});
7882
console.info(`SUCCESS: Created release with ID: ${response.data.id}, URL: ${response.data.html_url} `);
7983
} else {

.github/workflows/release.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
env:
13-
rust_version: 1.62.1
13+
rust_version: 1.66.1
1414

1515
name: Release smithy-rs
1616
run-name: ${{ github.workflow }} ${{ inputs.semantic_version }} (${{ inputs.commit_sha }}) - ${{ inputs.dry_run && 'Dry run' || 'Production run' }}
1717
on:
1818
workflow_dispatch:
1919
inputs:
2020
commit_sha:
21-
description: |
22-
The SHA of the git commit that you want to release.
21+
description: |
22+
The SHA of the git commit that you want to release.
2323
You must use the non-abbreviated SHA (e.g. b2318b0 won't work!).
2424
required: true
2525
type: string
@@ -75,8 +75,8 @@ jobs:
7575
# We need `always` here otherwise this job won't run if the previous job has been skipped
7676
# See https://samanpavel.medium.com/github-actions-conditional-job-execution-e6aa363d2867
7777
if: |
78-
always() &&
79-
needs.acquire-base-image.result == 'success' &&
78+
always() &&
79+
needs.acquire-base-image.result == 'success' &&
8080
(needs.release-ci.result == 'success' || needs.release-ci.result == 'skipped')
8181
runs-on: ubuntu-latest
8282
outputs:
@@ -87,6 +87,7 @@ jobs:
8787
with:
8888
ref: ${{ inputs.commit_sha }}
8989
token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
90+
fetch-depth: 0
9091
- name: Get or create release branch
9192
id: branch-push
9293
shell: bash
@@ -112,11 +113,13 @@ jobs:
112113
runs-on: ubuntu-latest
113114
outputs:
114115
release_branch: ${{ needs.get-or-create-release-branch.outputs.release_branch }}
116+
commit_sha: ${{ steps.gradle-push.outputs.commit_sha }}
115117
steps:
116118
- uses: actions/checkout@v3
117119
with:
118-
ref: ${{ needs.get-or-create-release-branch.outputs.release_branch }}
120+
ref: ${{ inputs.commit_sha }}
119121
path: smithy-rs
122+
fetch-depth: 0
120123
token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
121124
- name: Upgrade gradle.properties
122125
uses: ./smithy-rs/.github/actions/docker-build
@@ -131,13 +134,30 @@ jobs:
131134
shell: bash
132135
env:
133136
SEMANTIC_VERSION: ${{ inputs.semantic_version }}
137+
RELEASE_COMMIT_SHA: ${{ inputs.commit_sha }}
138+
RELEASE_BRANCH_NAME: ${{ needs.get-or-create-release-branch.outputs.release_branch }}
134139
DRY_RUN: ${{ inputs.dry_run }}
135140
run: |
136141
set -x
142+
137143
# For debugging purposes
138144
git status
139-
# The file was actually changed, we need to commit the changes
140-
git diff-index --quiet HEAD || { git -c 'user.name=AWS SDK Rust Bot' -c 'user.email=aws-sdk-rust-primary@amazon.com' commit gradle.properties --message "Upgrade the smithy-rs runtime crates version to ${SEMANTIC_VERSION}" && git push origin; }
145+
146+
if ! git diff-index --quiet HEAD; then
147+
# gradle.properties was changed, we need to commit and push the diff
148+
git -c 'user.name=AWS SDK Rust Bot' -c 'user.email=aws-sdk-rust-primary@amazon.com' commit gradle.properties --message "Upgrade the smithy-rs runtime crates version to ${SEMANTIC_VERSION}"
149+
150+
# This will fail if we tried to release from a non-HEAD commit on the release branch.
151+
# The only scenario where we would try to release a non-HEAD commit from the release branch is
152+
# to retry a release action execution that failed due to a transient issue.
153+
# In that case, we expect the commit to be releasable as-is, i.e. the runtime crate version in gradle.properties
154+
# should already be the expected one.
155+
git push origin "HEAD:refs/heads/${RELEASE_BRANCH_NAME}"
156+
157+
echo "commit_sha=$(git rev-parse HEAD)" > $GITHUB_OUTPUT
158+
else
159+
echo "commit_sha=${RELEASE_COMMIT_SHA}" > $GITHUB_OUTPUT
160+
fi
141161
142162
release:
143163
name: Release
@@ -158,7 +178,7 @@ jobs:
158178
- name: Checkout smithy-rs
159179
uses: actions/checkout@v3
160180
with:
161-
ref: ${{ needs.upgrade-gradle-properties.outputs.release_branch }}
181+
ref: ${{ needs.upgrade-gradle-properties.outputs.commit_sha }}
162182
path: smithy-rs
163183
token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }}
164184
- name: Generate release artifacts
@@ -170,9 +190,20 @@ jobs:
170190
- name: Push smithy-rs changes
171191
shell: bash
172192
working-directory: smithy-rs-release/smithy-rs
193+
id: push-changelog
194+
env:
195+
RELEASE_BRANCH_NAME: ${{ needs.upgrade-gradle-properties.outputs.release_branch }}
173196
run: |
174-
echo "Pushing release commits..."
175-
git push origin
197+
if ! git diff-index --quiet HEAD; then
198+
echo "Pushing release commits..."
199+
# This will fail if we tried to release from a non-HEAD commit on the release branch.
200+
# The only scenario where we would try to release a non-HEAD commit from the release branch is
201+
# to retry a release action execution that failed due to a transient issue.
202+
# In that case, we expect the commit to be releasable as-is, i.e. the changelog should have already
203+
# been processed.
204+
git push origin "HEAD:refs/heads/${RELEASE_BRANCH_NAME}"
205+
fi
206+
echo "commit_sha=$(git rev-parse HEAD)" > $GITHUB_OUTPUT
176207
- name: Tag release
177208
uses: actions/github-script@v6
178209
with:
@@ -182,7 +213,8 @@ jobs:
182213
await createReleaseScript({
183214
github,
184215
isDryRun: ${{ inputs.dry_run }},
185-
releaseManifestPath: "smithy-rs-release/smithy-rs-release-manifest.json"
216+
releaseManifestPath: "smithy-rs-release/smithy-rs-release-manifest.json",
217+
releaseCommitish: "${{ steps.push-changelog.outputs.commit_sha }}"
186218
});
187219
- name: Publish to crates.io
188220
shell: bash
@@ -232,7 +264,7 @@ jobs:
232264
shell: bash
233265
run: |
234266
set -eux
235-
267+
236268
# This will fail if other commits have been pushed to `main` after `commit_sha`
237269
# In particular, this will ALWAYS fail if you are creating a new release series from
238270
# a commit that is not the current tip of `main`.

.github/workflows/update-sdk-next.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Set up Rust
3333
uses: dtolnay/rust-toolchain@master
3434
with:
35-
toolchain: 1.62.1
35+
toolchain: 1.66.1
3636
- name: Delete old SDK
3737
run: |
3838
- name: Generate a fresh SDK

0 commit comments

Comments
 (0)