# HG changeset patch # User Fabian Huch # Date 1698164993 -7200 # Node ID 4c5aadf1cb48191bce37a3f07a67937c4bad2442 # Parent b356019e8d49187fd4bf2a865587c7406c83a285 prefer Isabelle options for CI mail settings over ci.properties; diff -r b356019e8d49 -r 4c5aadf1cb48 etc/options --- a/etc/options Mon Oct 23 16:19:19 2023 +0100 +++ b/etc/options Tue Oct 24 18:29:53 2023 +0200 @@ -433,3 +433,13 @@ option bash_process_debugging : bool = false for connection option bash_process_address : string = "" for connection option bash_process_password : string = "" for connection + + +section "Continuous integration" + +option ci_mail_user : string = "" for connection +option ci_mail_password : string = "" for connection +option ci_mail_sender : string = "" for connection +option ci_mail_smtp_host : string = "" for connection +option ci_mail_smtp_port : int = 587 for connection +option ci_mail_ssl : bool = true for connection diff -r b356019e8d49 -r 4c5aadf1cb48 src/Pure/Admin/ci_build.scala --- a/src/Pure/Admin/ci_build.scala Mon Oct 23 16:19:19 2023 +0100 +++ b/src/Pure/Admin/ci_build.scala Tue Oct 24 18:29:53 2023 +0200 @@ -45,10 +45,9 @@ clean: Boolean = true, include: List[Path] = Nil, select: List[Path] = Nil, - pre_hook: () => Result = () => Result.ok, - post_hook: (Build.Results, Time) => Result = (_, _) => Result.ok, - selection: Sessions.Selection = Sessions.Selection.empty - ) + pre_hook: Options => Result = _ => Result.ok, + post_hook: (Build.Results, Options, Time) => Result = (_, _, _) => Result.ok, + selection: Sessions.Selection = Sessions.Selection.empty) /* ci build jobs */ @@ -105,16 +104,6 @@ /* ci build */ - private def load_properties(): JProperties = { - val props = new JProperties - val file_name = Isabelle_System.getenv("ISABELLE_CI_PROPERTIES") - if (file_name.nonEmpty) { - val path = Path.explode(file_name) - if (path.is_file) props.load(Files.newBufferedReader(path.java_path)) - } - props - } - private def compute_timing(results: Build.Results, group: Option[String]): Timing = { val timings = results.sessions.collect { @@ -140,7 +129,7 @@ def print_section(title: String): Unit = println(s"\n=== $title ===\n") - def ci_build(job: Job): Unit = { + def ci_build(options: Options, job: Job): Unit = { val profile = job.profile val config = job.config @@ -153,20 +142,19 @@ print_section("CONFIGURATION") println(Build_Log.Settings.show()) - val props = load_properties() - System.getProperties.asInstanceOf[JMap[AnyRef, AnyRef]].putAll(props) - val options = - with_documents(Options.init(), config) + val build_options = + with_documents(options, config) .int.update("parallel_proofs", 1) .int.update("threads", profile.threads) + + "system_heaps" println(s"jobs = ${profile.jobs}, threads = ${profile.threads}, numa = ${profile.numa}") print_section("BUILD") println(s"Build started at $formatted_time") println(s"Isabelle id $isabelle_id") - val pre_result = config.pre_hook() + val pre_result = config.pre_hook(options) print_section("LOG") val (results, elapsed_time) = { @@ -174,7 +162,7 @@ val start_time = Time.now() val results = progress.interrupt_handler { Build.build( - options + "system_heaps", + build_options, selection = config.selection, progress = progress, clean_build = config.clean, @@ -208,7 +196,7 @@ } } - val post_result = config.post_hook(results, start_time) + val post_result = config.post_hook(results, options, start_time) sys.exit(List(pre_result.rc, results.rc, post_result.rc).max) } @@ -216,26 +204,33 @@ /* Isabelle tool wrapper */ - val isabelle_tool = - Isabelle_Tool( - "ci_build", "builds Isabelle jobs in ci environments", Scala_Project.here, - { args => - val getopts = Getopts(""" -Usage: isabelle ci_build [JOB] + val isabelle_tool = Isabelle_Tool("ci_build", "builds Isabelle jobs in ci environments", + Scala_Project.here, + { args => + /* arguments */ + + var options = Options.init() + + val getopts = Getopts(""" +Usage: isabelle ci_build [OPTIONS] JOB + + Options are: + -o OPTION override Isabelle system OPTION (via NAME=VAL or NAME) Runs Isabelle builds in ci environment, with the following build jobs: -""" + Library.indent_lines(4, show_jobs) + "\n") +""" + Library.indent_lines(4, show_jobs) + "\n", + "o:" -> (arg => options = options + arg)) - val more_args = getopts(args) + val more_args = getopts(args) - val job = more_args match { - case job :: Nil => the_job(job) - case _ => getopts.usage() - } + val job = more_args match { + case job :: Nil => the_job(job) + case _ => getopts.usage() + } - ci_build(job) - }) + ci_build(options, job) + }) } class Isabelle_CI_Builds(val jobs: CI_Build.Job*) extends Isabelle_System.Service