88 pull_request :
99 workflow_dispatch :
1010
11- permissions : { }
11+ permissions :
12+ id-token : write
13+ contents : read
1214
1315# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
1416concurrency :
3335 - 17
3436 - 21
3537 steps :
38+ - name : Set start timestamp
39+ id : start
40+ run : printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
3641 - name : Checkout sources
3742 uses : actions/checkout@v4
3843 - name : Configure JDK
@@ -41,12 +46,38 @@ jobs:
4146 distribution : ' corretto'
4247 java-version : 17
4348 cache : ' gradle'
49+ - name : Configure AWS Credentials
50+ uses : aws-actions/configure-aws-credentials@v4
51+ with :
52+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
53+ aws-region : us-west-2
54+ - name : Setup kat
55+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
4456 - name : Configure Gradle
4557 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
4658 - name : Test
4759 shell : bash
4860 run : |
4961 ./gradlew -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace
62+ - name : Calculate duration
63+ id : end
64+ if : always()
65+ run : |
66+ printf -v now '%(%s)T'
67+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
68+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
69+ - name : Emit metrics
70+ if : always() # run this step even if previous steps failed or the job is canceled
71+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
72+ with :
73+ namespace : CI Metrics
74+ dimensions : |
75+ Product=smithy-kotlin
76+ JobName=${{ github.job }}(${{ matrix.java-version }})
77+ Branch=${{ github.base_ref || github.ref_name }}
78+ metrics : |
79+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
80+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
5081
5182 all-platforms :
5283 runs-on : ${{ matrix.os }}
5586 matrix :
5687 os : [ ubuntu-latest, macos-latest, windows-latest ]
5788 steps :
89+ - name : Set start timestamp
90+ id : start
91+ shell : bash
92+ run : echo "timestamp=$(date +%s)" >> "$GITHUB_OUTPUT"
5893 - name : Checkout sources
5994 uses : actions/checkout@v4
6095 - name : Configure JDK
6398 distribution : ' corretto'
6499 java-version : 17
65100 cache : ' gradle'
101+ - name : Configure AWS Credentials
102+ uses : aws-actions/configure-aws-credentials@v4
103+ with :
104+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
105+ aws-region : us-west-2
106+ - name : Setup kat
107+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
66108 - name : Configure Gradle
67109 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
68110 - name : Test
@@ -71,6 +113,26 @@ jobs:
71113 echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
72114 ./gradlew apiCheck
73115 ./gradlew test jvmTest
116+ - name : Calculate duration
117+ id : end
118+ if : always()
119+ shell : bash
120+ run : |
121+ now=$(date +%s)
122+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
123+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
124+ - name : Emit metrics
125+ if : always() # run this step even if previous steps failed or the job is canceled
126+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
127+ with :
128+ namespace : CI Metrics
129+ dimensions : |
130+ Product=smithy-kotlin
131+ JobName=${{ github.job }}(${{ matrix.os }})
132+ Branch=${{ github.base_ref || github.ref_name }}
133+ metrics : |
134+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
135+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
74136 - name : Save Test Reports
75137 if : failure()
76138 uses : actions/upload-artifact@v4
81143 protocol-tests :
82144 runs-on : ubuntu-latest
83145 steps :
146+ - name : Set start timestamp
147+ id : start
148+ run : printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
84149 - name : Checkout sources
85150 uses : actions/checkout@v4
86151 - name : Configure JDK
@@ -89,17 +154,46 @@ jobs:
89154 distribution : ' corretto'
90155 java-version : 17
91156 cache : ' gradle'
157+ - name : Configure AWS Credentials
158+ uses : aws-actions/configure-aws-credentials@v4
159+ with :
160+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
161+ aws-region : us-west-2
162+ - name : Setup kat
163+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
92164 - name : Configure Gradle
93165 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
94166 - name : Test
95167 shell : bash
96168 run : |
97169 ./gradlew publishToMavenLocal
98170 ./gradlew testAllProtocols
171+ - name : Calculate duration
172+ id : end
173+ if : always()
174+ run : |
175+ printf -v now '%(%s)T'
176+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
177+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
178+ - name : Emit metrics
179+ if : always() # run this step even if previous steps failed or the job is canceled
180+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
181+ with :
182+ namespace : CI Metrics
183+ dimensions : |
184+ Product=smithy-kotlin
185+ JobName=${{ github.job }}
186+ Branch=${{ github.base_ref || github.ref_name }}
187+ metrics : |
188+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
189+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
99190
100191 downstream :
101192 runs-on : ubuntu-latest
102193 steps :
194+ - name : Set start timestamp
195+ id : start
196+ run : printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
103197 - name : Checkout sources
104198 uses : actions/checkout@v4
105199 with :
@@ -118,6 +212,13 @@ jobs:
118212 # smithy-kotlin is checked out as a sibling dir which will automatically make it an included build
119213 path : ' aws-sdk-kotlin'
120214 repository : ' aws/aws-sdk-kotlin'
215+ - name : Configure AWS Credentials
216+ uses : aws-actions/configure-aws-credentials@v4
217+ with :
218+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
219+ aws-region : us-west-2
220+ - name : Setup kat
221+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
121222 - name : Configure Gradle - smithy-kotlin
122223 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
123224 with :
@@ -149,4 +250,23 @@ jobs:
149250 sed -i "s/smithy-kotlin-codegen-version = .*$/smithy-kotlin-codegen-version = \"$SMITHY_KOTLIN_CODEGEN_VERSION\"/" gradle/libs.versions.toml
150251 ./gradlew --parallel publishToMavenLocal
151252 ./gradlew test jvmTest
152- ./gradlew testAllProtocols
253+ ./gradlew testAllProtocols
254+ - name : Calculate duration
255+ id : end
256+ if : always()
257+ run : |
258+ printf -v now '%(%s)T'
259+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
260+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
261+ - name : Emit metrics
262+ if : always() # run this step even if previous steps failed or the job is canceled
263+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
264+ with :
265+ namespace : CI Metrics
266+ dimensions : |
267+ Product=smithy-kotlin
268+ JobName=${{ github.job }}
269+ Branch=${{ github.base_ref || github.ref_name }}
270+ metrics : |
271+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
272+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
0 commit comments