Skip to content

Commit

Permalink
Run dune-opam-lint to check opam files
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Dec 15, 2020
1 parent 050189f commit ef31fa8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module Op = struct
match ty with
| `Opam (`Build, selection, opam_files) -> Opam_build.spec ~base ~opam_files ~selection
| `Opam (`Lint `Doc, selection, opam_files) -> Lint.doc_spec ~base ~opam_files ~selection
| `Opam (`Lint `Opam, _selection, opam_files) -> Lint.opam_lint_spec ~base ~opam_files
| `Opam (`Lint `Opam, selection, opam_files) -> Lint.opam_lint_spec ~base ~opam_files ~selection
| `Opam_fmt ocamlformat_source -> Lint.fmt_spec ~base ~ocamlformat_source
| `Duniverse opam_files -> Duniverse_build.spec ~base ~repo ~opam_files ~variant
| `Opam_monorepo config -> Opam_monorepo.spec ~base ~repo ~config ~variant
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster_build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module Op = struct
match ty with
| `Opam (`Build, selection, opam_files) -> Opam_build.spec ~base ~opam_files ~selection
| `Opam (`Lint `Doc, selection, opam_files) -> Lint.doc_spec ~base ~opam_files ~selection
| `Opam (`Lint `Opam, _selection, opam_files) -> Lint.opam_lint_spec ~base ~opam_files
| `Opam (`Lint `Opam, selection, opam_files) -> Lint.opam_lint_spec ~base ~opam_files ~selection
| `Opam_fmt ocamlformat_source -> Lint.fmt_spec ~base ~ocamlformat_source
| `Duniverse opam_files -> Duniverse_build.spec ~base ~repo ~opam_files ~variant
| `Opam_monorepo config -> Opam_monorepo.spec ~base ~repo ~config ~variant
Expand Down
29 changes: 24 additions & 5 deletions lib/lint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ let doc_spec ~base ~opam_files ~selection =
let network = ["host"] in
let open Obuilder_spec in
stage ~from:base @@
comment "%s" (Fmt.strf "%a" Variant.pp selection.Selection.variant) ::
user ~uid:1000 ~gid:1000 ::
Opam_build.install_project_deps ~opam_files ~selection @ [
(* Warnings-as-errors was introduced in Odoc.1.5.0 *)
Expand All @@ -46,11 +47,29 @@ let doc_spec ~base ~opam_files ~selection =
|| (echo \"dune build @doc failed\"; exit 2)";
]

let opam_lint_spec ~base ~opam_files =
let install_dune_opam_lint ~cache ~network ~base =
let open Obuilder_spec in
stage ~from:base [
user ~uid:1000 ~gid:1000;
workdir "src";
copy ["./"] ~dst:"./";
run "opam lint %s" (String.concat " " opam_files);
run ~cache ~network "opam pin add -yn dune-opam-lint.dev https://github.com/talex5/dune-opam-lint.git";
run ~cache ~network "opam depext -i dune-opam-lint";
run "sudo cp $(opam exec -- which dune-opam-lint) /usr/local/bin/";
]

let opam_lint_spec ~base ~opam_files ~selection =
let cache = [ Obuilder_spec.Cache.v Opam_build.download_cache ~target:"/home/opam/.opam/download-cache" ] in
let network = ["host"] in
let open Obuilder_spec in
stage
~child_builds:["dune-opam-lint", install_dune_opam_lint ~cache ~network ~base]
~from:base @@
comment "%s" (Fmt.strf "%a" Variant.pp selection.Selection.variant) ::
user ~uid:1000 ~gid:1000 ::
Opam_build.install_project_deps ~opam_files ~selection @ [
workdir "src";
copy ["./"] ~dst:"./";
run "opam lint %s" (String.concat " " opam_files);
copy ["/usr/local/bin/dune-opam-lint"]
~from:(`Build "dune-opam-lint")
~dst:"/usr/local/bin/";
run "opam exec -- dune-opam-lint";
]
1 change: 1 addition & 0 deletions lib/lint.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ val doc_spec :
val opam_lint_spec :
base:string ->
opam_files:string list ->
selection:Selection.t ->
Obuilder_spec.t
2 changes: 1 addition & 1 deletion service/conf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ let platforms =
let ovs = List.rev OV.Releases.recent @ OV.Releases.unreleased_betas in
List.map make_release ovs @ distros
| `Dev ->
let ovs = List.map OV.of_string_exn ["4.10"; "4.11"; "4.03"] in
let ovs = List.map OV.of_string_exn ["4.11"; "4.10"; "4.03"] in
List.map make_release ovs @ [make_release ~arch:`I386 (List.hd ovs)]

0 comments on commit ef31fa8

Please sign in to comment.