forked from Spyderzz/Userbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCI_Test_Script.sh
83 lines (67 loc) · 1.77 KB
/
CI_Test_Script.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
#!/bin/bash
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
# CI Runner Script for baalajimaestro's userbot
# We need this directive
# shellcheck disable=1090
. "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"/telegram
PARSE_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
PARSE_ORIGIN="$(git config --get remote.origin.url)"
COMMIT_POINT="$(git log --pretty=format:'%h : %s' -1)"
COMMIT_HASH="$(git rev-parse --verify HEAD)"
TELEGRAM_TOKEN=${BOT_API_KEY}
export BOT_API_KEY PARSE_BRANCH PARSE_ORIGIN COMMIT_POINT TELEGRAM_TOKEN
kickstart_pub
req_install() {
pip3 install -r requirements.txt
}
get_session() {
curl -sLo userbot.session "$PULL_LINK"
}
test_run() {
python3 -m userbot test
STATUS=${?}
export STATUS
}
# Nuke Trap, coz it not working
tg_senderror() {
tg_sendinfo "<code>Build Throwing Error(s)</code>" \
"@baalajimaestro @raphielscape @MrYacha please look in!" \
"Logs: https://semaphoreci.com/baalajimaestro/telegram-userbot"
[ -n "${STATUS}" ] &&
exit "${STATUS}" ||
exit 1
}
tg_yay() {
tg_sendinfo "<code>Compilation Success!</code>"
}
# Fin Prober
fin() {
echo "Yay! My works took $((DIFF / 60)) minute(s) and $((DIFF % 60)) seconds.~"
tg_yay
}
finerr() {
echo "My works took $((DIFF / 60)) minute(s) and $((DIFF % 60)) seconds but it's error..."
tg_senderror
[ -n "${STATUS}" ] &&
exit "${STATUS}" ||
exit 1
}
execute() {
BUILD_START=$(date +"%s")
req_install
test_run
BUILD_END=$(date +"%s")
DIFF=$((BUILD_END - BUILD_START))
if [ $STATUS -eq 0 ];
then
fin
else
finerr
fi
}
get_session
execute