mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-13 04:39:36 +00:00
Progress reporting through Jenkins (#164)
* Progress reporting through Jenkins * Update progress.py Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
This commit is contained in:
parent
88946f303b
commit
e3dc47efe7
2 changed files with 42 additions and 17 deletions
9
Jenkinsfile
vendored
9
Jenkinsfile
vendored
|
@ -15,6 +15,15 @@ pipeline {
|
|||
sh 'make -j`nproc`'
|
||||
}
|
||||
}
|
||||
stage('Report Progress') {
|
||||
when {
|
||||
branch 'master'
|
||||
}
|
||||
steps {
|
||||
sh 'python3 progress.py -j'
|
||||
sh 'mv build/progress.json /var/www/html/progress.json'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
|
50
progress.py
Normal file → Executable file
50
progress.py
Normal file → Executable file
|
@ -1,15 +1,19 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import argparse
|
||||
import time
|
||||
|
||||
parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.")
|
||||
parser.add_argument("-m", "--matching", dest='matching', action='store_true',
|
||||
help="Output matching progress instead of decompilation progress")
|
||||
parser.add_argument("-j", "--json", dest="json", action="store_true",
|
||||
help="Output results as a json file at build/progress.json")
|
||||
args = parser.parse_args()
|
||||
|
||||
NON_MATCHING_PATTERN = "#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*\"(.*?)\"\s*\).*?#endif"
|
||||
NON_MATCHING_PATTERN = r"#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*\"(.*?)\"\s*\).*?#endif"
|
||||
|
||||
def GetNonMatchingFunctions(files):
|
||||
functions = []
|
||||
|
@ -110,19 +114,31 @@ ovlPct = 100 * ovl / ovlSize
|
|||
compiled_bytes = total
|
||||
bytesPerHeartPiece = compiled_bytes / 80
|
||||
|
||||
adjective = "decompiled" if not args.matching else "matched"
|
||||
|
||||
print(str(total) + " total bytes of decompilable code\n")
|
||||
print(str(src) + " bytes " + adjective + " in src " + str(srcPct) + "%\n")
|
||||
print(str(boot) + "/" + str(bootSize) + " bytes " + adjective + " in boot " + str(bootPct) + "%\n")
|
||||
print(str(code) + "/" + str(codeSize) + " bytes " + adjective + " in code " + str(codePct) + "%\n")
|
||||
print(str(ovl) + "/" + str(ovlSize) + " bytes " + adjective + " in overlays " + str(ovlPct) + "%\n")
|
||||
print("------------------------------------\n")
|
||||
|
||||
heartPieces = int(src / bytesPerHeartPiece)
|
||||
rupees = int(((src % bytesPerHeartPiece) * 100) / bytesPerHeartPiece)
|
||||
|
||||
if (rupees > 0):
|
||||
print("You have " + str(heartPieces) + "/80 heart pieces and " + str(rupees) + " rupee(s).\n")
|
||||
if args.json:
|
||||
timestamp = str(time.time())
|
||||
json_dict = {"reports":{}}
|
||||
json_dict["reports"][timestamp] = {
|
||||
"total_percent": srcPct,
|
||||
"boot_percent": bootPct,
|
||||
"code_percent": codePct,
|
||||
"overlay_percent": ovlPct
|
||||
}
|
||||
with open("build/progress.json", "w", newline="\n") as f:
|
||||
json.dump(json_dict, f)
|
||||
else:
|
||||
print("You have " + str(heartPieces) + "/80 heart pieces.\n")
|
||||
adjective = "decompiled" if not args.matching else "matched"
|
||||
|
||||
print(str(total) + " total bytes of decompilable code\n")
|
||||
print(str(src) + " bytes " + adjective + " in src " + str(srcPct) + "%\n")
|
||||
print(str(boot) + "/" + str(bootSize) + " bytes " + adjective + " in boot " + str(bootPct) + "%\n")
|
||||
print(str(code) + "/" + str(codeSize) + " bytes " + adjective + " in code " + str(codePct) + "%\n")
|
||||
print(str(ovl) + "/" + str(ovlSize) + " bytes " + adjective + " in overlays " + str(ovlPct) + "%\n")
|
||||
print("------------------------------------\n")
|
||||
|
||||
heartPieces = int(src / bytesPerHeartPiece)
|
||||
rupees = int(((src % bytesPerHeartPiece) * 100) / bytesPerHeartPiece)
|
||||
|
||||
if (rupees > 0):
|
||||
print("You have " + str(heartPieces) + "/80 heart pieces and " + str(rupees) + " rupee(s).\n")
|
||||
else:
|
||||
print("You have " + str(heartPieces) + "/80 heart pieces.\n")
|
||||
|
|
Loading…
Reference in a new issue