-
Notifications
You must be signed in to change notification settings - Fork 0
/
benkins.py
executable file
·39 lines (31 loc) · 1.1 KB
/
benkins.py
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
#!/usr/bin/env python3
import platform
import subprocess
def fail(msg):
print(msg)
with open('benkins-notification.txt', 'w') as f:
f.write(msg)
exit(1)
gradle = "./gradlew"
if platform.system() == "Windows":
gradle = "gradlew.bat"
try:
subprocess.run(["pip3", "install", "-r", "requirements-benkins.txt"])
except subprocess.CalledProcessError as e:
fail("Failed to install Python dependencies.")
try:
subprocess.run([gradle, "build"], check=True)
except subprocess.CalledProcessError as e:
fail("Failed to compile code. See the logs for more details.")
try:
subprocess.run([gradle, "test"], check=True)
except subprocess.CalledProcessError as e:
fail("Tests failed. See the logs for more details.")
# try:
# subprocess.run([gradle, "deploy"], check=True)
# except subprocess.CalledProcessError as e:
# fail("Failed to deploy code to the roboRIO. See the logs for more details.")
# try:
# subprocess.run(["python3", "benkins-deploy-wait.py"], timeout=30, check=True)
# except:
# fail("Robot did not boot successfully. See the logs for more details.")