-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
executable file
·86 lines (73 loc) · 2.23 KB
/
update.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#! /bin/bash
#
# Copyright © 2013-2023 Graphia Technologies Ltd.
#
# This file is part of Graphia.
#
# Graphia is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Graphia is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Graphia. If not, see <http://www.gnu.org/licenses/>.
#
while getopts 'b:l:m:h' opt
do
case "$opt" in
b)
BRANCH="${OPTARG}"
;;
l)
LOGS="${OPTARG}"
;;
m)
MESSAGE="${OPTARG}"
;;
?|h)
echo "Usage: $(basename $0) [-b branch] [-l logs directory] [-m commit message]"
exit 1
;;
esac
done
shift "$(($OPTIND -1))"
if [[ -z "$BRANCH" ]]
then
echo Branch name not given
exit 2
fi
if [[ -z "$LOGS" ]]
then
echo Logs directory not given
exit 2
fi
if [[ ! -d "$LOGS" ]]
then
echo Logs directory does not exist
exit 2
fi
if [[ -z "$MESSAGE" ]]
then
echo WARNING: Empty commit message
fi
echo "Analysing Logs on branch: ${BRANCH}"
git checkout --track=direct -b ${BRANCH} origin/${BRANCH} || git checkout -b ${BRANCH} || git checkout ${BRANCH}
FILTERS=(".*\/thirdparty\/.*" ".*\/Qt.*" "^\/usr\/.*" ".*\/build\/.*" "^.*graphia\/")
for FILTER in "${FILTERS[@]}"
do
FILTER_ARGUMENTS+="--filter \"${FILTER}\" "
done
echo "# Summary" > README.md
find ${LOGS} -iname "*.log" -print0 | xargs -0 \
./compiler-logs-to-table.pl --summary --markdown ${FILTER_ARGUMENTS} >> README.md
echo "# Details" >> README.md
find ${LOGS} -iname "*.log" -print0 | xargs -0 \
./compiler-logs-to-table.pl --markdown ${FILTER_ARGUMENTS} \
--link "https://github.com/graphia-app/graphia/blame/${BRANCH}/%file#L%line" >> README.md
git add README.md
git diff-index --quiet HEAD || git commit -m "${MESSAGE}" && git push --force --set-upstream origin ${BRANCH}