diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..d55b94e4 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,37 @@ +pipeline { + agent any + + stages { + stage('Setup') { + steps { + echo 'Setting up...' + sh 'cp /usr/local/etc/roms/baserom_tmc.gba baserom.gba' + sh 'make -j setup' + } + } + stage('Build') { + when { + not { + branch 'master' + } + } + steps { + sh 'make -j' + } + } + stage('Report Progress') { + when { + branch 'master' + } + steps { + sh 'python3 progress.py -c >> /var/www/html/reports/progress.csv' + sh 'python3 progress.py -mc >> /var/www/html/reports/progress_matching.csv' + } + } + } + post { + always { + cleanWs() + } + } +} \ No newline at end of file diff --git a/progress.py b/progress.py new file mode 100644 index 00000000..e7a9956b --- /dev/null +++ b/progress.py @@ -0,0 +1,56 @@ + +import csv, git, re + +map = open("tmc.map", "r") + +src = 0 +asm = 0 +srcData = 0 +data = 0 + +for line in map: + reg = re.compile(r"^ \.(\w+)\s+0x[0-9a-f]+\s+(0x[0-9a-f]+) (\w+)\/(.+)\.o") + matches = reg.split(line) + + if (len(matches) < 5): + continue + + section = matches[1] + size = int(matches[2], 16) + direc = matches[3] + basename = matches[4] + + # From original script, not sure what this is doing... + if (size & 3): + size += 4 - (size % 3) + + if (section == "text"): + if (direc == "src"): + src += size + elif (direc == "asm"): + asm += size + elif (section == "rodata"): + if (direc == "src"): + srcData += size + elif (direc == "data"): + data += size + +total = src + asm +dataTotal = srcData + data + +srcPct = "%.4f" % (100 * src / total) +asmPct = "%.4f" % (100 * asm / total) + +srcDataPct = "%.4f" % (100 * srcData / dataTotal) +dataPct = "%.4f" % (100 * data / dataTotal) + +version = 1 +git_object = git.Repo().head.object +timestamp = str(git_object.committed_date) +git_hash = git_object.hexsha + +#################################################### + +csv_list = [str(version), timestamp, git_hash, str(srcPct), str(asmPct), str(srcDataPct), str(dataPct)] + +print(",".join(csv_list)) \ No newline at end of file