Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new gradle plugins for validation model and protocol tests #2176

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
56 changes: 56 additions & 0 deletions .github/workflows/update-gradle-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Get latest smithy gradle plugin version
on:
workflow_dispatch: # on button click
# Uncomment once permissions to create PRs has been added.
schedule:
# Runs every wednesday at 11
- cron: '0 11 * * WED'

jobs:
get-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Fetch latest smithy-gradle-plugin version
id: fetch-latest
run: |
echo "latestSmithyGradle=$( \
curl -sL https://api.github.com/repos/smithy-lang/smithy-gradle-plugin/tags | \
jq -r '.[0].name')" >> $GITHUB_OUTPUT
- name: Get current version
id: get-current
run: |
cat gradle.properties >> $GITHUB_OUTPUT
- name: Check if the current version of smithy-gradle-plugin should be updated
id: update-check
run: |
echo update-required=$( \
[ "${{ steps.get-current.outputs.smithyGradleVersion }}" = "${{ steps.fetch-latest.outputs.latestSmithyGradle }}" ] \
&& echo "false" || echo "true") >> $GITHUB_OUTPUT
- name: Set up new git branch for version bump
id: git-setup
if: steps.update-check.outputs.update-required == 'true'
run: |
git checkout -b "automation/bump-smithy-gradle-version/${{ steps.fetch-latest.outputs.latestSmithyGradle }}"
git config --global user.email "[email protected]"
git config --global user.name "Smithy Automation"
- name: Find and replace gradle version in properties files
id: replace-current-version-properties
if: steps.update-check.outputs.update-required == 'true'
run: |
find . -type f -name 'gradle.properties' \
-exec sed -i "s|smithyGradleVersion=${{ steps.get-current.outputs.smithyGradleVersion }}|smithyGradleVersion=${{ steps.fetch-latest.outputs.latestSmithyGradle }}|g" {} \;
- name: Create PR
if: steps.update-check.outputs.update-required == 'true'
run: |
git add .
git commit -m 'Update smithy-gradle-plugin Version'
git push --set-upstream origin "automation/bump-smithy-gradle-version/${{ steps.fetch-latest.outputs.latestSmithyGradle }}"
gh pr create \
--title "[Automation] smithy-gradle-plugin Version Bump - \`${{ steps.fetch-latest.outputs.latestSmithyGradle }}\`" \
--body "Automated pull request to bump smithy gradle plugin version from ${{ steps.get-current.outputs.smithyGradleVersion }} to ${{ steps.fetch-latest.outputs.latestSmithyGradle }}" \
--base main
echo "PR Created for version bump to ${{ steps.fetch-latest.outputs.latestSmithyGradle }}"
env:
GITHUB_TOKEN: ${{ secrets.PR_TOKEN }}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
org.gradle.parallel=true
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
smithyGradleVersion=0.10.0
8 changes: 6 additions & 2 deletions smithy-aws-protocol-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
id "software.amazon.smithy" version "0.6.0"
id "software.amazon.smithy.gradle.smithy-jar" version "$smithyGradleVersion"
}

description = "Defines protocol tests for AWS HTTP protocols."
Expand All @@ -31,4 +31,8 @@ dependencies {
api project(":smithy-validation-model")
}

tasks["sourcesJar"].dependsOn("smithyBuildJar")
tasks["sourcesJar"].dependsOn("smithyBuild")

smithy {
format.set(false)
}
4 changes: 2 additions & 2 deletions smithy-validation-model/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
id "software.amazon.smithy" version "0.6.0"
id "software.amazon.smithy.gradle.smithy-jar" version "$smithyGradleVersion"
}

description = "This module provides support for validation in Smithy server SDKs"
Expand All @@ -28,4 +28,4 @@ dependencies {
implementation project(path: ":smithy-cli", configuration: "shadow")
}

tasks["sourcesJar"].dependsOn("smithyBuildJar")
tasks["sourcesJar"].dependsOn("smithyBuild")
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ namespace smithy.framework
/// falls outside of the modeled or documented constraints.
@error("client")
structure ValidationException {

/// A summary of the validation failure.
@required
message: String,
message: String

/// A list of specific failures encountered while validating the input.
/// A member can appear in this list more than once if it failed to satisfy multiple constraints.
Expand All @@ -21,7 +20,7 @@ structure ValidationException {
structure ValidationExceptionField {
/// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
@required
path: String,
path: String

/// A detailed description of the validation failure.
@required
Expand Down