[ci] Add initial LUCI legacy analysis (#4428)

Adds new legacy analysis targets to LUCI in bringup mode.

Also updates the repo tooling to use a Flutter->Dart version mapping instead of having to separately maintain a Dart version, now that we already have such a map in the tool anyway.

Part of https://github.com/flutter/flutter/issues/114373
This commit is contained in:
stuartmorgan
2023-07-10 18:23:25 -04:00
committed by GitHub
parent 82f6fca839
commit b4c3424fb0
11 changed files with 67 additions and 20 deletions

View File

@ -228,6 +228,24 @@ targets:
channel: stable channel: stable
version_file: flutter_stable.version version_file: flutter_stable.version
# Analyze with the previous stable (N-1) and the stable before that (N-2). The
# versions in `channel` should be updated after a new major stable release.
- name: Linux analyze_legacy N-1
bringup: true # New target
recipe: packages/packages
timeout: 30
properties:
target_file: analyze_legacy.yaml
channel: "3.7.12"
- name: Linux analyze_legacy N-2
bringup: true # New target
recipe: packages/packages
timeout: 30
properties:
target_file: analyze_legacy.yaml
channel: "3.3.10"
- name: Linux_android custom_package_tests master - name: Linux_android custom_package_tests master
recipe: packages/packages recipe: packages/packages
timeout: 30 timeout: 30

23
.ci/scripts/analyze_legacy.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
# Allow analyzing packages that use a dev dependency with a higher minimum
# Flutter/Dart version than the package itself. Non-client code doesn't need to
# work in legacy versions.
#
# This requires the --lib-only flag below.
./script/tool_runner.sh remove-dev-dependencies
# This uses --run-on-dirty-packages rather than --packages-for-branch
# since only the packages changed by 'make-deps-path-based' need to be
# re-checked.
./script/tool_runner.sh analyze --lib-only \
--skip-if-not-supporting-flutter-version="$CHANNEL" \
--custom-analysis=script/configs/custom_analysis.yaml
# Restore the tree to a clean state, to avoid accidental issues if
# other script steps are added to the enclosing task.
git checkout .

0
.ci/scripts/dart_unit_tests_pathified.sh Normal file → Executable file
View File

View File

@ -12,4 +12,4 @@ tasks:
# the changes won't break analysis of other packages in the respository # the changes won't break analysis of other packages in the respository
# that depend on it. # that depend on it.
- name: analyze - pathified - name: analyze - pathified
script: .ci/scripts/pathified_analyze.sh script: .ci/scripts/analyze_pathified.sh

View File

@ -0,0 +1,11 @@
tasks:
- name: prepare tool
script: .ci/scripts/prepare_tool.sh
# Does a sanity check that packages at least pass analysis on the N-1 and N-2
# versions of Flutter stable if the package claims to support that version.
# This is to minimize accidentally making changes that break old versions
# (which we don't commit to supporting, but don't want to actively break)
# without updating the constraints.
# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#supported-flutter-versions
- name: analyze - legacy
script: .ci/scripts/analyze_legacy.sh

View File

@ -10,7 +10,7 @@ tasks:
args: ["license-check"] args: ["license-check"]
always: true always: true
# The major and minor version here should match the lowest version analyzed # The major and minor version here should match the lowest version analyzed
# in legacy version analysis (currently .cirrus.yaml legacy_version_analyze). # in legacy version analysis (.ci.yaml analyze_legacy).
- name: pubspec validation - name: pubspec validation
script: script/tool_runner.sh script: script/tool_runner.sh
args: args:

View File

@ -96,10 +96,8 @@ task:
# Change the arguments to pubspec-check when changing these values. # Change the arguments to pubspec-check when changing these values.
env: env:
CHANNEL: "3.7.12" CHANNEL: "3.7.12"
DART_VERSION: "2.17.6"
env: env:
CHANNEL: "3.3.10" CHANNEL: "3.3.10"
DART_VERSION: "2.18.6"
package_prep_script: package_prep_script:
# Allow analyzing packages that use a dev dependency with a higher # Allow analyzing packages that use a dev dependency with a higher
# minimum Flutter/Dart version than the package itself. # minimum Flutter/Dart version than the package itself.
@ -107,7 +105,7 @@ task:
analyze_script: analyze_script:
# Only analyze lib/; non-client code doesn't need to work on # Only analyze lib/; non-client code doesn't need to work on
# all supported legacy version. # all supported legacy version.
- ./script/tool_runner.sh analyze --lib-only --skip-if-not-supporting-flutter-version="$CHANNEL" --skip-if-not-supporting-dart-version="$DART_VERSION" --custom-analysis=script/configs/custom_analysis.yaml - ./script/tool_runner.sh analyze --lib-only --skip-if-not-supporting-flutter-version="$CHANNEL" --custom-analysis=script/configs/custom_analysis.yaml
- name: readme_excerpts - name: readme_excerpts
env: env:
CIRRUS_CLONE_SUBMODULES: true CIRRUS_CLONE_SUBMODULES: true

View File

@ -44,7 +44,9 @@ final Map<Version, Version> _dartSdkForFlutterSdk = <Version, Version>{
Version(3, 0, 0): Version(2, 17, 0), Version(3, 0, 0): Version(2, 17, 0),
Version(3, 0, 5): Version(2, 17, 6), Version(3, 0, 5): Version(2, 17, 6),
Version(3, 3, 0): Version(2, 18, 0), Version(3, 3, 0): Version(2, 18, 0),
Version(3, 3, 10): Version(2, 18, 6),
Version(3, 7, 0): Version(2, 19, 0), Version(3, 7, 0): Version(2, 19, 0),
Version(3, 7, 12): Version(2, 19, 6),
Version(3, 10, 0): Version(3, 0, 0), Version(3, 10, 0): Version(3, 0, 0),
}; };

