forked from smithy-lang/smithy-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52865bb
commit 6f00505
Showing
732 changed files
with
42,870 additions
and
23,387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This workflow runs CI for the GitHub merge queue. | ||
|
||
name: Merge Queue CI | ||
on: | ||
merge_group: | ||
types: [checks_requested] | ||
|
||
# Allow one instance of this workflow per merge | ||
concurrency: | ||
group: ci-merge-queue-yml-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
ecr_repository: public.ecr.aws/w0m4q9l7/github-awslabs-smithy-rs-ci | ||
|
||
jobs: | ||
# This job will, if possible, save a docker login password to the job outputs. The token will | ||
# be encrypted with the passphrase stored as a GitHub secret. The login password expires after 12h. | ||
# The login password is encrypted with the repo secret DOCKER_LOGIN_TOKEN_PASSPHRASE | ||
save-docker-login-token: | ||
name: Save a docker login token | ||
outputs: | ||
docker-login-password: ${{ steps.set-token.outputs.docker-login-password }} | ||
permissions: | ||
id-token: write | ||
contents: read | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Attempt to load a docker login password | ||
uses: aws-actions/configure-aws-credentials@v1-node16 | ||
with: | ||
role-to-assume: ${{ secrets.SMITHY_RS_PUBLIC_ECR_PUSH_ROLE_ARN }} | ||
role-session-name: GitHubActions | ||
aws-region: us-west-2 | ||
- name: Save the docker login password to the output | ||
id: set-token | ||
run: | | ||
ENCRYPTED_PAYLOAD=$( | ||
gpg --symmetric --batch --passphrase "${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }}" --output - <(aws ecr-public get-login-password --region us-east-1) | base64 -w0 | ||
) | ||
echo "docker-login-password=$ENCRYPTED_PAYLOAD" >> $GITHUB_OUTPUT | ||
# This job detects if the PR made changes to build tools. If it did, then it builds a new | ||
# build Docker image. Otherwise, it downloads a build image from Public ECR. In both cases, | ||
# it uploads the image as a build artifact for other jobs to download and use. | ||
acquire-base-image: | ||
name: Acquire Base Image | ||
needs: save-docker-login-token | ||
runs-on: ubuntu-latest | ||
env: | ||
ENCRYPTED_DOCKER_PASSWORD: ${{ needs.save-docker-login-token.outputs.docker-login-password }} | ||
DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }} | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: smithy-rs | ||
- name: Acquire base image | ||
id: acquire | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
run: ./smithy-rs/.github/scripts/acquire-build-image | ||
- name: Acquire credentials | ||
uses: aws-actions/configure-aws-credentials@v1-node16 | ||
with: | ||
role-to-assume: ${{ secrets.SMITHY_RS_PUBLIC_ECR_PUSH_ROLE_ARN }} | ||
role-session-name: GitHubActions | ||
aws-region: us-west-2 | ||
- name: Upload image | ||
run: | | ||
IMAGE_TAG="$(./smithy-rs/.github/scripts/docker-image-hash)" | ||
docker tag "smithy-rs-base-image:${IMAGE_TAG}" "${{ env.ecr_repository }}:${IMAGE_TAG}" | ||
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws | ||
docker push "${{ env.ecr_repository }}:${IMAGE_TAG}" | ||
# Run shared CI after the Docker build image has either been rebuilt or found in ECR | ||
ci: | ||
needs: | ||
- save-docker-login-token | ||
- acquire-base-image | ||
if: ${{ github.event.pull_request.head.repo.full_name == 'awslabs/smithy-rs' || toJSON(github.event.merge_group) != '{}' }} | ||
uses: ./.github/workflows/ci.yml | ||
with: | ||
run_sdk_examples: true | ||
secrets: | ||
ENCRYPTED_DOCKER_PASSWORD: ${{ needs.save-docker-login-token.outputs.docker-login-password }} | ||
DOCKER_LOGIN_TOKEN_PASSPHRASE: ${{ secrets.DOCKER_LOGIN_TOKEN_PASSPHRASE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,16 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
rust_version: 1.62.1 | ||
rust_version: 1.66.1 | ||
|
||
name: Release smithy-rs | ||
run-name: ${{ github.workflow }} ${{ inputs.semantic_version }} (${{ inputs.commit_sha }}) - ${{ inputs.dry_run && 'Dry run' || 'Production run' }} | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
commit_sha: | ||
description: | | ||
The SHA of the git commit that you want to release. | ||
description: | | ||
The SHA of the git commit that you want to release. | ||
You must use the non-abbreviated SHA (e.g. b2318b0 won't work!). | ||
required: true | ||
type: string | ||
|
@@ -75,8 +75,8 @@ jobs: | |
# We need `always` here otherwise this job won't run if the previous job has been skipped | ||
# See https://samanpavel.medium.com/github-actions-conditional-job-execution-e6aa363d2867 | ||
if: | | ||
always() && | ||
needs.acquire-base-image.result == 'success' && | ||
always() && | ||
needs.acquire-base-image.result == 'success' && | ||
(needs.release-ci.result == 'success' || needs.release-ci.result == 'skipped') | ||
runs-on: ubuntu-latest | ||
outputs: | ||
|
@@ -87,6 +87,7 @@ jobs: | |
with: | ||
ref: ${{ inputs.commit_sha }} | ||
token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }} | ||
fetch-depth: 0 | ||
- name: Get or create release branch | ||
id: branch-push | ||
shell: bash | ||
|
@@ -112,11 +113,13 @@ jobs: | |
runs-on: ubuntu-latest | ||
outputs: | ||
release_branch: ${{ needs.get-or-create-release-branch.outputs.release_branch }} | ||
commit_sha: ${{ steps.gradle-push.outputs.commit_sha }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.get-or-create-release-branch.outputs.release_branch }} | ||
ref: ${{ inputs.commit_sha }} | ||
path: smithy-rs | ||
fetch-depth: 0 | ||
token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }} | ||
- name: Upgrade gradle.properties | ||
uses: ./smithy-rs/.github/actions/docker-build | ||
|
@@ -131,13 +134,30 @@ jobs: | |
shell: bash | ||
env: | ||
SEMANTIC_VERSION: ${{ inputs.semantic_version }} | ||
RELEASE_COMMIT_SHA: ${{ inputs.commit_sha }} | ||
RELEASE_BRANCH_NAME: ${{ needs.get-or-create-release-branch.outputs.release_branch }} | ||
DRY_RUN: ${{ inputs.dry_run }} | ||
run: | | ||
set -x | ||
# For debugging purposes | ||
git status | ||
# The file was actually changed, we need to commit the changes | ||
git diff-index --quiet HEAD || { git -c 'user.name=AWS SDK Rust Bot' -c '[email protected]' commit gradle.properties --message "Upgrade the smithy-rs runtime crates version to ${SEMANTIC_VERSION}" && git push origin; } | ||
if ! git diff-index --quiet HEAD; then | ||
# gradle.properties was changed, we need to commit and push the diff | ||
git -c 'user.name=AWS SDK Rust Bot' -c '[email protected]' commit gradle.properties --message "Upgrade the smithy-rs runtime crates version to ${SEMANTIC_VERSION}" | ||
# This will fail if we tried to release from a non-HEAD commit on the release branch. | ||
# The only scenario where we would try to release a non-HEAD commit from the release branch is | ||
# to retry a release action execution that failed due to a transient issue. | ||
# In that case, we expect the commit to be releasable as-is, i.e. the runtime crate version in gradle.properties | ||
# should already be the expected one. | ||
git push origin "HEAD:refs/heads/${RELEASE_BRANCH_NAME}" | ||
echo "commit_sha=$(git rev-parse HEAD)" > $GITHUB_OUTPUT | ||
else | ||
echo "commit_sha=${RELEASE_COMMIT_SHA}" > $GITHUB_OUTPUT | ||
fi | ||
release: | ||
name: Release | ||
|
@@ -158,7 +178,7 @@ jobs: | |
- name: Checkout smithy-rs | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.upgrade-gradle-properties.outputs.release_branch }} | ||
ref: ${{ needs.upgrade-gradle-properties.outputs.commit_sha }} | ||
path: smithy-rs | ||
token: ${{ secrets.RELEASE_AUTOMATION_BOT_PAT }} | ||
- name: Generate release artifacts | ||
|
@@ -170,9 +190,20 @@ jobs: | |
- name: Push smithy-rs changes | ||
shell: bash | ||
working-directory: smithy-rs-release/smithy-rs | ||
id: push-changelog | ||
env: | ||
RELEASE_BRANCH_NAME: ${{ needs.upgrade-gradle-properties.outputs.release_branch }} | ||
run: | | ||
echo "Pushing release commits..." | ||
git push origin | ||
if ! git diff-index --quiet HEAD; then | ||
echo "Pushing release commits..." | ||
# This will fail if we tried to release from a non-HEAD commit on the release branch. | ||
# The only scenario where we would try to release a non-HEAD commit from the release branch is | ||
# to retry a release action execution that failed due to a transient issue. | ||
# In that case, we expect the commit to be releasable as-is, i.e. the changelog should have already | ||
# been processed. | ||
git push origin "HEAD:refs/heads/${RELEASE_BRANCH_NAME}" | ||
fi | ||
echo "commit_sha=$(git rev-parse HEAD)" > $GITHUB_OUTPUT | ||
- name: Tag release | ||
uses: actions/github-script@v6 | ||
with: | ||
|
@@ -182,7 +213,8 @@ jobs: | |
await createReleaseScript({ | ||
github, | ||
isDryRun: ${{ inputs.dry_run }}, | ||
releaseManifestPath: "smithy-rs-release/smithy-rs-release-manifest.json" | ||
releaseManifestPath: "smithy-rs-release/smithy-rs-release-manifest.json", | ||
releaseCommitish: "${{ steps.push-changelog.outputs.commit_sha }}" | ||
}); | ||
- name: Publish to crates.io | ||
shell: bash | ||
|
@@ -232,7 +264,7 @@ jobs: | |
shell: bash | ||
run: | | ||
set -eux | ||
# This will fail if other commits have been pushed to `main` after `commit_sha` | ||
# In particular, this will ALWAYS fail if you are creating a new release series from | ||
# a commit that is not the current tip of `main`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,9 @@ target/ | |
|
||
# IDEs | ||
.idea/ | ||
.project | ||
.settings | ||
.classpath | ||
|
||
# tools | ||
.tool-versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.