4545 steps :
4646 - name : Checkout sources
4747 uses : actions/checkout@v2
48- - name : Set start time
49- run : echo "WORKFLOW_START_TIME=$(date +%s)" >> $GITHUB_ENV
48+ - name : Set start timestamp
49+ id : start
50+ run : printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
5051 - name : Verify PRs are not running malicious code
5152 if : ${{ (inputs.aws-sdk-kotlin-pr != '' || inputs.smithy-kotlin-pr != '') && inputs.check-pr == false }}
5253 run : |
@@ -72,16 +73,32 @@ jobs:
7273 echo "cancelling in-progress build: id=$BUILD_ID"
7374 aws codebuild stop-build --id $BUILD_ID
7475 fi
75- - name : Upload metrics
76- if : always()
77- uses : ./.github/actions/workflow-metrics
76+ - name : Calculate duration
77+ id : end
78+ run : |
79+ printf -v now '%(%s)T'
80+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
81+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
82+ - name : Emit metrics
83+ if : always() # run this step even if previous steps failed or the job is canceled
84+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
85+ with :
86+ namespace : CI Metrics
87+ dimensions : |
88+ Product=aws-sdk-kotlin
89+ JobName=${{ github.job }}
90+ Branch=${{ github.base_ref || github.ref_name }}
91+ metrics : |
92+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
93+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
7894
7995 service-check-batch-and-artifact-size-metrics :
8096 if : github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
8197 runs-on : ubuntu-latest
8298 steps :
83- - name : Set start time
84- run : echo "WORKFLOW_START_TIME=$(date +%s)" >> $GITHUB_ENV
99+ - name : Set start timestamp
100+ id : start
101+ run : printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
85102 - name : Verify PRs are not running malicious code
86103 if : ${{ (inputs.aws-sdk-kotlin-pr != '' || inputs.smithy-kotlin-pr != '') && inputs.check-pr == false }}
87104 run : |
@@ -164,9 +181,24 @@ jobs:
164181 echo If this is expected please add the 'acknowledge-artifact-size-increase' label to this pull request.
165182 exit 1
166183 }
167- - name : Upload metrics
168- if : always()
169- uses : ./.github/actions/workflow-metrics
184+ - name : Calculate duration
185+ id : end
186+ run : |
187+ printf -v now '%(%s)T'
188+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
189+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
190+ - name : Emit metrics
191+ if : always() # run this step even if previous steps failed or the job is canceled
192+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
193+ with :
194+ namespace : CI Metrics
195+ dimensions : |
196+ Product=aws-sdk-kotlin
197+ JobName=${{ github.job }}
198+ Branch=${{ github.base_ref || github.ref_name }}
199+ metrics : |
200+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
201+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
170202
171203 release-artifact-size-metrics :
172204 if : github.event_name == 'release'
0 commit comments