44 pull_request :
55 workflow_dispatch :
66
7- permissions : { }
8-
7+ permissions :
8+ id-token : write
9+ contents : read
910# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
1011concurrency :
1112 group : ci-pr-${{ github.ref }}
2930 - 17
3031 - 21
3132 steps :
33+ - name : Set start timestamp
34+ id : start
35+ run : printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
3236 - name : Checkout sources
3337 uses : actions/checkout@v4
3438 with :
@@ -39,13 +43,39 @@ jobs:
3943 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
4044 with :
4145 working-directory : ./aws-sdk-kotlin
46+ - name : Configure AWS Credentials
47+ uses : aws-actions/configure-aws-credentials@v4
48+ with :
49+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
50+ aws-region : us-west-2
51+ - name : Setup kat
52+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
4253 - name : Test
4354 working-directory : ./aws-sdk-kotlin
4455 shell : bash
4556 run : |
4657 pwd
4758 ls -lsa
4859 ./gradlew -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace
60+ - name : Calculate duration
61+ id : end
62+ if : always()
63+ run : |
64+ printf -v now '%(%s)T'
65+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
66+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
67+ - name : Emit metrics
68+ if : always() # run this step even if previous steps failed or the job is canceled
69+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
70+ with :
71+ namespace : CI Metrics
72+ dimensions : |
73+ Product=aws-sdk-kotlin
74+ JobName=${{ github.job }}(${{ matrix.java-version }})
75+ Branch=${{ github.base_ref || github.ref_name }}
76+ metrics : |
77+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
78+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
4979 - name : Save Test Reports
5080 if : failure()
5181 uses : actions/upload-artifact@v4
@@ -60,12 +90,23 @@ jobs:
6090 matrix :
6191 os : [ ubuntu-latest, macos-latest, windows-latest ]
6292 steps :
93+ - name : Set start timestamp
94+ id : start
95+ shell : bash
96+ run : echo "timestamp=$(date +%s)" >> "$GITHUB_OUTPUT"
6397 - name : Checkout sources
6498 uses : actions/checkout@v4
6599 with :
66100 path : ' aws-sdk-kotlin'
67101 - name : Setup Build
68102 uses : ./aws-sdk-kotlin/.github/actions/setup-build
103+ - name : Configure AWS Credentials
104+ uses : aws-actions/configure-aws-credentials@v4
105+ with :
106+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
107+ aws-region : us-west-2
108+ - name : Setup kat
109+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
69110 - name : Configure Gradle - smithy-kotlin
70111 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
71112 with :
@@ -99,6 +140,26 @@ jobs:
99140 ./gradlew apiCheck
100141 ./gradlew test jvmTest
101142 ./gradlew testAllProtocols
143+ - name : Calculate duration
144+ id : end
145+ if : always()
146+ shell : bash
147+ run : |
148+ now=$(date +%s)
149+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
150+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
151+ - name : Emit metrics
152+ if : always() # run this step even if previous steps failed or the job is canceled
153+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
154+ with :
155+ namespace : CI Metrics
156+ dimensions : |
157+ Product=aws-sdk-kotlin
158+ JobName=${{ github.job }}(${{ matrix.os }})
159+ Branch=${{ github.base_ref || github.ref_name }}
160+ metrics : |
161+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
162+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
102163 - name : Save Test Reports
103164 if : failure()
104165 uses : actions/upload-artifact@v4
0 commit comments