4848 macos-compat :
4949 runs-on : macos-latest
5050 steps :
51+ - name : Set start timestamp
52+ id : start
53+ shell : bash
54+ run : echo "timestamp=$(date +%s)" >> "$GITHUB_OUTPUT"
55+
5156 - name : Checkout sources
5257 uses : actions/checkout@v2
5358
@@ -79,10 +84,33 @@ jobs:
7984 - name : Build and Test ${{ env.PACKAGE_NAME }}
8085 run : |
8186 ./gradlew build
87+ - name : Calculate duration
88+ id : end
89+ shell : bash
90+ run : |
91+ now=$(date +%s)
92+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
93+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
94+ - name : Emit metrics
95+ if : always() # run this step even if previous steps failed or the job is canceled
96+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
97+ with :
98+ namespace : CI Metrics
99+ dimensions : |
100+ Product=aws-kotlin-repo-tools
101+ JobName=${{ github.job }}(${{ matrix.os }})
102+ Branch=${{ github.base_ref || github.ref_name }}
103+ metrics : |
104+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
105+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
82106
83107 windows-compat :
84108 runs-on : windows-latest
85109 steps :
110+ - name : Set start timestamp
111+ id : start
112+ shell : bash
113+ run : echo "timestamp=$(date +%s)" >> "$GITHUB_OUTPUT"
86114 - name : Checkout sources
87115 uses : actions/checkout@v2
88116
@@ -106,3 +134,23 @@ jobs:
106134 - name : Build and Test ${{ env.PACKAGE_NAME }}
107135 run : |
108136 ./gradlew build
137+
138+ - name : Calculate duration
139+ id : end
140+ shell : bash
141+ run : |
142+ now=$(date +%s)
143+ duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
144+ echo "duration=$duration" >> "$GITHUB_OUTPUT"
145+ - name : Emit metrics
146+ if : always() # run this step even if previous steps failed or the job is canceled
147+ uses : aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
148+ with :
149+ namespace : CI Metrics
150+ dimensions : |
151+ Product=aws-kotlin-repo-tools
152+ JobName=${{ github.job }}(${{ matrix.os }})
153+ Branch=${{ github.base_ref || github.ref_name }}
154+ metrics : |
155+ WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
156+ WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
0 commit comments