Skip to content

Commit

Permalink
Merge branch 'flutter:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoamador authored Dec 13, 2023
2 parents 0ba9af5 + 61aee79 commit 52d42f0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app_dart/integration_test/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void expectNoDiff(String path) {

/// Wrapper class to make it easy to add new repos + branches to the validation suite.
class SupportedConfig {
SupportedConfig(this.slug, [this.branch = 'master']);
SupportedConfig(this.slug, [this.branch = 'main']);

final RepositorySlug slug;
final String branch;
Expand Down
19 changes: 10 additions & 9 deletions app_dart/integration_test/validate_all_ci_configs_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import 'common.dart';

/// List of repositories that have supported .ci.yaml config files.
final List<SupportedConfig> configs = <SupportedConfig>[
SupportedConfig(RepositorySlug('flutter', 'cocoon'), 'main'),
SupportedConfig(RepositorySlug('flutter', 'engine'), 'main'),
SupportedConfig(RepositorySlug('flutter', 'cocoon')),
SupportedConfig(RepositorySlug('flutter', 'engine')),
SupportedConfig(RepositorySlug('flutter', 'flutter')),
SupportedConfig(RepositorySlug('flutter', 'packages'), 'main'),
SupportedConfig(RepositorySlug('flutter', 'packages')),
];

Future<void> main() async {
Expand Down Expand Up @@ -57,6 +57,13 @@ Future<void> main() async {
);
final YamlMap configYaml = loadYaml(configContent) as YamlMap;
final pb.SchedulerConfig schedulerConfig = pb.SchedulerConfig()..mergeFromProto3Json(configYaml);
// Validate using the existing CiYaml logic.
CiYaml(
slug: config.slug,
branch: config.branch,
config: schedulerConfig,
validate: true,
);

final List<String> githubBranches = getBranchesForRepository(config.slug);

Expand All @@ -81,11 +88,6 @@ Future<void> main() async {
}
}

if (config.slug.name == 'engine') {
print(githubBranches);
print(validEnabledBranches);
}

// Verify the enabled branches
for (String enabledBranch in validEnabledBranches.keys) {
expect(
Expand All @@ -95,7 +97,6 @@ Future<void> main() async {
);
}
},
skip: config.slug.name == 'flutter',
);
}
}
Expand Down
10 changes: 10 additions & 0 deletions app_dart/lib/src/model/ci_yaml/ci_yaml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class CiYaml {
/// 5. [pb.Target] should not depend on self
/// 6. [pb.Target] cannot have more than 1 dependency
/// 7. [pb.Target] should depend on target that already exist in depedency graph, and already recorded in map [targetGraph]
/// 8. [pb.Target] has an empty runIf or the runIf includes `.ci.yaml` and `DEPS if on the engine repo.
void _validate(pb.SchedulerConfig schedulerConfig, String branch, {pb.SchedulerConfig? totSchedulerConfig}) {
if (schedulerConfig.targets.isEmpty) {
throw const FormatException('Scheduler config must have at least 1 target');
Expand Down Expand Up @@ -251,6 +252,15 @@ class CiYaml {
}
}
}
// Verify runIf includes foundational files.
if (target.runIf.isNotEmpty) {
if (!target.runIf.contains('.ci.yaml')) {
exceptions.add('ERROR: ${target.name} is missing `.ci.yaml` in runIf');
}
if (slug == Config.engineSlug && !target.runIf.contains('DEPS')) {
exceptions.add('ERROR: ${target.name} is missing `DEPS` in runIf');
}
}
}

/// Check the dependencies for the current target if it is viable and to
Expand Down
3 changes: 3 additions & 0 deletions app_dart/test/service/scheduler_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ targets:
scheduler: luci
- name: Linux runIf
runIf:
- .ci.yaml
- dev/**
- name: Google Internal Roll
postsubmit: true
Expand Down Expand Up @@ -708,6 +709,8 @@ targets:
presubmit: true
scheduler: luci
runIf:
- .ci.yaml
- DEPS
- dev/run_if/**
- name: Linux Conditional Presubmit (runIfNot)
presubmit: true
Expand Down

0 comments on commit 52d42f0

Please sign in to comment.