diff --git a/lib/build.ml b/lib/build.ml index a7851c99..33c26b86 100644 --- a/lib/build.ml +++ b/lib/build.ml @@ -24,7 +24,7 @@ module Spec = struct revdep : package option; with_tests : bool; lower_bounds : bool; - opam_version : [`V2_0 | `V2_1]; + opam_version : [`V2_0 | `V2_1 | `Dev]; } [@@deriving to_yojson] type ty = [ @@ -55,6 +55,7 @@ module Spec = struct (match opam_version with | `V2_0 -> "2.0" | `V2_1 -> "2.1" + | `Dev -> "dev" ) end diff --git a/lib/build.mli b/lib/build.mli index 3d7a9a0b..3111db8e 100644 --- a/lib/build.mli +++ b/lib/build.mli @@ -6,7 +6,7 @@ module Spec : sig platform:Platform.t -> lower_bounds:bool -> with_tests:bool -> - opam_version:[`V2_0 | `V2_1] -> + opam_version:[`V2_0 | `V2_1 | `Dev] -> OpamPackage.t -> t end diff --git a/lib/opam_build.ml b/lib/opam_build.ml index a1229935..ee885987 100644 --- a/lib/opam_build.ml +++ b/lib/opam_build.ml @@ -23,7 +23,7 @@ let opam_install ~variant ~opam_version ~pin ~lower_bounds ~with_tests ~pkg = else [] ) @ [ - run ~network "opam %s" (match opam_version with `V2_1 -> "update --depexts" | `V2_0 -> "depext -u"); + run ~network "opam %s" (match opam_version with `V2_1 | `Dev -> "update --depexts" | `V2_0 -> "depext -u"); (* TODO: Replace by two calls to opam install + opam install -t using the OPAMDROPINSTALLEDPACKAGES feature *) run ~cache ~network {|opam remove %s%s && opam install --deps-only%s %s && opam install -v%s %s; @@ -38,7 +38,7 @@ let opam_install ~variant ~opam_version ~pin ~lower_bounds ~with_tests ~pkg = fi; done; exit 1|} - pkg (match opam_version with `V2_1 -> "" | `V2_0 -> " && opam depext"^with_tests_opt^" "^pkg) with_tests_opt pkg with_tests_opt pkg + pkg (match opam_version with `V2_1 | `Dev -> "" | `V2_0 -> " && opam depext"^with_tests_opt^" "^pkg) with_tests_opt pkg with_tests_opt pkg (Variant.distribution variant) ] @@ -59,6 +59,10 @@ let setup_repository ~variant ~for_docker ~opam_version = let opam_version_str = match opam_version with | `V2_0 -> "2.0" | `V2_1 -> "2.1" + | `Dev -> + match Variant.os variant with + | `macOS -> "2.1" (* TODO: Remove that when macOS has a proper up-to-date docker image *) + | `linux -> "dev" in let opam_repo_args = match Variant.os variant with | `macOS -> " -k local" (* TODO: (copy ...) do not copy the content of .git or something like that and make the subsequent opam pin fail *) diff --git a/lib/opam_build.mli b/lib/opam_build.mli index bb67c7d4..6d33aa6c 100644 --- a/lib/opam_build.mli +++ b/lib/opam_build.mli @@ -1,6 +1,6 @@ val spec : for_docker:bool -> - opam_version:[`V2_0 | `V2_1] -> + opam_version:[`V2_0 | `V2_1 | `Dev] -> base:string -> variant:Variant.t -> revdep:OpamPackage.t option -> diff --git a/service/pipeline.ml b/service/pipeline.ml index 2d36594f..93bc75f9 100644 --- a/service/pipeline.ml +++ b/service/pipeline.ml @@ -9,6 +9,7 @@ module Common = Opam_repo_ci_api.Common let master_distro = (Dockerfile_distro.resolve_alias Dockerfile_distro.master_distro :> Dockerfile_distro.t) let default_compiler_full = Ocaml_version.Releases.latest let default_compiler = Ocaml_version.with_just_major_and_minor default_compiler_full +let opam_version = `Dev let weekly = Current_cache.Schedule.v ~valid_for:(Duration.of_day 7) () @@ -144,16 +145,14 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source = let build = Node.action `Built image and tests = Node.action `Built tests and lower_bounds_check = - match opam_version, lower_bounds with - | `V2_1, true -> + if lower_bounds then let action = let spec = lower_bounds_spec ~platform ~opam_version pkg in Build.v ocluster ~label:"lower-bounds" ~base ~spec ~master ~urgent source in let action = Node.action `Built action in Node.leaf ~label:"lower-bounds" action - | `V2_0, true - | (`V2_1 | `V2_0), false -> + else Node.empty and revdeps = if revdeps then test_revdeps ~ocluster ~opam_version ~master ~base ~platform ~pkgopt source ~after:image @@ -169,7 +168,7 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source = |> (fun x -> Node.branch ~label [x]) |> Node.collapse ~key:"platform" ~value:label ~input:analysis in - let compilers ~opam_version = + let compilers = let master_distro = Dockerfile_distro.tag_of_distro master_distro in (Ocaml_version.Releases.recent @ Ocaml_version.Releases.unreleased_betas) |> List.map (fun v -> @@ -180,13 +179,15 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source = build ~opam_version ~lower_bounds:true ~revdeps v variant ) in - let distributions ~opam_version = + let distributions = let default_compiler = Ocaml_version.to_string default_compiler in let linux_distributions = Dockerfile_distro.active_distros `X86_64 |> List.fold_left (fun acc distro -> if Dockerfile_distro.compare distro master_distro = 0 (* TODO: Add Dockerfile_distro.equal *) - || Dockerfile_distro.os_family_of_distro distro <> `Linux then (* TODO: Unlock this when Windows is ready *) + || Dockerfile_distro.os_family_of_distro distro <> `Linux (* TODO: Unlock this when Windows is ready *) + || Dockerfile_distro.compare distro (`CentOS `V7 : Dockerfile_distro.t) = 0 (* TODO: Remove when it has been removed in ocaml-dockerfile *) + || Dockerfile_distro.compare distro (`OracleLinux `V7 : Dockerfile_distro.t) = 0 then acc else let distro = Dockerfile_distro.tag_of_distro distro in @@ -205,13 +206,12 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source = in let analysis = Node.action `Analysed analysis and lint = Node.action `Linted lint - and compilers_2_0 = compilers ~opam_version:`V2_0 - and compilers_2_1 = compilers ~opam_version:`V2_1 - and distributions_2_0 = distributions ~opam_version:`V2_0 - and distributions_2_1 = distributions ~opam_version:`V2_1 and extras = let master_distro = Dockerfile_distro.tag_of_distro master_distro in let default_comp = Ocaml_version.to_string default_compiler in + let default_variant = Variant.v ~arch:`X86_64 ~distro:master_distro ~compiler:(default_comp, None) in + build ~opam_version:`V2_0 ~lower_bounds:false ~revdeps:false "opam-2.0" default_variant :: + build ~opam_version:`V2_1 ~lower_bounds:false ~revdeps:false "opam-2.1" default_variant :: List.filter_map (fun v -> match Ocaml_version.extra v with | None -> None @@ -220,7 +220,7 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source = (* TODO: The same code is used in docker-base-images *) let label = String.map (function '+' -> '-' | c -> c) label in let variant = Variant.v ~arch:`X86_64 ~distro:master_distro ~compiler:(default_comp, Some label) in - Some (build ~opam_version:`V2_1 ~lower_bounds:false ~revdeps:false label variant) + Some (build ~opam_version ~lower_bounds:false ~revdeps:false label variant) ) (Ocaml_version.Opam.V2.switches `X86_64 default_compiler_full) @ List.filter_map (function | `X86_64 -> None @@ -228,27 +228,15 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source = | arch -> let label = Ocaml_version.to_opam_arch arch in let variant = Variant.v ~arch ~distro:master_distro ~compiler:(default_comp, None) in - Some (build ~opam_version:`V2_1 ~lower_bounds:false ~revdeps:false label variant) + Some (build ~opam_version ~lower_bounds:false ~revdeps:false label variant) ) Ocaml_version.arches in - let opam_2_0 = - [ - Node.branch ~label:"compilers" compilers_2_0; - Node.branch ~label:"distributions" distributions_2_0; - ] - in - let opam_2_1 = - [ - Node.branch ~label:"compilers" compilers_2_1; - Node.branch ~label:"distributions" distributions_2_1; - Node.branch ~label:"extras" extras; - ] - in Node.root [ Node.leaf ~label:"(analysis)" analysis; Node.leaf ~label:"(lint)" lint; - Node.branch ~label:"opam-2.0" opam_2_0; - Node.branch ~label:"opam-2.1" opam_2_1; + Node.branch ~label:"compilers" compilers; + Node.branch ~label:"distributions" distributions; + Node.branch ~label:"extras" extras; ]