From 5b2b55e00a71757156ee071dce1d4750b91b2d98 Mon Sep 17 00:00:00 2001 From: 0marperez Date: Fri, 3 Oct 2025 15:29:46 -0400 Subject: [PATCH 1/3] misc: refactor artifact size metrics --- .github/workflows/artifact-size-metrics.yml | 65 --------------------- .github/workflows/pull-request-metrics.yml | 32 ++++++++++ .github/workflows/release-metrics.yml | 29 +++++++++ 3 files changed, 61 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/artifact-size-metrics.yml create mode 100644 .github/workflows/pull-request-metrics.yml create mode 100644 .github/workflows/release-metrics.yml diff --git a/.github/workflows/artifact-size-metrics.yml b/.github/workflows/artifact-size-metrics.yml deleted file mode 100644 index faf45689..00000000 --- a/.github/workflows/artifact-size-metrics.yml +++ /dev/null @@ -1,65 +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 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: - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - steps: - - name: Checkout Sources - uses: actions/checkout@v4 - - 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 -Paws.kotlin.native=false artifactSizeMetrics - - name: Analyze Artifact Size Metrics - run: ./gradlew analyzeArtifactSizeMetrics - - - name: Show Results - uses: aws/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/show-results@main - - - name: Evaluate - if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-artifact-size-increase') }} - 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 00000000..1fc10415 --- /dev/null +++ b/.github/workflows/pull-request-metrics.yml @@ -0,0 +1,32 @@ +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 + ./gradlew publishAllPublicationsToTestLocalRepository + + - name: Calculate metrics + uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/calculate-and-upload@asm-v2 # TODO: Change to main before merging + with: + upload: 'false' + release_metrics: 'false' + + - name: Process metrics + uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/download-and-process@asm-v2 # TODO: Change to main before merging + with: + download: 'false' + +permissions: {} diff --git a/.github/workflows/release-metrics.yml b/.github/workflows/release-metrics.yml new file mode 100644 index 00000000..6ac8f3eb --- /dev/null +++ b/.github/workflows/release-metrics.yml @@ -0,0 +1,29 @@ +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 + ./gradlew publishAllPublicationsToTestLocalRepository + + - name: Calculate and upload metrics + uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/calculate-and-upload@asm-v2 # TODO: Change to main before merging + with: + upload: 'true' + release_metrics: 'true' + +permissions: {} From 753c90f0bbfc958e5b280b930fabe2533998843e Mon Sep 17 00:00:00 2001 From: 0marperez Date: Wed, 8 Oct 2025 13:38:17 -0400 Subject: [PATCH 2/3] feedback --- .github/workflows/pull-request-metrics.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-metrics.yml b/.github/workflows/pull-request-metrics.yml index 1fc10415..1f5434ad 100644 --- a/.github/workflows/pull-request-metrics.yml +++ b/.github/workflows/pull-request-metrics.yml @@ -15,8 +15,8 @@ jobs: - name: Build shell: bash run: | - ./gradlew build - ./gradlew publishAllPublicationsToTestLocalRepository + ./gradlew build --parallel + ./gradlew publishAllPublicationsToTestLocalRepository --parallel - name: Calculate metrics uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/calculate-and-upload@asm-v2 # TODO: Change to main before merging From b272f651bb2bb71f93bb3de14a28e2b64a4b6553 Mon Sep 17 00:00:00 2001 From: 0marperez Date: Wed, 8 Oct 2025 14:08:49 -0400 Subject: [PATCH 3/3] self review --- .github/workflows/release-metrics.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-metrics.yml b/.github/workflows/release-metrics.yml index 6ac8f3eb..fa92461b 100644 --- a/.github/workflows/release-metrics.yml +++ b/.github/workflows/release-metrics.yml @@ -17,8 +17,8 @@ jobs: - name: Build shell: bash run: | - ./gradlew build - ./gradlew publishAllPublicationsToTestLocalRepository + ./gradlew build --parallel + ./gradlew publishAllPublicationsToTestLocalRepository --parallel - name: Calculate and upload metrics uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/calculate-and-upload@asm-v2 # TODO: Change to main before merging