diff --git a/.github/workflows/artifact-size-metrics.yml b/.github/workflows/artifact-size-metrics.yml deleted file mode 100644 index f57dde00b..000000000 --- a/.github/workflows/artifact-size-metrics.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Artifact Size Metrics -on: - pull_request: - types: [ opened, synchronize, reopened, labeled, unlabeled ] - branches: - - main - - '*-main' - release: - types: [published] - -permissions: - id-token: write - contents: read - pull-requests: write - -jobs: - release-metrics: - if: github.event_name == 'release' - runs-on: ubuntu-latest - steps: - - name: Checkout Sources - uses: actions/checkout@v4 - - name: Configure JDK - uses: actions/setup-java@v3 - with: - distribution: 'corretto' - java-version: 17 - cache: 'gradle' - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} - aws-region: us-west-2 - - name: Configure Gradle - uses: aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main - - name: Generate Artifact Size Metrics - run: ./gradlew artifactSizeMetrics - - name: Save Artifact Size Metrics - run: ./gradlew saveArtifactSizeMetrics -Prelease=${{ github.event.release.tag_name }} - - name: Put Artifact Size Metrics in CloudWatch - run: ./gradlew putArtifactSizeMetricsInCloudWatch -Prelease=${{ github.event.release.tag_name }} - size-check: - runs-on: ubuntu-latest - steps: - - name: Checkout Sources - uses: actions/checkout@v4 - with: - path: smithy-kotlin - - - name: Setup build - uses: ./smithy-kotlin/.github/actions/setup-build - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} - aws-region: us-west-2 - - - name: Configure Gradle - uses: aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main - with: - working-directory: smithy-kotlin - - - name: Generate Artifact Size Metrics - run: ./gradlew -Paws.kotlin.native=false artifactSizeMetrics - working-directory: smithy-kotlin - - - name: Analyze Artifact Size Metrics - run: ./gradlew analyzeArtifactSizeMetrics - working-directory: smithy-kotlin - - - name: Show Results - uses: aws/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/show-results@main - with: - working-directory: smithy-kotlin - - - name: Evaluate - if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-artifact-size-increase') }} - working-directory: smithy-kotlin - run: | - cd build/reports/metrics - cat has-significant-change.txt | grep false || { - echo An artifact increased in size by more than allowed or a new artifact was created. - echo If this is expected please add the 'acknowledge-artifact-size-increase' label to this pull request. - exit 1 - } diff --git a/.github/workflows/pull-request-metrics.yml b/.github/workflows/pull-request-metrics.yml new file mode 100644 index 000000000..11c4d6890 --- /dev/null +++ b/.github/workflows/pull-request-metrics.yml @@ -0,0 +1,40 @@ +name: Pull request metrics +on: + pull_request: + +jobs: + artifact-size-metrics: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Configure Gradle + uses: awslabs/aws-kotlin-repo-tools/.github/actions/configure-gradle@main + + - name: Build + shell: bash + run: | + ./gradlew build --parallel + ./gradlew publishAllPublicationsToTestLocalRepository --parallel + + - name: Calculate metrics + uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/calculate-and-upload@main + with: + upload: 'false' + release_metrics: 'false' + + - name: Configure credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + + - name: Process metrics + uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/download-and-process@main + with: + download: 'false' + +permissions: + id-token: write + contents: read diff --git a/.github/workflows/release-metrics.yml b/.github/workflows/release-metrics.yml new file mode 100644 index 000000000..bf9197f14 --- /dev/null +++ b/.github/workflows/release-metrics.yml @@ -0,0 +1,37 @@ +name: Release metrics + +on: + release: + types: [ published ] + +jobs: + artifact-size-metrics: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Configure Gradle + uses: awslabs/aws-kotlin-repo-tools/.github/actions/configure-gradle@main + + - name: Build + shell: bash + run: | + ./gradlew build --parallel + ./gradlew publishAllPublicationsToTestLocalRepository --parallel + + - name: Configure credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + + - name: Calculate and upload metrics + uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/calculate-and-upload@main + with: + upload: 'true' + release_metrics: 'true' + +permissions: + id-token: write + contents: read diff --git a/build.gradle.kts b/build.gradle.kts index 2fcc09c1d..fee4cfaf2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -41,19 +41,12 @@ buildscript { plugins { `dokka-convention` alias(libs.plugins.kotlinx.binary.compatibility.validator) - alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics) // ensure the correct version of KGP ends up on our buildscript classpath // since build-plugins also has version in its dependency closure id(libs.plugins.kotlin.multiplatform.get().pluginId) apply false id(libs.plugins.kotlin.jvm.get().pluginId) apply false } -artifactSizeMetrics { - artifactPrefixes = setOf(":runtime") - significantChangeThresholdPercentage = 5.0 - projectRepositoryName = "smithy-kotlin" -} - val testJavaVersion = typedProp("test.java.version")?.let { JavaLanguageVersion.of(it) }?.also { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a5b616c59..d1e32fa17 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -118,4 +118,3 @@ kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-co kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-version"} aws-kotlin-repo-tools-kmp = { id = "aws.sdk.kotlin.gradle.kmp", version.ref = "aws-kotlin-repo-tools-version" } aws-kotlin-repo-tools-smithybuild = { id = "aws.sdk.kotlin.gradle.smithybuild", version.ref = "aws-kotlin-repo-tools-version" } -aws-kotlin-repo-tools-artifactsizemetrics = { id = "aws.sdk.kotlin.gradle.artifactsizemetrics", version.ref = "aws-kotlin-repo-tools-version" }