Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/opam_build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ let revdeps ~for_docker ~base ~variant ~pkg =
let open Obuilder_spec in
let pkg = Filename.quote (OpamPackage.to_string pkg) in
Obuilder_spec.stage ~from:base (
(* TODO: Switch to opam 2.1 when https://github.com/ocaml/opam/issues/4311 is fixed *)
setup_repository ~variant ~for_docker ~upgrade_opam:false
@ [
run "echo '@@@OUTPUT' && \
Expand Down
44 changes: 31 additions & 13 deletions service/pipeline.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ let combine_revdeps revdeps =

(* List the revdeps of [pkg] (using [builder] and [image]) and test each one
(using [spec] and [base], merging [source] into [master]). *)
let test_revdeps ~ocluster ~master ~base ~platform ~pkg ~after:main_build source =
let test_revdeps ~ocluster ~upgrade_opam ~master ~base ~platform ~pkg ~after:main_build source =
let revdeps = Build.list_revdeps ~base ocluster ~platform ~pkg ~master source in
let revdeps = Current.map combine_revdeps revdeps in
let+ tests =
revdeps
|> Current.gate ~on:main_build
|> dep_list_map (module OpamPackage) (fun revdep ->
let image =
let spec = revdep_spec ~platform ~upgrade_opam:false ~revdep pkg in
let spec = revdep_spec ~platform ~upgrade_opam ~revdep pkg in
Build.v ocluster ~label:"build" ~base ~spec ~master source
in
let+ label = Current.map OpamPackage.to_string revdep
Expand All @@ -122,7 +122,7 @@ let get_significant_available_pkg = function
let build_with_cluster ~ocluster ~analysis ~lint ~master source =
let pkgs = Current.map Analyse.Analysis.packages analysis in
let pkgs = Current.map (List.filter_map get_significant_available_pkg) pkgs in
let build ?(upgrade_opam=false) ~revdeps label variant =
let build ~upgrade_opam ~revdeps label variant =
let arch = Variant.arch variant in
let pool = Conf.pool_of_arch arch in
let platform = {Platform.label; pool; variant} in
Expand Down Expand Up @@ -154,7 +154,7 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source =
and+ build = Node.action `Built image
and+ tests = Node.action `Built tests
and+ revdeps =
if revdeps then test_revdeps ~ocluster ~master ~base ~platform ~pkg source ~after:image
if revdeps then test_revdeps ~ocluster ~upgrade_opam ~master ~base ~platform ~pkg source ~after:image
else Current.return []
in
let label = OpamPackage.to_string pkg in
Expand All @@ -163,9 +163,7 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source =
|> Current.map (Node.branch ~label)
|> Current.collapse ~key:"platform" ~value:label ~input:analysis
in
let+ analysis = Node.action `Analysed analysis
and+ lint = Node.action `Linted lint
and+ compilers =
let compilers ~upgrade_opam =
Current.list_seq begin
let master_distro = Dockerfile_distro.tag_of_distro master_distro in
(Ocaml_version.Releases.recent @ Ocaml_version.Releases.dev) |>
Expand All @@ -174,10 +172,11 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source =
let revdeps = Ocaml_version.equal v default_compiler in (* TODO: Remove this when the cluster is ready *)
let v = Ocaml_version.to_string v in
let variant = Variant.v ~arch:`X86_64 ~distro:master_distro ~compiler:(v, None) in
build ~revdeps v variant
build ~upgrade_opam ~revdeps v variant
)
end
and+ distributions =
in
let distributions ~upgrade_opam =
Current.list_seq begin
let default_compiler = Ocaml_version.to_string default_compiler in
Dockerfile_distro.active_distros `X86_64 |>
Expand All @@ -188,9 +187,16 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source =
else
let distro = Dockerfile_distro.tag_of_distro distro in
let variant = Variant.v ~arch:`X86_64 ~distro ~compiler:(default_compiler, None) in
build ~revdeps:false distro variant :: acc
build ~upgrade_opam ~revdeps:false distro variant :: acc
) []
end
in
let+ analysis = Node.action `Analysed analysis
and+ lint = Node.action `Linted lint
and+ compilers_2_0 = compilers ~upgrade_opam:false
and+ compilers_2_1 = compilers ~upgrade_opam:true
and+ distributions_2_0 = distributions ~upgrade_opam:false
and+ distributions_2_1 = distributions ~upgrade_opam:true
and+ extras =
let master_distro = Dockerfile_distro.tag_of_distro master_distro in
let default_compiler = Ocaml_version.to_string default_compiler in
Expand All @@ -209,12 +215,24 @@ let build_with_cluster ~ocluster ~analysis ~lint ~master source =
) [] 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:"compilers" compilers;
Node.branch ~label:"distributions" distributions;
Node.branch ~label:"extras" extras;
Node.branch ~label:"opam-2.0" opam_2_0;
Node.branch ~label:"opam-2.1" opam_2_1;
]

let summarise results =
Expand Down