Skip to content
Merged
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
26 changes: 13 additions & 13 deletions .github/workflows/dart.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions mono_repo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 6.6.4

- Update to latest action versions.
- Require `sdk: ^3.7.0`.

## 6.6.3

- Update to latest action versions.
Expand Down
50 changes: 24 additions & 26 deletions mono_repo/lib/src/ci_shared.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ class CIJobEntry {
Map<String, List<CIJobEntry>> groupCIJobEntries(List<CIJobEntry> jobEntries) =>
groupBy<CIJobEntry, String>(
jobEntries,
(e) => [
...e.job.groupByKeys,
e.commands,
].join(':::'),
(e) => [...e.job.groupByKeys, e.commands].join(':::'),
);

void validateRootConfig(RootConfig rootConfig) {
Expand All @@ -83,17 +80,19 @@ void validateRootConfig(RootConfig rootConfig) {
continue;
}

final disallowedExplicitVersions = config.jobs
.map((tj) => tj.explicitSdkVersion)
.whereType<Version>()
.toSet()
.where((v) => !sdkConstraint.allows(v))
.toList()
..sort();
final disallowedExplicitVersions =
config.jobs
.map((tj) => tj.explicitSdkVersion)
.whereType<Version>()
.toSet()
.where((v) => !sdkConstraint.allows(v))
.toList()
..sort();

if (disallowedExplicitVersions.isNotEmpty) {
final disallowedString =
disallowedExplicitVersions.map((v) => '`$v`').join(', ');
final disallowedString = disallowedExplicitVersions
.map((v) => '`$v`')
.join(', ');
print(
yellow.wrap(
' There are jobs defined that are not compatible with '
Expand Down Expand Up @@ -129,15 +128,15 @@ void writeFile(

@visibleForTesting
List<String> scriptLines(String scriptPath) => [
'Make sure to mark `$scriptPath` as executable.',
' chmod +x $scriptPath',
if (Platform.isWindows) ...[
'It appears you are using Windows, and may not have access to chmod.',
'If you are using git, the following will emulate the Unix permissions '
'change:',
' git update-index --add --chmod=+x $scriptPath',
],
];
'Make sure to mark `$scriptPath` as executable.',
' chmod +x $scriptPath',
if (Platform.isWindows) ...[
'It appears you are using Windows, and may not have access to chmod.',
'If you are using git, the following will emulate the Unix permissions '
'change:',
' git update-index --add --chmod=+x $scriptPath',
],
];

/// Gives a map of command to unique task key for all [configs].
Map<String, String> extractCommands(Iterable<PackageConfig> configs) {
Expand Down Expand Up @@ -241,7 +240,8 @@ List<String> calculateOrderedStages(

throw UserException(
'Error parsing mono_repo.yaml',
details: 'One or more stage was referenced in `mono_repo.yaml` that do '
details:
'One or more stage was referenced in `mono_repo.yaml` that do '
'not exist in any `$monoPkgFileName` files: $items.',
);
}
Expand All @@ -252,9 +252,7 @@ List<String> calculateOrderedStages(
// as a secondary sort. This is an intuitive secondary sort order as it
// follows the order given in configuration files.
final keys = edges.keys.toList();
final edgeIndexes = {
for (var i = 0; i < keys.length; i++) keys[i]: i,
};
final edgeIndexes = {for (var i = 0; i < keys.length; i++) keys[i]: i};

// Orders by dependencies first, and detect cycles (which aren't allowed).
// Our edges here are actually reverse edges already, so a topological sort
Expand Down
3 changes: 2 additions & 1 deletion mono_repo/lib/src/ci_test_script.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ function $commandName() {
}''';
}

final bashScriptHeader = '''
final bashScriptHeader =
'''
#!/bin/bash
$createdWith

Expand Down
6 changes: 2 additions & 4 deletions mono_repo/lib/src/commands/check.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ Map<String, PackageReport> getPackageReports(RootConfig rootConfig) {
final siblings = rootConfig.map((pc) => pc.pubspec).toSet();
return Map.fromEntries(
rootConfig.map(
(p) => MapEntry(
p.relativePath,
PackageReport.create(p.pubspec, siblings),
),
(p) =>
MapEntry(p.relativePath, PackageReport.create(p.pubspec, siblings)),
),
);
}
Expand Down
26 changes: 7 additions & 19 deletions mono_repo/lib/src/commands/ci_script/generate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,12 @@ import '../../user_exception.dart';

const ciScriptPath = 'tool/ci.sh';

void generateCIScript(
RootConfig rootConfig, {
bool validateOnly = false,
}) {
void generateCIScript(RootConfig rootConfig, {bool validateOnly = false}) {
final ciScript = _GeneratedCIScript.generate(rootConfig).ciScript;
if (validateOnly) {
_validateFile(
rootConfig.rootDirectory,
ciScript,
ciScriptPath,
);
_validateFile(rootConfig.rootDirectory, ciScript, ciScriptPath);
} else {
writeFile(
rootConfig.rootDirectory,
ciScriptPath,
ciScript,
isScript: true,
);
writeFile(rootConfig.rootDirectory, ciScriptPath, ciScript, isScript: true);
}
}

Expand All @@ -57,10 +45,10 @@ class _GeneratedCIScript {
/// the `--validate` option.
class CIScriptOutOfDateException extends UserException {
CIScriptOutOfDateException()
: super(
'Generated ci script is out of date',
details: 'Rerun `mono_repo generate` to update the generated script',
);
: super(
'Generated ci script is out of date',
details: 'Rerun `mono_repo generate` to update the generated script',
);
}

/// Checks [expectedPath] versus the content in [expectedContent].
Expand Down
22 changes: 6 additions & 16 deletions mono_repo/lib/src/commands/dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ class DartCommand extends MonoRepoCommand {
'packages.';

@override
Future<void> run() => dart(
rootConfig(),
arguments,
executableForPackage,
);
Future<void> run() => dart(rootConfig(), arguments, executableForPackage);

/// The arguments to pass to the executable.
List<String> get arguments => argResults?.rest ?? const [];
Expand Down Expand Up @@ -61,10 +57,7 @@ Future<void> dart(

print('');
print(
wrapWith(
'`$dir`: Starting `${args.join(' ')}`',
[styleBold, lightBlue],
),
wrapWith('`$dir`: Starting `${args.join(' ')}`', [styleBold, lightBlue]),
);
final workingDir = p.join(rootConfig.rootDirectory, dir);

Expand Down Expand Up @@ -116,14 +109,11 @@ final String _dartPath = p.join(_sdkDir, 'bin', 'dart');
/// The "flutter[.bat]" command.
final String _flutterPath = Platform.isWindows ? 'flutter.bat' : 'flutter';

enum Executable {
dart,
flutter,
}
enum Executable { dart, flutter }

extension ExecutablePath on Executable {
String get path => switch (this) {
Executable.dart => _dartPath,
Executable.flutter => _flutterPath,
};
Executable.dart => _dartPath,
Executable.flutter => _flutterPath,
};
}
3 changes: 2 additions & 1 deletion mono_repo/lib/src/commands/generate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class GenerateCommand extends MonoRepoCommand {
argParser.addFlag(
'validate',
negatable: false,
help: 'Validates that the existing CI config is up to date with '
help:
'Validates that the existing CI config is up to date with '
'the current configuration. Does not write any files.',
);
}
Expand Down
26 changes: 13 additions & 13 deletions mono_repo/lib/src/commands/github/action_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@ enum ActionInfo implements Comparable<ActionInfo> {
}

Job _coverageCompletionJob(RootConfig rootConfig) => Job(
name: 'Mark Coveralls job finished',
runsOn: 'ubuntu-latest',
steps: [
ActionInfo.coveralls.usage(
name: 'Mark Coveralls job finished',
runsOn: 'ubuntu-latest',
steps: [
ActionInfo.coveralls.usage(
name: 'Mark Coveralls job finished',
withContent: {
// https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
'github-token': r'${{ secrets.GITHUB_TOKEN }}',
'parallel-finished': true,
},
versionOverrides: rootConfig.existingActionVersions,
),
],
);
withContent: {
// https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
'github-token': r'${{ secrets.GITHUB_TOKEN }}',
'parallel-finished': true,
},
versionOverrides: rootConfig.existingActionVersions,
),
],
);

/// Allows finding [ActionInfo] for a corresponding [Step].
final _actionInfoExpando = Expando<ActionInfo>();
Expand Down
8 changes: 4 additions & 4 deletions mono_repo/lib/src/commands/github/action_versions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//
// To regenerate it, run the `tool/generate_action_versions.dart` script.

const actionsCacheVersion = 'd4323d4df104b026a6aa633fdb11d772146be0bf';
const actionsCacheVersion = '0057852bfaa89a56745cba8c7296529d2fc39830';
const dartLangSetupDartVersion = 'e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c';
const actionsCheckoutVersion = '11bd71901bbe5b1630ceea73d27597364c9af683';
const subositoFlutterActionVersion = 'f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff';
const actionsCheckoutVersion = '08c6903cd8c0fde910a37f88322edcfb5dd907a8';
const subositoFlutterActionVersion = 'fd55f4c5af5b953cc57a2be44cb082c8f6635e8e';
const coverallsappGithubActionVersion =
'648a8eb78e6d50909eff900e4ec85cab4524a45b';
const codecovCodecovActionVersion = '0565863a31f2c772f9f0395002a31e3f06189574';
const codecovCodecovActionVersion = '5a1091511ad55cbe89839c7260b706298ca349f7';
Loading