diff --git a/.CI/Jenkinsfile b/.CI/Jenkinsfile index 8dbd48b..61aaaee 100644 --- a/.CI/Jenkinsfile +++ b/.CI/Jenkinsfile @@ -477,7 +477,7 @@ pipeline { PGPASSFILE = credentials('omdb-pgpass') } steps { - sh 'rm -rf *.html history' + sh 'rm -rf *.html history pending-reports.json' sh ''' if ! test -d OpenModelica; then git clone https://openmodelica.org/git-readonly/OpenModelica.git @@ -490,6 +490,12 @@ pipeline { sh "./all-reports.py --email --omcgitdir=OpenModelica ${env.GITBRANCHES} ${env.GITBRANCHES_FMI} ${env.GITBRANCHES_NEWINST} ${env.GITBRANCHES_DAE} ${env.GITBRANCHES_NEWBACKEND_DAE} ${env.GITBRANCHES_CPP} ${env.GITBRANCHES_WASM_JIT} ${env.GITBRANCHES_C_PLUS_RUST} conversion heavy_tests generateSymbolicJacobian gbode cvode ida" sh "./all-plots.py ${env.GITBRANCHES} ${env.GITBRANCHES_FMI} ${env.GITBRANCHES_NEWINST} ${env.GITBRANCHES_DAE} ${env.GITBRANCHES_NEWBACKEND_DAE} ${env.GITBRANCHES_CPP} ${env.GITBRANCHES_WASM_JIT} ${env.GITBRANCHES_C_PLUS_RUST} conversion heavy_tests generateSymbolicJacobian gbode cvode ida" + // Recorded and announced only once they are up: a report the database + // knows about is never generated again, so one that a later failure in + // this stage stops from being uploaded would be lost for good. + sshPublisher(publishers: [sshPublisherDesc(configName: 'LibraryTestingReports', transfers: [sshTransfer(sourceFiles: 'history/**')])]) + sh './publish-reports.py' + sh "./report.py --branches='${env.GITBRANCHES} ${env.GITBRANCHES_WASM_JIT}' configs/conf.json configs/conf-old.json configs/conf-nonstandard.json" sh 'mv overview.html overview-combined.html' sh "./report.py --branches='${env.GITBRANCHES} ${env.GITBRANCHES_WASM_JIT}' configs/conf-old.json" @@ -569,7 +575,7 @@ pipeline { sh 'find overview*.html history -type f | wc -l' sh 'find overview*.html history' - sshPublisher(publishers: [sshPublisherDesc(configName: 'LibraryTestingReports', transfers: [sshTransfer(sourceFiles: 'overview*.html,history/**')])]) + sshPublisher(publishers: [sshPublisherDesc(configName: 'LibraryTestingReports', transfers: [sshTransfer(sourceFiles: 'overview*.html')])]) } } diff --git a/all-reports.py b/all-reports.py index 05a9ce8..4b203cf 100755 --- a/all-reports.py +++ b/all-reports.py @@ -17,6 +17,8 @@ parser.add_argument('--githuburltesting', default="https://github.com/OpenModelica/OpenModelicaLibraryTesting/commit") parser.add_argument('--omcgitdir', default="../OpenModelica/OpenModelica") parser.add_argument('--email', default=False, action='store_true') +parser.add_argument('--pending', default="pending-reports.json", + help="Where to leave this run's reports for publish-reports.py") resultsdb.addArgument(parser) args = parser.parse_args() @@ -30,6 +32,7 @@ githuburltesting = args.githuburltesting omcgitdir = args.omcgitdir doemail = args.email +pendingfile = args.pending if not os.path.exists(omcgitdir): raise Exception("Could not find OpenModelica.git directory, set it with --omcgitdir. Tried: %s" % omcgitdir) @@ -136,17 +139,16 @@ def renderEntry(branch, entry): def renderIndex(branch, entries, preamble): return "".join(line + "\n" for line in preamble + [renderEntry(branch, e) for e in entries]) +# The reports generated by this run. A row in [history] means the report is +# never generated again, so publish-reports.py writes them once they are up. +pending_entries = {} + def storedEntries(branch): - """The reports the database has for a branch, oldest first.""" - return [tuple(row) for row in cursor.execute( + """The reports there are for a branch, oldest first.""" + stored = [tuple(row) for row in cursor.execute( "SELECT date1,date2,fname,improved,regressions,perfimproved,perfregressions " "FROM history WHERE %s ORDER BY date1,date2" % db.likeNoCase("branch"), (branch,))] - -def storeEntries(branch, entries): - for entry in entries: - cursor.execute("INSERT INTO history (branch,date1,date2,fname,improved,regressions," - "perfimproved,perfregressions) VALUES (?,?,?,?,?,?,?,?)", (branch,) + entry) - db.commit() + return sorted(stored + pending_entries.get(branch, [])) historyRootServed = None @@ -214,7 +216,7 @@ def historyOf(branch, nruns): missing = [e for e in entries if (e[0], e[1]) not in known] if missing: print("Copying %d reports of %s from its index into the database" % (len(missing), branch)) - storeEntries(branch, missing) + db.insertHistory(branch, missing) stored = sorted(stored + missing) inindex = set((e[0], e[1]) for e in entries) onlyStored = [e for e in stored if (e[0], e[1]) not in inindex] @@ -412,7 +414,7 @@ def historyOf(branch, nruns): os.makedirs(historydir, exist_ok=True) with codecs.open(fname, "w", encoding="utf-8") as fout: fout.write(tpl) - storeEntries(branch, [entry]) + pending_entries.setdefault(branch, []).append(entry) reports = sorted(reports + [entry]) # The index is written whenever it does not already say what the database @@ -425,45 +427,10 @@ def historyOf(branch, nruns): with codecs.open(historyindex, "w", encoding="utf-8") as fout: fout.write(index) -if not doemail: - # We are done - sys.exit(0) - -# OK; send the emails :D -import smtplib - -from email.message import EmailMessage -from email.headerregistry import Address -from email.utils import make_msgid - -missing_plain = "" -missing_html = "" -if missing_branches: - missing_plain = ", ".join(missing_branches) - missing_plain = "Report asks for missing branches which we ignored: %s\n" % missing_plain - missing_html = ("%s %s %s" % ("
", missing_plain, "
- - -%s -The following reports contain regressions your account was involved with:
-%s - -