packageRunCi function
Runs the CI steps (pub get, format check, analyze, tests, web build) of
the dart or flutter package in path, as the run_ci executable does.
options selects the steps (analyzeOnly, noTest, vmTestOnly...),
the no..., verbose and pubUpgrade parameters are shortcuts used when
options is null.
if recursive (or PackageRunCiOptions.recursive) is true, it also runs
the packages found below path (false by default, unlike the
executable), poolSize at a time (default to 4).
Throws a ShellException when a step fails, unless
PackageRunCiOptions.ignoreErrors.
// run CI (format, analyze, test) on the current folder
await packageRunCi('.');
Implementation
Future<void> packageRunCi(
String path, {
PackageRunCiOptions? options,
bool? recursive,
bool? noFormat,
bool? noAnalyze,
bool? noTest,
bool? noBuild,
bool? noPubGet,
bool? verbose,
bool? pubUpgrade,
int? poolSize,
/// Internally a pub cache is used
/// for a given action
/// If set to false or unset, a new cache is created
/// If set to true, no cache is used, unless a one exists
bool? noPubWorkspaceCache,
}) async {
noPubWorkspaceCache ??= false;
if (!noPubWorkspaceCache) {
runCiInitPubWorkspacesCache();
}
options ??= PackageRunCiOptions(
noPubGet: noPubGet ?? false,
noTest: noTest ?? false,
noFormat: noFormat ?? false,
noAnalyze: noAnalyze ?? false,
noBuild: noBuild ?? false,
verbose: verbose ?? false,
poolSize: poolSize,
recursive: recursive ?? false,
pubUpgradeOnly: pubUpgrade ?? false,
);
await packageRunCiImpl(
path,
options,
recursive: recursive ?? options.recursive,
poolSize: poolSize ?? options.poolSize,
);
}