Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 44 additions & 5 deletions .github/workflows/release-readiness.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release readiness (snapshot dependency)

# Makes sure that we aren't relying on SNAPSHOT/dev versions of smithy-kotlin before merging
# Otherwise we could forget because the rest of CI is masking it
description: >
Makes sure that we aren't relying on SNAPSHOT/dev versions of smithy-kotlin before merging
otherwise we could forget because the rest of CI is masking it.

on:
pull_request:
Expand All @@ -11,22 +11,61 @@ jobs:
release-readiness:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
- name: Checkout source
uses: actions/checkout@v4
with:
path: 'aws-sdk-kotlin'
ref: '${{ github.head_ref }}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this configuration necessary? I think it's the default behavior:

When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, when I was testing and making changes before, git branch --show-current was failing because the default behavior is to checkout a commit only not the whole branch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using git branch --show-current can't you just use the GITHUB_HEAD_REF environment variable that's set by default? https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables

fetch-depth: 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to fetch all history rather than the default (1)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this, I don't think it matters. This is left over from testing. I'll remove it and see if the workflow still works.


- name: Configure Gradle
uses: awslabs/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
with:
working-directory: ./aws-sdk-kotlin

- name: Build SDK
working-directory: ./aws-sdk-kotlin
run: ./gradlew test jvmTest

- name: Build SDK client
working-directory: ./aws-sdk-kotlin
run: |
./gradlew -Paws.kotlin.native=false -Paws.services=s3 bootstrap
./gradlew -Paws.kotlin.native=false build

- name: Checkout smithy-kotlin
uses: awslabs/aws-kotlin-repo-tools/.github/actions/checkout-head@main
with:
path: 'smithy-kotlin'
repository: 'smithy-lang/smithy-kotlin'

- name: Check for smithy-kotlin unreleased changes
run: |
cd aws-sdk-kotlin
SDK_BRANCH=$(git branch --show-current)
echo "aws-sdk-kotlin branch: $SDK_BRANCH"

cd ../smithy-kotlin
SMITHY_KOTLIN_BRANCH=$(git branch --show-current)
echo "smithy-kotlin branch: $SMITHY_KOTLIN_BRANCH"

if [ "$SDK_BRANCH" == "$SMITHY_KOTLIN_BRANCH" ]; then
cd ../aws-sdk-kotlin
git fetch origin

DIFF=$(git diff origin/main -- gradle/libs.versions.toml | grep '^[-+][^-+]'; exit 0)
SMITHY_KOTLIN_VERSION_BUMP=$(echo "$DIFF" | grep "smithy-kotlin-runtime-version =\|smithy-kotlin-codegen-version ="; exit 0)

if [ -z "$SMITHY_KOTLIN_VERSION_BUMP" ]; then
echo "::error::Matching smithy-kotlin and aws-sdk-kotlin branches but no smithy-kotlin version bump"
exit 1
else
echo "::warning::Matching smithy-kotlin and aws-sdk-kotlin branches with smithy-kotlin version bump detected"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a small chance someone makes a change to the smithy version lines that's not a version bump, and a warning could help someone debug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a strong opinion but I think if there's matching smithy-kotlin and aws-sdk-kotlin branches, and we do a version bump, that's expected behavior and shouldn't be a warning?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this should be info.

fi
fi

- name: Emit error message
if: ${{ failure() }}
run: |
echo "::error ::Build failed. Did you forget to release smithy-kotlin and bump the dependency version?"
echo "::error::Did you forget to release smithy-kotlin and bump the dependency version?"
exit 1
Loading