Skip to content

Commit

Permalink
Move some helper libraries into opam-ci-check library
Browse files Browse the repository at this point in the history
Also, Remove dependency on current_docker for opam-ci-check
  • Loading branch information
punchagan committed Nov 21, 2024
1 parent 4ba4483 commit bf919a9
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 31 deletions.
2 changes: 2 additions & 0 deletions doc/doc.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
open Opam_repo_ci

module Opam_version = Opam_ci_check.Opam_version
module Variant = Opam_ci_check.Variant
module Git = Current_git

type platform = {
Expand Down
5 changes: 4 additions & 1 deletion lib/build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ open Current.Syntax

module Docker = Current_docker.Default
module Distro = Dockerfile_opam.Distro
module Opam_version = Opam_ci_check.Opam_version
module Variant = Opam_ci_check.Variant
module Spec = Opam_ci_check.Spec

let master_distro = (Distro.resolve_alias Distro.master_distro :> Distro.t)
let default_compilers_full = Ocaml_version.Releases.[ v4_14; Ocaml_version.Releases.latest ] (* NOTE: Should probably stay with list length 2 *)
Expand Down Expand Up @@ -192,7 +195,7 @@ let get_base ~arch variant =
Docker.peek ~schedule:weekly ~arch:(Ocaml_version.to_docker_arch arch)
("ocaml/opam:" ^ Variant.docker_tag variant)
in
Spec.Docker (Current_docker.Raw.Image.of_hash repo_id)
Spec.Docker repo_id

let build (module Builder : Build_intf.S) ~analysis ~pkgopts ~master ~source ~opam_version ~lower_bounds ~revdeps label variant =
let arch = Variant.arch variant in
Expand Down
12 changes: 6 additions & 6 deletions lib/build.mli
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ val compilers :
lower_bounds:bool ->
revdeps:bool ->
string ->
Variant.t ->
Opam_ci_check.Variant.t ->
'a) ->
unit ->
'a list
Expand All @@ -18,7 +18,7 @@ val linux_distributions :
lower_bounds:bool ->
revdeps:bool ->
string ->
Variant.t ->
Opam_ci_check.Variant.t ->
'a) ->
'a list

Expand All @@ -28,7 +28,7 @@ val macos :
lower_bounds:bool ->
revdeps:bool ->
string ->
Variant.t ->
Opam_ci_check.Variant.t ->
'a) ->
'a list

Expand All @@ -38,17 +38,17 @@ val freebsd :
lower_bounds:bool ->
revdeps:bool ->
string ->
Variant.t ->
Opam_ci_check.Variant.t ->
'a) ->
'a list

val extras :
build:
(opam_version:Opam_version.t ->
(opam_version:Opam_ci_check.Opam_version.t ->
lower_bounds:bool ->
revdeps:bool ->
string ->
Variant.t ->
Opam_ci_check.Variant.t ->
'a) ->
'a list

Expand Down
10 changes: 5 additions & 5 deletions lib/build_intf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module type S = sig
whether high- and low-priority jobs are set as urgent. *)
val v :
label:string ->
spec:Spec.t Current.t ->
base:Spec.base Current.t ->
spec:Opam_ci_check.Spec.t Current.t ->
base:Opam_ci_check.Spec.base Current.t ->
master:Current_git.Commit.t Current.t ->
urgent:([`High | `Low] -> bool) option Current.t ->
Current_git.Commit_id.t Current.t ->
Expand All @@ -20,11 +20,11 @@ module type S = sig
The spec is generated on top of [base], and the OCurrent job is run
after the job specified by [after], making it a dependency. *)
val list_revdeps :
variant:Variant.t ->
opam_version:Opam_version.t ->
variant:Opam_ci_check.Variant.t ->
opam_version:Opam_ci_check.Opam_version.t ->
pkgopt:Package_opt.t Current.t ->
new_pkgs:OpamPackage.t list Current.t ->
base:Spec.base Current.t ->
base:Opam_ci_check.Spec.base Current.t ->
master:Current_git.Commit.t Current.t ->
after:unit Current.t ->
Current_git.Commit_id.t Current.t ->
Expand Down
3 changes: 3 additions & 0 deletions lib/cluster_build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ open Current.Syntax
open Capnp_rpc_lwt
open Lwt.Infix

module Variant = Opam_ci_check.Variant
module Spec = Opam_ci_check.Spec
module Opam_build = Opam_ci_check.Opam_build
module Git = Current_git

let ( >>!= ) = Lwt_result.bind
Expand Down
10 changes: 5 additions & 5 deletions lib/cluster_build.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ val config :
val v :
t ->
label:string ->
spec:Spec.t Current.t ->
base:Spec.base Current.t ->
spec:Opam_ci_check.Spec.t Current.t ->
base:Opam_ci_check.Spec.base Current.t ->
master:Current_git.Commit.t Current.t ->
urgent:([`High | `Low] -> bool) option Current.t ->
Current_git.Commit_id.t Current.t ->
Expand All @@ -29,11 +29,11 @@ val v :
the job specified by [after], making it a dependency. *)
val list_revdeps :
t ->
variant:Variant.t ->
opam_version:Opam_version.t ->
variant:Opam_ci_check.Variant.t ->
opam_version:Opam_ci_check.Opam_version.t ->
pkgopt:Package_opt.t Current.t ->
new_pkgs:OpamPackage.t list Current.t ->
base:Spec.base Current.t ->
base:Opam_ci_check.Spec.base Current.t ->
master:Current_git.Commit.t Current.t ->
after:unit Current.t ->
Current_git.Commit_id.t Current.t ->
Expand Down
3 changes: 2 additions & 1 deletion lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
obuilder-spec
opam-format
opam-state
opam-repo-ci-api))
opam-repo-ci-api
opam_ci_check))
5 changes: 4 additions & 1 deletion lib/local_build.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
open Current.Syntax
open Lwt.Infix

