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
43 changes: 0 additions & 43 deletions app_dart/lib/src/service/scheduler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -892,26 +892,6 @@ $s
)
.toList();

// See https://github.com/flutter/flutter/issues/138430.
final includePostsubmitAsPresubmit = _includePostsubmitAsPresubmit(
inner,
pullRequest,
);
if (includePostsubmitAsPresubmit) {
log.info(
'Including postsubmit targets as presubmit for ${pullRequest.number}',
);

for (var target in inner.postsubmitTargets) {
// We don't want to include a presubmit twice
// We don't want to run the builder_cache target as a presubmit
if (!target.presubmit &&
!target.getProperties().containsKey('cache_name')) {
presubmitTargets.add(target);
}
}
}

log.info('Collected ${presubmitTargets.length} presubmit targets.');
// Release branches should run every test.
if (pullRequest.base!.ref !=
Expand All @@ -921,12 +901,6 @@ $s
);
return presubmitTargets;
}
if (includePostsubmitAsPresubmit) {
log.info(
'Postsubmit targets included as presubmit, scheduling all targets for ${pullRequest.number}',
);
return presubmitTargets;
}

// Filter builders based on the PR diff
final filesChanged = await _getFilesChanged.get(
Expand All @@ -936,23 +910,6 @@ $s
return getTargetsToRun(presubmitTargets, filesChanged);
}

static final _allowTestAll = {Config.flutterSlug};

/// Returns `true` if [ciYaml.postsubmitTargets] should be ran during presubmit.
static bool _includePostsubmitAsPresubmit(
CiYaml ciYaml,
PullRequest pullRequest,
) {
if (!_allowTestAll.contains(ciYaml.slug)) {
return false;
}
if (pullRequest.labels?.any((label) => label.name.contains('test: all')) ??
false) {
return true;
}
return false;
}

/// Process a completed GitHub `check_run`.
///
/// Handles both fusion engine build and test stages, and both pull requests
Expand Down
93 changes: 0 additions & 93 deletions app_dart/test/service/scheduler_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2139,99 +2139,6 @@ targets:
);
});

group('treats postsubmit as presubmit if a label is present', () {
final runAllTests = IssueLabel(name: 'test: all');
setUp(() async {
ciYamlFetcher.setCiYamlFrom(r'''
enabled_branches:
- main
- master
targets:
- name: Linux Presubmit
presubmit: true
scheduler: luci
- name: Linux Conditional Presubmit (runIf)
presubmit: true
scheduler: luci
runIf:
- .ci.yaml
- DEPS
- dev/run_if/**
- name: Linux Postsubmit
presubmit: false
scheduler: luci
- name: Linux Cache
presubmit: false
scheduler: luci
properties:
cache_name: "builder"
''');
});

test('with a specific label in the flutter/engine repo', () async {
final enginePr = generatePullRequest(
branch: Config.defaultBranch(Config.flutterSlug),
labels: <IssueLabel>[runAllTests],
repo: Config.flutterSlug.name,
);
final presubmitTargets = await scheduler.getPresubmitTargets(
enginePr,
);
expect(presubmitTargets.map((Target target) => target.name).toList(), <
String
>[
// Always runs.
'Linux Presubmit',
// test: all label is present, so runIf is skipped.
'Linux Conditional Presubmit (runIf)',
// test: all label is present, so postsubmit is treated as presubmit.
'Linux Postsubmit',
]);
});

test('with a specific label in the flutter/flutter repo', () async {
final frameworkPr = generatePullRequest(
branch: Config.defaultBranch(Config.flutterSlug),
labels: <IssueLabel>[runAllTests],
repo: Config.flutterSlug.name,
);
final presubmitTargets = await scheduler.getPresubmitTargets(
frameworkPr,
);
expect(presubmitTargets.map((Target target) => target.name).toList(), <
String
>[
// Always runs.
'Linux Presubmit',
// test: all label is present, so runIf is skipped.
'Linux Conditional Presubmit (runIf)',
// test: all label is present, so postsubmit is treated as presubmit.
'Linux Postsubmit',
]);
});

test('without a specific label', () async {
final enginePr = generatePullRequest(
branch: Config.defaultBranch(Config.flutterSlug),
labels: <IssueLabel>[],
repo: Config.flutterSlug.name,
);

// Assume a file that is not runIf'd was changed.
getFilesChanged.cannedFiles = ['README.md'];
final presubmitTargets = await scheduler.getPresubmitTargets(
enginePr,
);
expect(
presubmitTargets.map((Target target) => target.name).toList(),
<String>[
// Always runs.
'Linux Presubmit',
],
);
});
});

test('checks for release branches', () async {
const branch = 'flutter-1.24-candidate.1';
ciYamlFetcher.setCiYamlFrom(r'''
Expand Down