@@ -8,7 +8,7 @@ issue_number=1124
88title=" Speed up test times :rocket:"
99workflow=Tests
1010latest_id=$( gh run list --workflow $workflow --status success --limit 1 --json databaseId --jq ' .[0].databaseId' )
11- jobs=$( gh api /repos/$owner /$repo /actions/runs/$latest_id /jobs --jq ' .jobs | map({name: .name, run_id: .run_id, id: .id})' )
11+ jobs=$( gh api /repos/$owner /$repo /actions/runs/$latest_id /jobs --jq ' .jobs | map({name: .name, run_id: .run_id, id: .id, started_at: .started_at, completed_at: .completed_at })' )
1212
1313# Skip 3.10, float32, and Benchmark tests
1414function skip_job() {
@@ -34,11 +34,31 @@ function remove_prefix() {
3434 echo $name | sed -e ' s/^ubuntu-latest test py3.12 : fast-compile 0 : float32 0 : //'
3535}
3636
37+ function human_readable_time() {
38+ started_at=$1
39+ completed_at=$2
40+
41+ start_seconds=$( date -d " $started_at " +%s)
42+ end_seconds=$( date -d " $completed_at " +%s)
43+
44+ seconds=$(( $end_seconds - $start_seconds ))
45+
46+ if [ $seconds -lt 60 ]; then
47+ echo " $seconds seconds"
48+ else
49+ echo " $( date -u -d @$seconds +' %-M minutes %-S seconds' ) "
50+ fi
51+ }
52+
3753all_times=" "
3854echo " $jobs " | jq -c ' .[]' | while read -r job; do
3955 id=$( echo $job | jq -r ' .id' )
4056 name=$( echo $job | jq -r ' .name' )
4157 run_id=$( echo $job | jq -r ' .run_id' )
58+ started_at=$( echo $job | jq -r ' .started_at' )
59+ completed_at=$( echo $job | jq -r ' .completed_at' )
60+
61+ human_readable=$( human_readable_time $started_at $completed_at )
4262
4363 if skip_job $name ; then
4464 echo " Skipping $name "
@@ -56,9 +76,13 @@ echo "$jobs" | jq -c '.[]' | while read -r job; do
5676
5777 echo $times
5878
79+ human_readable=$( human_readable_time $started_at $completed_at )
80+
81+ echo $human_readable
82+
5983 name=$( remove_prefix $name )
6084
61- top=" <details><summary>$name </summary>\n\n\n\`\`\` "
85+ top=" <details><summary>( $human_readable ) $name </summary>\n\n\n\`\`\` "
6286 bottom=" \`\`\` \n\n</details>"
6387
6488 formatted_times=" $top \n$times \n$bottom "
0 commit comments