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..1f5434ad --- /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 --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 + 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..fa92461b --- /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 --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 + with: + upload: 'true' + release_metrics: 'true' + +permissions: {}