1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-13 00:48:00 +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:
Ethan Roseman 2020-05-26 16:36:30 -04:00 committed by GitHub
parent 88946f303b
commit e3dc47efe7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 17 deletions

9
Jenkinsfile vendored
View file

@ -15,6 +15,15 @@ pipeline {
sh 'make -j`nproc`' 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 { post {
always { always {

20
progress.py Normal file → Executable file
View file

@ -1,15 +1,19 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse
import json
import os import os
import re import re
import argparse import time
parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.") parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.")
parser.add_argument("-m", "--matching", dest='matching', action='store_true', parser.add_argument("-m", "--matching", dest='matching', action='store_true',
help="Output matching progress instead of decompilation progress") 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() 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): def GetNonMatchingFunctions(files):
functions = [] functions = []
@ -110,6 +114,18 @@ ovlPct = 100 * ovl / ovlSize
compiled_bytes = total compiled_bytes = total
bytesPerHeartPiece = compiled_bytes / 80 bytesPerHeartPiece = compiled_bytes / 80
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:
adjective = "decompiled" if not args.matching else "matched" adjective = "decompiled" if not args.matching else "matched"
print(str(total) + " total bytes of decompilable code\n") print(str(total) + " total bytes of decompilable code\n")