diff --git a/.CI/Jenkinsfile b/.CI/Jenkinsfile index f307911..28c2c7e 100644 --- a/.CI/Jenkinsfile +++ b/.CI/Jenkinsfile @@ -150,9 +150,13 @@ pipeline { fi """ // One build of omc per pull request is kept, as for a branch, and they - // accumulate: a pull request is tested once and never again. - sh 'find "$HOME/saved_omc" -maxdepth 1 -name "pr-*" -type d -mtime +14 -exec rm -rf {} ";" || true' - runRegressiontest("pr-${pullRequest()}", "pr-${pullRequest()}", '', '', false, '', '', false, false, 0, params.pull_request_config ?: 'configs/conf.json') + // accumulate: a pull request is tested once and never again. The + // second line is the layout of the runs before they moved under pr/. + sh ''' + find "$HOME/saved_omc/pr" -mindepth 1 -maxdepth 1 -type d -mtime +14 -exec rm -rf {} ";" 2> /dev/null || true + find "$HOME/saved_omc" -mindepth 1 -maxdepth 1 -name "pr-*" -type d -mtime +14 -exec rm -rf {} ";" || true + ''' + runRegressiontest("pr/${pullRequest()}", "pr/${pullRequest()}", '', '', false, '', '', false, false, 0, params.pull_request_config ?: 'configs/conf.json') } } @@ -910,7 +914,7 @@ def runRegressiontest(branch, name, extraFlags, omsHash, omcompiler, extrasimfla // head one, since the question is what happens once it is merged, and it is // checked out detached so that nothing is left behind for the next run of the // same workspace to trip over. - def pullRequest = branch.startsWith('pr-') && branch.substring(3).isInteger() ? branch.substring(3) : '' + def pullRequest = branch.startsWith('pr/') && branch.substring(3).isInteger() ? branch.substring(3) : '' def checkoutRef = pullRequest ? """ REFS=`git ls-remote https://github.com/OpenModelica/OpenModelica.git "refs/pull/${pullRequest}/head" "refs/pull/${pullRequest}/merge"` || exit 1 case "\$REFS" in diff --git a/README.md b/README.md index 97c9218..cc998b3 100644 --- a/README.md +++ b/README.md @@ -268,22 +268,27 @@ None of the branch jobs run unless their own parameter is ticked as well. By hand it is two steps. The compiler is built from the merge ref - the pull request as it would land, not the branch on its own - and the run fills a -`pr-` table like any other branch: +`pr/` table like any other branch: ```bash git fetch --force https://github.com/OpenModelica/OpenModelica.git refs/pull//merge git checkout -f --detach FETCH_HEAD # build omc, then -./test.py --branch=pr- configs/conf.json +./test.py --branch=pr/ configs/conf.json ``` +`pr/` rather than `pr-`: the results of a pull request are stored and +published under `pr/`, so that `branches/` holds branches and the pull requests +sit together in one directory of it. It is the one job name that keeps the +directory part of its name - `maintenance/v1.27` is tested as `v1.27`. + and the report compares that run against the newest run of `master`: ```bash ./pr-report.py # --baseline=master by default ``` -It writes `history/pr-/...html`, the same +It writes `history/pr//...html`, the same kind of page as the nightly regression reports, next to `00_comment.md`, a summary to comment on the pull request with. Both are published with the other reports. @@ -306,7 +311,7 @@ is based on, so a difference can come from anything merged since it was branched - a reason to rebase before believing a surprising result. A full run takes days, so testing every pull request this way is not the idea; -point `--branch=pr-` at a smaller configuration file when the question is +point `--branch=pr/` at a smaller configuration file when the question is narrower. The tables accumulate, about 19500 rows each. `drop-pr-tables.py` drops the ones diff --git a/all-plots.py b/all-plots.py index d9ce67b..dbe2b4b 100755 --- a/all-plots.py +++ b/all-plots.py @@ -21,7 +21,7 @@ resultsdb.addArgument(parser) args = parser.parse_args() -branches = [branch.split("/")[-1] for branch in args.branches] +branches = [shared.resultTable(branch) for branch in args.branches] fnameprefix = args.historypath libs = {} diff --git a/all-reports.py b/all-reports.py index 0394232..05a9ce8 100755 --- a/all-reports.py +++ b/all-reports.py @@ -23,7 +23,7 @@ os.environ['TZ'] = 'Europe/Stockholm' time.tzset() -branches = [branch.split("/")[-1] for branch in args.branches] +branches = [shared.resultTable(branch) for branch in args.branches] baseurl = args.baseurl historyurl = args.historyurl githuburl = args.githuburl diff --git a/drop-pr-tables.py b/drop-pr-tables.py index 73e7c8d..1cf2cda 100755 --- a/drop-pr-tables.py +++ b/drop-pr-tables.py @@ -23,7 +23,9 @@ resultsdb.addArgument(parser) args = parser.parse_args() -prTableRe = re.compile(r"^pr-([0-9]+)$") +# pr/ is what a run fills; pr- is what the runs before that filled, and +# they are dropped by the same rule. +prTableRe = re.compile(r"^pr[-/]([0-9]+)$") db = resultsdb.connect(args.db) cursor = db.cursor() diff --git a/pr-report.py b/pr-report.py index df09f8a..8f67635 100755 --- a/pr-report.py +++ b/pr-report.py @@ -16,7 +16,7 @@ from omcommon import friendlyStr, multiple_replace parser = argparse.ArgumentParser(description='OpenModelica library testing pull request report') -parser.add_argument('pullrequest', help='the pull request number, or its branch name pr-') +parser.add_argument('pullrequest', help='the pull request number, or its branch name pr/') parser.add_argument('--baseline', default="master", help='the branch the pull request is compared against') parser.add_argument('--date', type=int, default=0, help='the pull request run to report on (default: its newest)') parser.add_argument('--baselinedate', type=int, default=0, help='the baseline run to compare against (default: its newest)') @@ -40,12 +40,14 @@ PHASES = [(1,"frontend"),(2,"backend"),(3,"simcode"),(4,"templates"),(5,"compile"),(6,"simulate")] -m = re.match(r"^(?:pr-)?([0-9]+)$", args.pullrequest.strip()) +m = re.match(r"^(?:pr[-/])?([0-9]+)$", args.pullrequest.strip()) if not m: - raise SystemExit("Expected a pull request number or a pr- branch name, got '%s'" % args.pullrequest) + raise SystemExit("Expected a pull request number or a pr/ branch name, got '%s'" % args.pullrequest) pr = m.group(1) -branch = "pr-%s" % pr -baseline = args.baseline.split("/")[-1] +# The results of a pull request live under pr/, not beside the branches; see +# shared.resultTable. +branch = "pr/%s" % pr +baseline = shared.resultTable(args.baseline) prurl = "%s/pull/%s" % (args.githuburl, pr) repo = args.githuburl.split("github.com/")[-1].strip("/") diff --git a/report.py b/report.py index 03b6961..580d4c0 100755 --- a/report.py +++ b/report.py @@ -15,7 +15,7 @@ if configs == []: raise Exception("Error: Expected at least one configuration file to start the library test") -branches = [br.split("/")[-1] for br in args.branches.split(" ")] +branches = [shared.resultTable(br) for br in args.branches.split(" ")] dates = {} dates_str = {} diff --git a/shared.py b/shared.py index 36a0381..89f6a8a 100644 --- a/shared.py +++ b/shared.py @@ -3,6 +3,16 @@ import re, os, string, subprocess import simplejson as json +# A job is named after the branch it tests, and takes the last part of the name: +# maintenance/v1.27 is stored and published as v1.27. A pull request is the +# exception - pr/16370 keeps the directory it is in, so that the branches +# directory holds branches and the pull requests sit together under one of them. +prBranchRe = re.compile(r"^pr/[0-9]+$") + +def resultTable(branch): + """The results of a job named after this branch: its table and its directory.""" + return branch if prBranchRe.match(branch) else branch.split("/")[-1] + simCodeTargetRe = re.compile('--simCodeTarget=([^"\'\\s,;)]+)') def simCodeTargetFromCommands(target, commands): diff --git a/single-model.py b/single-model.py index 3d9af2b..bb21728 100755 --- a/single-model.py +++ b/single-model.py @@ -12,7 +12,7 @@ args = parser.parse_args() -branch = args.branch.split("/")[-1] +branch = shared.resultTable(args.branch) models = args.models dates = {}