Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt pipelines #37

Closed
wants to merge 2 commits into from
Closed
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
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ In `src/pipelines/`, there are two kind of pipelines:
- [mirage/mirage-skeleton](https://github.com/mirage/mirage-skeleton)
- [mirage/opam-overlays](https://github.com/mirage/opam-overlays)

By default, the testing workflow is implemented:
- *Mirage4*, corresponding to the `--test-mirage-4` CLI option. This is testing:
By default, two testing workflows are implemented:
- *Mirage4* development, corresponding to the `--test-mirage-4` CLI option. This is testing:
- [mirage#main](https://github.com/mirage/mirage)
- [mirage-dev#master](https://github.com/mirage/mirage-dev)
- [mirage-skeleton#mirage-dev](https://github.com/mirage/mirage-skeleton/tree/mirage-dev)
- [mirage-skeleton#dev](https://github.com/mirage/mirage-skeleton/tree/dev)
- [opam-overlays#master](https://github.com/mirage/opam-overlays)

- *Mirage4* release, corresponding to the `--test-mirage-4` CLI option. This is testing:
- [mirage](https://github.com/mirage/mirage) as released to opam repository
- [mirage-skeleton#main](https://github.com/mirage/mirage-skeleton/)
- [opam-overlays#master](https://github.com/mirage/opam-overlays)

**co-dependent PRs** `mirage-ci` will detect if PRs submitted to these
Expand Down
140 changes: 84 additions & 56 deletions src/pipelines/PR.ml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ module Run = struct
type local = {
config : Config.t;
repos : Opam_repository.t list Current.t;
mirage : Git.Commit_id.t Current.t;
mirage : Git.Commit_id.t Current.t option;
mirage_skeleton : Git.Commit_id.t Current.t;
mirage_dev : Git.Commit_id.t Current.t option;
build_mode : Opam_repository.t list Current.t Skeleton.build_mode;
Expand All @@ -228,7 +228,7 @@ module Run = struct
mirage_dev;
platform = Common.Platform.platform_host;
mirage_skeleton;
mirage = Some mirage;
mirage;
build_mode;
}
in
Expand Down Expand Up @@ -484,12 +484,7 @@ type context = {
let pipeline ~mirage ~mirage_skeleton ~mirage_dev ~build_mode
{ config; enable_commit_status; repos } =
let config_with_mirage =
{
Run.Pipeline_run.mirage = Some mirage;
mirage_dev;
mirage_skeleton;
build_mode;
}
{ Run.Pipeline_run.mirage; mirage_dev; mirage_skeleton; build_mode }
in
let config_without_mirage =
{ Run.Pipeline_run.mirage = None; mirage_dev; mirage_skeleton; build_mode }
Expand All @@ -504,14 +499,19 @@ let pipeline ~mirage ~mirage_skeleton ~mirage_dev ~build_mode
tracked_repositories = config_with_mirage;
commit_status = enable_commit_status.skeleton;
} );
( mirage,
{
Run.Pipeline_run.config;
repos;
tracked_repositories = config_with_mirage;
commit_status = enable_commit_status.mirage;
} );
]
@ (match mirage with
| None -> []
| Some mirage ->
[
( mirage,
{
Run.Pipeline_run.config;
repos;
tracked_repositories = config_with_mirage;
commit_status = enable_commit_status.mirage;
} );
])
@ (match mirage_dev with
| Some mirage_dev ->
[
Expand Down Expand Up @@ -554,51 +554,79 @@ type repo = { org : string; name : string; branch : string }

type test_set = {
enable_commit_status : enable_commit_status;
mirage : repo;
mirage : repo option;
mirage_skeleton : repo;
mirage_dev : repo option;
build_mode : (string * repo) list Skeleton.build_mode;
}

let tests options =
let m4 =
Option.map
(fun enable_commit_status ->
{
enable_commit_status;
mirage = { org = "mirage"; name = "mirage"; branch = "main" };
mirage_dev =
Some { org = "mirage"; name = "mirage-dev"; branch = "master" };
mirage_skeleton =
{ org = "mirage"; name = "mirage-skeleton"; branch = "main" };
build_mode =
Skeleton.Mirage_4
{
overlay =
Some
[
( "opam-overlays",
{
org = "dune-universe";
name = "opam-overlays";
branch = "master";
} );
( "mirage-opam-overlays",
{
org = "dune-universe";
name = "mirage-opam-overlays";
branch = "main";
} );
];
};
})
options.mirage_4
in
Option.to_list m4

(* WE PERFORM TWO SETS OF TESTS
- mirage skeleton 'master' / mirage '3' / mirage-dev '3'
- mirage skeleton 'mirage-dev' / mirage 'main' / mirage-dev 'master' *)
Option.value ~default:[]
(Option.map
(fun enable_commit_status ->
[
{
enable_commit_status;
mirage = None;
mirage_skeleton =
{ org = "mirage"; name = "mirage-skeleton"; branch = "main" };
mirage_dev = None;
build_mode =
Skeleton.Mirage_4
{
overlay =
Some
[
( "opam-overlays",
{
org = "dune-universe";
name = "opam-overlays";
branch = "master";
} );
( "mirage-opam-overlays",
{
org = "dune-universe";
name = "mirage-opam-overlays";
branch = "main";
} );
];
};
};
{
enable_commit_status;
mirage = Some { org = "mirage"; name = "mirage"; branch = "main" };
mirage_skeleton =
{ org = "mirage"; name = "mirage-skeleton"; branch = "main" };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ org = "mirage"; name = "mirage-skeleton"; branch = "main" };
{ org = "mirage"; name = "mirage-skeleton"; branch = "dev" };

mirage_dev =
Some { org = "mirage"; name = "mirage-dev"; branch = "master" };
build_mode =
Skeleton.Mirage_4
{
overlay =
Some
[
( "opam-overlays",
{
org = "dune-universe";
name = "opam-overlays";
branch = "master";
} );
( "mirage-opam-overlays",
{
org = "dune-universe";
name = "mirage-opam-overlays";
branch = "main";
} );
];
};
};
])
options.mirage_4)

(* WE PERFORM TWO SET OF TESTS
- mirage skeleton 'main' / mirage released to opam repository
- mirage skeleton 'dev' / mirage 'main' / mirage-dev 'master'
*)
let make ~config ~options ~repos github =
let github_setup { branch; org; name } =
Github_repository.github_setup ~branch ~github org name
Expand All @@ -615,7 +643,7 @@ let make ~config ~options ~repos github =
}
->
let ctx = { config; enable_commit_status; repos } in
let mirage = github_setup mirage in
let mirage = Option.map github_setup mirage in
let mirage_skeleton = github_setup mirage_skeleton in
let mirage_dev = Option.map github_setup mirage_dev in
let build_mode =
Expand All @@ -638,7 +666,7 @@ let local ~config ~options ~repos =
in
tests options
|> List.map (fun { mirage; mirage_dev; mirage_skeleton; build_mode; _ } ->
let mirage = github_setup mirage in
let mirage = Option.map github_setup mirage in
let mirage_skeleton = github_setup mirage_skeleton in
let mirage_dev = Option.map github_setup mirage_dev in
let build_mode =
Expand Down