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
6 changes: 3 additions & 3 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# * https://github.com/flutter/cocoon/blob/main/CI_YAML.md
enabled_branches:
- main
- release-go_router-\d+\.\d+\.\d+
- release-cupertino_ui-\d+\.\d+\.\d+
- release-material_ui-\d+\.\d+\.\d+
- release-go_router-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
- release-cupertino_ui-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
- release-material_ui-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
Comment on lines +10 to +12

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The regular expression [\w.] matches alphanumeric characters, underscores, and dots, but it does not match hyphens (-). According to the SemVer 2.0.0 specification, both pre-release identifiers and build metadata can contain hyphens (e.g., 1.0.0-alpha-1 or 1.0.0+build-123).\n\nTo fully support valid SemVer release branch names, the character class should be updated to include hyphens, i.e., [\w.-]. Note that the hyphen should be placed at the end of the character class to avoid being interpreted as a range.

  - release-go_router-\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?\n  - release-cupertino_ui-\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?\n  - release-material_ui-\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?


platform_properties:
linux:
Expand Down
8 changes: 5 additions & 3 deletions script/tool/lib/src/validators/repo_info_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -403,18 +403,20 @@ class RepoInfoValidator {
final enabledBranches = yaml['enabled_branches'] as YamlList?;
final bool hasBranchPattern =
enabledBranches != null &&
enabledBranches.contains(r'release-' + packageName + r'-\d+\.\d+\.\d+');
enabledBranches.contains(
r'release-' + packageName + r'-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?',
);

if (isBatchRelease && !hasBranchPattern) {
printError(
'${_indentation}Missing release branch pattern release-$packageName-\\d+\\.\\d+\\.\\d+ '
'${_indentation}Missing release branch pattern release-$packageName-\\d+\\.\\d+\\.\\d+(?:-[\\w.]+)?(?:\\+[\\w.]+)? '
'in enabled_branches in .ci.yaml\n'
'${_indentation}See https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/README.md#batch-release',
);
errors.add('Unexpected branch handling in .ci.yaml');
} else if (!isBatchRelease && hasBranchPattern) {
printError(
'${_indentation}Unexpected release branch pattern release-$packageName-\\d+\\.\\d+\\.\\d+ '
'${_indentation}Unexpected release branch pattern release-$packageName-\\d+\\.\\d+\\.\\d+(?:-[\\w.]+)?(?:\\+[\\w.]+)? '
'in enabled_branches in .ci.yaml',
);
errors.add('Unexpected branch handling in .ci.yaml');
Expand Down
8 changes: 4 additions & 4 deletions script/tool/test/validate_command_repo_info_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ release:
root.childFile('.ci.yaml').writeAsStringSync(r'''
enabled_branches:
- main
- release-a_package-\d+\.\d+\.\d+
- release-a_package-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
''');
}
}
Expand Down Expand Up @@ -991,7 +991,7 @@ enabled_branches:
output,
contains(
contains(
r'Missing release branch pattern release-a_package-\d+\.\d+\.\d+ in enabled_branches in .ci.yaml',
r'Missing release branch pattern release-a_package-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)? in enabled_branches in .ci.yaml',
),
),
);
Expand All @@ -1006,7 +1006,7 @@ enabled_branches:
root.childFile('.ci.yaml').writeAsStringSync(r'''
enabled_branches:
- main
- release-a_package-\d+\.\d+\.\d+
- release-a_package-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?
''');

Error? commandError;
Expand All @@ -1023,7 +1023,7 @@ enabled_branches:
output,
contains(
contains(
r'Unexpected release branch pattern release-a_package-\d+\.\d+\.\d+ in enabled_branches in .ci.yaml',
r'Unexpected release branch pattern release-a_package-\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)? in enabled_branches in .ci.yaml',
),
),
);
Expand Down
Loading