Skip to content

chore: track artifact sizes #1

chore: track artifact sizes

chore: track artifact sizes #1

name: Artifact Size Check
on:
pull_request:
branches: [ main ]
release:
types: [ published ]
permissions:
id-token: write
contents: read
pull-requests: write
concurrency:
group: ci-artifact-size-check-${{ github.ref }}
cancel-in-progress: true
env:
BOOTSTRAP_SERVICES: +s3,+dynamodb,+sts,+polly
jobs:
check-sizes:
if: ${{ github.event_name == "pull_request" }}

Check failure on line 23 in .github/workflows/artifact-size-check.yml

View workflow run for this annotation

GitHub Actions / Artifact Size Check

Invalid workflow file

The workflow is not valid. .github/workflows/artifact-size-check.yml (Line: 23, Col: 9): Unexpected symbol: '"pull_request"'. Located at position 22 within expression: github.event_name == "pull_request" .github/workflows/artifact-size-check.yml (Line: 53, Col: 9): Unexpected symbol: '"release"'. Located at position 22 within expression: github.event_name == "release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check artifact sizes
run: |
./gradlew :codegen:sdk:bootstrap -Paws.services=${{ env.BOOTSTRAP_SERVICES }}
./gradlew artifactMetrics
- 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: Compare metrics
run: |
./gradlew checkArtifactMetrics
- name: Publish PR comment
uses: actions/github-script@v7
with:
script: |
const fs = require('node:fs');
const content = fs.readFileSync('./build/reports/metrics/artifact-summary.md');
await github.rest.issues.createComment({
issue_number: ${{ github.event.number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: content,
});
publish-metrics:
if: ${{ github.event_name == "release" }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check artifact sizes
run: |
./gradlew :codegen:sdk:bootstrap -Paws.services=${{ env.BOOTSTRAP_SERVICES }}
./gradlew artifactMetrics
- 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: Publish new metrics
run: |
aws --region us-west-2 cloudwatch put-metric-data --namespace "AwsSdkKotlin/ArtifactMetrics" --metric-data file://build/reports/metrics/artifacts.json