Skip to content

Commit 8cfe0f2

Browse files
committed
ci: add total duration metric to C1 workflow
1 parent 0ef27c7 commit 8cfe0f2

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/c1-baseline.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
- name: Prepare results CSV
2525
run: |
2626
mkdir -p analysis/raw
27+
echo "WORKFLOW_START_SECONDS=$(date +%s)" >> "$GITHUB_ENV"
28+
echo "WORKFLOW_START_TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_ENV"
2729
echo "scenario,run_id,run_number,commit_sha,step_name,start_timestamp,end_timestamp,duration_seconds,status" > "$RESULTS_FILE"
2830
2931
- name: Setup Python
@@ -72,6 +74,14 @@ jobs:
7274
./ci/scripts/measure_step.sh "kubernetes_smoke_test" "$RESULTS_FILE" \
7375
bash -c 'kubectl port-forward svc/tcc-api 8000:80 -n app > /tmp/port-forward.log 2>&1 & PF_PID=$!; sleep 5; curl -fsS http://localhost:8000/health; kill $PF_PID'
7476
77+
- name: Append workflow total duration
78+
if: always()
79+
run: |
80+
WORKFLOW_END_TIMESTAMP="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
81+
WORKFLOW_END_SECONDS="$(date +%s)"
82+
WORKFLOW_DURATION_SECONDS=$((WORKFLOW_END_SECONDS - WORKFLOW_START_SECONDS))
83+
echo "${SCENARIO},${GITHUB_RUN_ID},${GITHUB_RUN_NUMBER},${GITHUB_SHA},workflow_total,${WORKFLOW_START_TIMESTAMP},${WORKFLOW_END_TIMESTAMP},${WORKFLOW_DURATION_SECONDS},success" >> "$RESULTS_FILE"
84+
7585
- name: Show collected metrics
7686
if: always()
7787
run: |

0 commit comments

Comments
 (0)