-
Notifications
You must be signed in to change notification settings - Fork 50
81 lines (75 loc) · 2.42 KB
/
artifact-size-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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
BOOTSTRAP_SERVICES: +s3
jobs:
check-sizes:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
cache: 'gradle'
- 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: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
cache: 'gradle'
- 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