Skip to content

Commit 57238f9

Browse files
committed
use workflow from repotools
1 parent 15169f8 commit 57238f9

File tree

3 files changed

+84
-121
lines changed

3 files changed

+84
-121
lines changed

.github/actions/workflow-metrics/action.yml

Lines changed: 0 additions & 100 deletions
This file was deleted.

.github/workflows/codebuild-ci.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ jobs:
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'

.github/workflows/continuous-integration.yml

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ jobs:
3131
- 17
3232
- 21
3333
steps:
34-
- name: Set start time
35-
run: echo "WORKFLOW_START_TIME=$(date +%s)" >> $GITHUB_ENV
34+
- name: Set start timestamp
35+
id: start
36+
run: printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
3637
- name: Checkout sources
3738
uses: actions/checkout@v4
3839
with:
@@ -50,9 +51,24 @@ jobs:
5051
pwd
5152
ls -lsa
5253
./gradlew -Ptest.java.version=${{ matrix.java-version }} jvmTest --stacktrace
53-
- name: Upload metrics
54-
if: always()
55-
uses: ./aws-sdk-kotlin/.github/actions/workflow-metrics
54+
- name: Calculate duration
55+
id: end
56+
run: |
57+
printf -v now '%(%s)T'
58+
duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
59+
echo "duration=$duration" >> "$GITHUB_OUTPUT"
60+
- name: Emit metrics
61+
if: always() # run this step even if previous steps failed or the job is canceled
62+
uses: aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
63+
with:
64+
namespace: CI Metrics
65+
dimensions: |
66+
Product=aws-sdk-kotlin
67+
JobName=${{ github.job }}(${{ matrix.java-version }})
68+
Branch=${{ github.base_ref || github.ref_name }}
69+
metrics: |
70+
WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
71+
WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
5672
- name: Save Test Reports
5773
if: failure()
5874
uses: actions/upload-artifact@v4
@@ -67,9 +83,9 @@ jobs:
6783
matrix:
6884
os: [ ubuntu-latest, macos-latest, windows-latest ]
6985
steps:
70-
- name: Set start time
71-
shell: bash
72-
run: echo "WORKFLOW_START_TIME=$(date +%s)" >> $GITHUB_ENV
86+
- name: Set start timestamp
87+
id: start
88+
run: printf 'timestamp=%(%s)T\n' >> "$GITHUB_OUTPUT"
7389
- name: Checkout sources
7490
uses: actions/checkout@v4
7591
with:
@@ -109,9 +125,24 @@ jobs:
109125
./gradlew apiCheck
110126
./gradlew test jvmTest
111127
./gradlew testAllProtocols
112-
- name: Upload metrics
113-
if: always()
114-
uses: ./aws-sdk-kotlin/.github/actions/workflow-metrics
128+
- name: Calculate duration
129+
id: end
130+
run: |
131+
printf -v now '%(%s)T'
132+
duration=$(( now - ${{ steps.start.outputs.timestamp }} ))
133+
echo "duration=$duration" >> "$GITHUB_OUTPUT"
134+
- name: Emit metrics
135+
if: always() # run this step even if previous steps failed or the job is canceled
136+
uses: aws/aws-kotlin-repo-tools/.github/actions/emit-metrics@main
137+
with:
138+
namespace: CI Metrics
139+
dimensions: |
140+
Product=aws-sdk-kotlin
141+
JobName=${{ github.job }}(${{ matrix.os }})
142+
Branch=${{ github.base_ref || github.ref_name }}
143+
metrics: |
144+
WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
145+
WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
115146
- name: Save Test Reports
116147
if: failure()
117148
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)