3535 - 17
3636 - 21
3737 steps :
38- - name : Set start time
39- run : echo "WORKFLOW_START_TIME=$(date +%s)" >> $GITHUB_ENV
38+ - name : Set start timestamp
39+ id : start
40+ run : printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
4041 - name : Checkout sources
4142 uses : actions/checkout@v4
4243 - name : Configure JDK
@@ -45,15 +46,37 @@ jobs:
4546 distribution : ' corretto'
4647 java-version : 17
4748 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
4856 - name : Configure Gradle
4957 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
5058 - name : Test
5159 shell : bash
5260 run : |
5361 ./gradlew -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace
54- - name : Upload metrics
55- if : always()
56- uses : ./.github/actions/workflow-metrics
62+ - name : Calculate duration
63+ id : end
64+ run : |
65+ printf -v now '%(%s)T'
66+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
67+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
68+ - name : Emit metrics
69+ if : always() # run this step even if previous steps failed or the job is canceled
70+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
71+ with :
72+ namespace : CI Metrics
73+ dimensions : |
74+ Product=aws-sdk-kotlin
75+ JobName=${{ github.job }}(${{ matrix.java-version }})
76+ Branch=${{ github.base_ref || github.ref_name }}
77+ metrics : |
78+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
79+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
5780
5881 all-platforms :
5982 runs-on : ${{ matrix.os }}
6285 matrix :
6386 os : [ ubuntu-latest, macos-latest, windows-latest ]
6487 steps :
65- - name : Set start time
88+ - name : Set start timestamp
89+ id : start
6690 shell : bash
67- run : echo "WORKFLOW_START_TIME =$(date +%s)" >> $GITHUB_ENV
91+ run : echo "timestamp =$(date +%s)" >> "$GITHUB_OUTPUT"
6892 - name : Checkout sources
6993 uses : actions/checkout@v4
7094 - name : Configure JDK
7397 distribution : ' corretto'
7498 java-version : 17
7599 cache : ' gradle'
100+ - name : Configure AWS Credentials
101+ uses : aws-actions/configure-aws-credentials@v4
102+ with :
103+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
104+ aws-region : us-west-2
105+ - name : Setup kat
106+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
76107 - name : Configure Gradle
77108 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
78109 - name : Test
@@ -81,9 +112,25 @@ jobs:
81112 echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
82113 ./gradlew apiCheck
83114 ./gradlew test jvmTest
84- - name : Upload metrics
85- if : always()
86- uses : ./.github/actions/workflow-metrics
115+ - name : Calculate duration
116+ id : end
117+ shell : bash
118+ run : |
119+ now=$(date +%s)
120+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
121+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
122+ - name : Emit metrics
123+ if : always() # run this step even if previous steps failed or the job is canceled
124+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
125+ with :
126+ namespace : CI Metrics
127+ dimensions : |
128+ Product=aws-sdk-kotlin
129+ JobName=${{ github.job }}(${{ matrix.os }})
130+ Branch=${{ github.base_ref || github.ref_name }}
131+ metrics : |
132+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
133+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
87134 - name : Save Test Reports
88135 if : failure()
89136 uses : actions/upload-artifact@v4
94141 protocol-tests :
95142 runs-on : ubuntu-latest
96143 steps :
97- - name : Set start time
98- shell : bash
99- run : echo "WORKFLOW_START_TIME=$(date + %s)" >> $GITHUB_ENV
144+ - name : Set start timestamp
145+ id : start
146+ run : printf 'timestamp=%( %s)T\n' >> "$GITHUB_OUTPUT"
100147 - name : Checkout sources
101148 uses : actions/checkout@v4
102149 - name : Configure JDK
@@ -105,23 +152,45 @@ jobs:
105152 distribution : ' corretto'
106153 java-version : 17
107154 cache : ' gradle'
155+ - name : Configure AWS Credentials
156+ uses : aws-actions/configure-aws-credentials@v4
157+ with :
158+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
159+ aws-region : us-west-2
160+ - name : Setup kat
161+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
108162 - name : Configure Gradle
109163 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
110164 - name : Test
111165 shell : bash
112166 run : |
113167 ./gradlew publishToMavenLocal
114168 ./gradlew testAllProtocols
115- - name : Upload metrics
116- if : always()
117- uses : ./.github/actions/workflow-metrics
169+ - name : Calculate duration
170+ id : end
171+ run : |
172+ printf -v now '%(%s)T'
173+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
174+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
175+ - name : Emit metrics
176+ if : always() # run this step even if previous steps failed or the job is canceled
177+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
178+ with :
179+ namespace : CI Metrics
180+ dimensions : |
181+ Product=aws-sdk-kotlin
182+ JobName=${{ github.job }}
183+ Branch=${{ github.base_ref || github.ref_name }}
184+ metrics : |
185+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
186+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
118187
119188 downstream :
120189 runs-on : ubuntu-latest
121190 steps :
122- - name : Set start time
123- shell : bash
124- run : echo "WORKFLOW_START_TIME=$(date + %s)" >> $GITHUB_ENV
191+ - name : Set start timestamp
192+ id : start
193+ run : printf 'timestamp=%( %s)T\n' >> "$GITHUB_OUTPUT"
125194 - name : Checkout sources
126195 uses : actions/checkout@v4
127196 with :
@@ -140,6 +209,13 @@ jobs:
140209 # smithy-kotlin is checked out as a sibling dir which will automatically make it an included build
141210 path : ' aws-sdk-kotlin'
142211 repository : ' aws/aws-sdk-kotlin'
212+ - name : Configure AWS Credentials
213+ uses : aws-actions/configure-aws-credentials@v4
214+ with :
215+ role-to-assume : ${{ secrets.CI_AWS_ROLE_ARN }}
216+ aws-region : us-west-2
217+ - name : Setup kat
218+ uses : aws/aws-kotlin-repo-tools/.github/actions/setup-kat@main
143219 - name : Configure Gradle - smithy-kotlin
144220 uses : aws/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
145221 with :
@@ -172,6 +248,21 @@ jobs:
172248 ./gradlew --parallel publishToMavenLocal
173249 ./gradlew test jvmTest
174250 ./gradlew testAllProtocols
175- - name : Upload metrics
176- if : always()
177- uses : ./smithy-kotlin/.github/actions/workflow-metrics
251+ - name: Calculate duration
252+ id: end
253+ run: |
254+ printf -v now '%(%s)T'
255+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
256+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
257+ - name: Emit metrics
258+ if: always() # run this step even if previous steps failed or the job is canceled
259+ uses: aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
260+ with:
261+ namespace: CI Metrics
262+ dimensions: |
263+ Product=aws-sdk-kotlin
264+ JobName=${{ github.job }}
265+ Branch=${{ github.base_ref || github.ref_name }}
266+ metrics: |
267+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
268+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
0 commit comments