View File

@ -90,19 +90,13 @@ abstract class PackageLoopingCommand extends PackageCommand {
argParser.addOption( argParser.addOption(
_skipByFlutterVersionArg, _skipByFlutterVersionArg,
help: 'Skip any packages that require a Flutter version newer than ' help: 'Skip any packages that require a Flutter version newer than '
'the provided version.', 'the provided version, or a Dart version newer than the '
); 'corresponding Dart version.',
argParser.addOption(
_skipByDartVersionArg,
help: 'Skip any packages that require a Dart version newer than '
'the provided version.',
); );
} }
static const String _skipByFlutterVersionArg = static const String _skipByFlutterVersionArg =
'skip-if-not-supporting-flutter-version'; 'skip-if-not-supporting-flutter-version';
static const String _skipByDartVersionArg =
'skip-if-not-supporting-dart-version';
/// Packages that had at least one [logWarning] call. /// Packages that had at least one [logWarning] call.
final Set<PackageEnumerationEntry> _packagesWithWarnings = final Set<PackageEnumerationEntry> _packagesWithWarnings =
@ -267,9 +261,9 @@ abstract class PackageLoopingCommand extends PackageCommand {
final Version? minFlutterVersion = minFlutterVersionArg.isEmpty final Version? minFlutterVersion = minFlutterVersionArg.isEmpty
? null ? null
: Version.parse(minFlutterVersionArg); : Version.parse(minFlutterVersionArg);
final String minDartVersionArg = getStringArg(_skipByDartVersionArg); final Version? minDartVersion = minFlutterVersion == null
final Version? minDartVersion = ? null
minDartVersionArg.isEmpty ? null : Version.parse(minDartVersionArg); : getDartSdkForFlutterSdk(minFlutterVersion);
final DateTime runStart = DateTime.now(); final DateTime runStart = DateTime.now();

View File

@ -373,15 +373,16 @@ void main() {
test('skips unsupported Dart versions when requested', () async { test('skips unsupported Dart versions when requested', () async {
final RepositoryPackage excluded = createFakePackage( final RepositoryPackage excluded = createFakePackage(
'excluded_package', packagesDir, 'excluded_package', packagesDir,
dartConstraint: '>=2.17.0 <4.0.0'); dartConstraint: '>=2.18.0 <4.0.0');
final RepositoryPackage included = final RepositoryPackage included =
createFakePackage('a_package', packagesDir); createFakePackage('a_package', packagesDir);
final TestPackageLoopingCommand command = createTestCommand( final TestPackageLoopingCommand command = createTestCommand(
packageLoopingType: PackageLoopingType.includeAllSubpackages, packageLoopingType: PackageLoopingType.includeAllSubpackages,
hasLongOutput: false); hasLongOutput: false);
final List<String> output = await runCommand(command, final List<String> output = await runCommand(command, arguments: <String>[
arguments: <String>['--skip-if-not-supporting-dart-version=2.14.0']); '--skip-if-not-supporting-flutter-version=3.0.0' // Flutter 3.0.0 -> Dart 2.17.0
]);
expect( expect(
command.checkedPackages, command.checkedPackages,
@ -396,7 +397,7 @@ void main() {
containsAllInOrder(<String>[ containsAllInOrder(<String>[
'${_startHeadingColor}Running for a_package...$_endColor', '${_startHeadingColor}Running for a_package...$_endColor',
'${_startHeadingColor}Running for excluded_package...$_endColor', '${_startHeadingColor}Running for excluded_package...$_endColor',
'$_startSkipColor SKIPPING: Does not support Dart 2.14.0$_endColor', '$_startSkipColor SKIPPING: Does not support Dart 2.17.0$_endColor',
])); ]));
}); });
}); });