Skip to content

Instantly share code, notes, and snippets.

@RobertSasak
Last active November 17, 2021 09:14
Show Gist options
  • Save RobertSasak/ecf34c5725c05e8d49f305ebce29c8ad to your computer and use it in GitHub Desktop.
Save RobertSasak/ecf34c5725c05e8d49f305ebce29c8ad to your computer and use it in GitHub Desktop.
Have you ever wonder what build taks takes the longest time?
#!/bin/bash
# Usage appcenterTime.sh /path/to/folder/log/Build
converts()
{
local t=$1
local d=$((t/60/60/24))
local h=$((t/60/60%24))
local m=$((t/60%60))
local s=$((t%60))
if [[ $d > 0 ]]; then
echo -n "${d} "
fi
if [[ $h > 0 ]]; then
echo -n "${h}h "
fi
if [[ $m > 0 ]]; then
echo -n "${m}m "
fi
if [[ $d = 0 && $h = 0 ]]; then
echo -n "${s}s"
fi
echo
}
cd "$1"
for f in *.txt
do
FILE=$(basename "$f")
START=$(head -n 1 "$f" | cut -d. -f1)
STOP=$(tail -n 1 "$f" | cut -d. -f1)
START_DATE=$(date -j -f "%Y-%m-%dT%H:%M:%S" "$START" "+%s")
STOP_DATE=$(date -j -f "%Y-%m-%dT%H:%M:%S" "$STOP" "+%s")
DIFF=$(($STOP_DATE - $START_DATE))
echo -e "$DIFF\t$(converts DIFF)\t$FILE"
done | sort -h
0 0 s 12_Copy source map file to staging.txt
0 0 s 14_Set Xcode path.txt
0 0 s 16_Determine project file path.txt
0 0 s 26_Post-job Xcode build (signed).txt
0 0 s 28_Post-job Install Apple provisioning profile.txt
0 0 s 29_Post-job Install Apple provisioning profile.txt
0 0 s 32_Finalize Job.txt
0 0 s 4_Pre-job Install Apple provisioning profile.txt
0 0 s 8_Post Clone Script.txt
1 1 s 13_Tag build.txt
1 1 s 19_Update Xcode build settings.txt
1 1 s 27_Post-job Install Apple provisioning profile.txt
1 1 s 30_Post-job Install Apple certificate.txt
1 1 s 31_Post-job Checkout @master to s.txt
1 1 s 5_Pre-job Install Apple provisioning profile.txt
2 2 s 3_Pre-job Install Apple provisioning profile.txt
3 3 s 2_Pre-job Install Apple certificate.txt
4 4 s 17_Determine signing style and pods update.txt
4 4 s 18_Set Bundle version.txt
4 4 s 7_Install build scripts.txt
7 7 s 1_Initialize job.txt
7 7 s 9_Select Node.js Version v2.txt
17 17 s 6_Checkout @master to s.txt
168 2 min 11_Generate source map.txt
259 4 min 10_yarnnpm install.txt
262 4 min 15_Pod install.txt
1059 17 min 20_Xcode build (signed).txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment