-
Notifications
You must be signed in to change notification settings - Fork 6
/
alacritty_master.sh
executable file
·54 lines (43 loc) · 1.76 KB
/
alacritty_master.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
user="perfbot"
versionfile="./lastversion"
vtebench_path="/home/$user/vtebench"
alacritty_path="/home/$user/alacritty"
output_directory="results/alacritty/master"
# Benchmark the latest Alacritty master.
if [ $EUID -ne 0 ]; then
echo "Error: Must be run as root"
exit 11
fi
if ! id "$user" &> /dev/null; then
echo "Error: User \"$user\" does not exist"
exit 12
fi
# Clone Alacritty if it does not exist yet.
if ! [ -d "$alacritty_path" ]; then
sudo -u $user git clone https://github.com/alacritty/alacritty "$alacritty_path"
fi
# Update to the latest version of Alacritty.
sudo -u $user git -C "$alacritty_path" pull origin master --rebase
# Build the latest version.
sudo -u $user cargo build --release --manifest-path "$alacritty_path/Cargo.toml"
# Check if there has been any new changes.
rustversion=$(sudo -u $user rustc -V)
version=$(echo "$($alacritty_path/target/release/alacritty --version) - $rustversion)")
lastversion=$(cat "$versionfile")
if [ "$lastversion" = "$version" ]; then
echo "No new commits to test"
exit
fi
printf "$version" | sudo -u $user tee "$versionfile"
./bench.sh "$alacritty_path/target/release/alacritty" "$output_directory"
# Update the plots.
mkdir -p "$output_directory/charts/"
"$vtebench_path/gnuplot/summary.sh" $(ls results/alacritty/master/*.dat | tail -n 10) "$output_directory/charts/summary.svg"
"$vtebench_path/gnuplot/detailed.sh" $(ls results/alacritty/master/*.dat | tail -n 3) "$output_directory/charts/"
# Push changes to GitHub.
shorthash=$(sudo -u $user git -C "$alacritty_path" rev-parse --short HEAD)
message=$(echo "Add results for Alacritty master ($shorthash)")
sudo -u $user git add "$versionfile" results/alacritty/master
sudo -u $user git commit -m "$message"
sudo -u $user git push origin master