diff --git a/CHANGES.md b/CHANGES.md index ea96be2e..b6917a9a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,11 @@ - Be able to allocate and use user's formatters for stdout/stderr (#399, @dinosaure) +- Stop detecting ocamlci specifically, since there's nothing specific + about it. Simply use the `CI` env var to detect CIs. Improve CI + detection. + (#397, @MisterDA) + ### 1.7.0 (2023-02-24) - Allow skipping a test case from inside the test case (#368, @apeschar) diff --git a/alcotest-help.txt b/alcotest-help.txt index 394b215b..31920740 100644 --- a/alcotest-help.txt +++ b/alcotest-help.txt @@ -108,7 +108,3 @@ ENVIRONMENT Whether Alcotest is running in GitHub Actions, if set to 'true'. Display tests errors and outputs GitHub Actions annotations. - OCAMLCI - Whether Alcotest is running in OCaml-CI, if set to 'true'. Display - tests errors. - diff --git a/src/alcotest-engine/cli.ml b/src/alcotest-engine/cli.ml index bf46e18c..aec807ad 100644 --- a/src/alcotest-engine/cli.ml +++ b/src/alcotest-engine/cli.ml @@ -44,7 +44,7 @@ module Make (P : Platform.MAKER) (M : Monad.S) : in Cmdliner.Cmd.Env.info "CI" ~doc - let github_action_env = + let github_actions_env = let doc = Printf.sprintf "Whether Alcotest is running in GitHub Actions, if set to %s. Display \ @@ -53,15 +53,6 @@ module Make (P : Platform.MAKER) (M : Monad.S) : in Cmdliner.Cmd.Env.info "GITHUB_ACTIONS" ~doc - let ocamlci_env = - let doc = - Printf.sprintf - "Whether Alcotest is running in OCaml-CI, if set to %s. Display tests \ - errors." - (Arg.doc_quote "true") - in - Cmdliner.Cmd.Env.info "OCAMLCI" ~doc - let alcotest_source_code_position = let doc = "Whether Alcotest should guess the source code position of test \ @@ -80,8 +71,7 @@ module Make (P : Platform.MAKER) (M : Monad.S) : let envs = [ ci_env; - github_action_env; - ocamlci_env; + github_actions_env; alcotest_source_code_position; alcotest_columns; ] diff --git a/src/alcotest-engine/config.ml b/src/alcotest-engine/config.ml index a2987105..5e703c9f 100644 --- a/src/alcotest-engine/config.ml +++ b/src/alcotest-engine/config.ml @@ -52,23 +52,15 @@ module Key = struct type t = ci let default = - let ci = - match Sys.getenv "CI" with - | "true" -> true - | _ | (exception Not_found) -> false - and github_actions = - match Sys.getenv "GITHUB_ACTIONS" with - | "true" -> true - | _ | (exception Not_found) -> false - and ocamlci = - match Sys.getenv "OCAMLCI" with - | "true" -> true + let getenv var = + match Sys.getenv var with + | "true" | "True" -> true | _ | (exception Not_found) -> false in - match (ci, github_actions, ocamlci) with - | true, true, false -> `Github_actions - | true, false, true -> `OCamlci - | true, false, false -> `Unknown + let ci = getenv "CI" and github_actions = getenv "GITHUB_ACTIONS" in + match (ci, github_actions) with + | true, true -> `Github_actions + | true, false -> `Unknown | _ -> `Disabled end diff --git a/src/alcotest-engine/config_intf.ml b/src/alcotest-engine/config_intf.ml index 8e28180f..82c5992f 100644 --- a/src/alcotest-engine/config_intf.ml +++ b/src/alcotest-engine/config_intf.ml @@ -4,7 +4,7 @@ module Types = struct type bound = [ `Unlimited | `Limit of int ] type filter = name:string -> index:int -> [ `Run | `Skip ] - type ci = [ `Github_actions | `OCamlci | `Unknown | `Disabled ] + type ci = [ `Github_actions | `Unknown | `Disabled ] (** All supported Continuous Integration (CI) systems. *) type t =