module Spec = Opam_ci_check.Spec
module Variant = Opam_ci_check.Variant
module Opam_build = Opam_ci_check.Opam_build
module Git = Current_git
module Raw = Current_docker.Raw

Expand Down Expand Up @@ -158,7 +161,7 @@ module Op = struct
~os (Opam_build.build_spec ~base ~local:true ~for_docker:true build_config)
in
Current.Job.write job
(Fmt.str "@[<v>Base: %a@,%a@]@." Raw.Image.pp image Spec.pp_summary ty);
(Fmt.str "@[<v>Base: %s@,%a@]@." image Spec.pp_summary ty);
Current.Job.write job
(Fmt.str
"@.To reproduce locally:@[email protected] $(mktemp -d)@.%[email protected] > Dockerfile \
Expand Down
10 changes: 5 additions & 5 deletions lib/local_build.mli
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
to conform with the interface for [Cluster_build]. *)
val v :
label:string ->
spec:Spec.t Current.t ->
base:Spec.base Current.t ->
spec:Opam_ci_check.Spec.t Current.t ->
base:Opam_ci_check.Spec.base Current.t ->
master:Current_git.Commit.t Current.t ->
urgent:([ `High | `Low ] -> bool) option Current.t ->
Current_git.Commit_id.t Current.t -> unit Current.t
Expand All @@ -19,11 +19,11 @@ val v :
The spec is generated on top of [base], and the OCurrent job is run after
the job specified by [after], making it a dependency. *)
val list_revdeps :
variant:Variant.t ->
opam_version:Opam_version.t ->
variant:Opam_ci_check.Variant.t ->
opam_version:Opam_ci_check.Opam_version.t ->
pkgopt:Package_opt.t Current.t ->
new_pkgs:OpamPackage.t list Current.t ->
base:Spec.base Current.t ->
base:Opam_ci_check.Spec.base Current.t ->
master:Current_git.Commit.t Current.t ->
after:unit Current.t ->
Current_git.Commit_id.t Current.t -> OpamPackage.Set.t Current.t
4 changes: 4 additions & 0 deletions opam-ci-check.opam
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ depends: [
"sexplib"
"cmdliner" {>= "1.1.1"}
"opam-client" {>= "2.3.0~alpha1"}
"ocaml-version" {>= "3.6.9"}
"obuilder-spec"
"odoc" {with-doc}
"ppx_deriving" {>= "5.2.1"}
"ppx_deriving_yojson"
]
build: [
["dune" "subst"] {dev}
Expand Down
9 changes: 8 additions & 1 deletion opam-ci-check/lib/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
(library
(name opam_ci_check)
(public_name opam-ci-check)
(libraries opam-client sexplib str))
(preprocess
(pps ppx_deriving.std ppx_deriving_yojson))
(libraries
opam-client
sexplib
str
ocaml-version
obuilder-spec))
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions opam-ci-check/lib/opam_ci_check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
module Revdeps = Revdeps
module Test = Test
module Lint = Lint
module Opam_build = Opam_build
module Variant = Variant
module Opam_version = Opam_version
module Spec = Spec
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lib/spec.ml → opam-ci-check/lib/spec.ml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(* TODO: Make macOS use docker images *)
type base =
| Docker of Current_docker.Raw.Image.t
| Docker of string
| Macos of string
| Freebsd of string

let base_to_string = function
| Docker img -> Current_docker.Raw.Image.hash img
| Docker img -> img
| Macos base -> base
| Freebsd base -> base

Expand Down
2 changes: 1 addition & 1 deletion lib/spec.mli → opam-ci-check/lib/spec.mli
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
MacOS and FreeBSD do not yet have Docker images and
start from custom base images stored in the workers. *)
type base =
| Docker of Current_docker.Raw.Image.t
| Docker of string
| Macos of string
| Freebsd of string

Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion test/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
(test
(name test)
(package opam-repo-ci-service)
(libraries opam_repo_ci alcotest alcotest-lwt ppx_deriving_yojson.runtime)
(libraries
opam_ci_check
opam_repo_ci
alcotest
alcotest-lwt
ppx_deriving_yojson.runtime)
(preprocess
(pps ppx_deriving.eq ppx_deriving_yojson))
(deps
Expand Down
6 changes: 4 additions & 2 deletions test/test.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@


open Opam_repo_ci

module Spec = Opam_ci_check.Spec
module Opam_version = Opam_ci_check.Opam_version
module Variant = Opam_ci_check.Variant
module Opam_build = Opam_ci_check.Opam_build
module Git = Current_git

let specs =
Expand Down

0 comments on commit bf919a9

Please sign in to comment.