detect
Which CI service the environment belongs to, if any.
The environment is a parameter, not read behind your back: pass a lookup such as
&|name| std::env::var(name).ok(), or a closure over a map in a test. The known services are
recognized by their own variables (GITHUB_ACTIONS, GITLAB_CI, CIRCLECI, …); any other
environment with a truthy CI variable is Provider::Other. A variable is truthy unless it
is empty, 0 or false (case-insensitive).
Import
Section titled “Import”Cargo feature ci (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
get | &dyn Fn(&str) -> Option<String> | Looks a variable up by name. |
Returns
Section titled “Returns”Option<Provider> — The Provider, or None outside CI.
