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
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: ci

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
push:
branches:
- main

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
Copy link

Choose a reason for hiding this comment

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

Honestly ubuntu is fine to start, but if the other two are easy/useful OK to leave them.


runs-on: ${{ matrix.os }}

name: 🧪 Test

env:
FLUTTER_STORAGE_BASE_URL: https://download.shorebird.dev
Copy link

Choose a reason for hiding this comment

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

Huh. Wild to see us explicitly set this. I wonder if we would rather wrap/fork the flutter script instead?

Copy link
Author

Choose a reason for hiding this comment

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

This seemed like the least invasive way since it will result in fewer merge conflicts over time but happy to change the script itself


steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4

- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1

- name: 📦 Install Dependencies
run: |
dart pub get -C ./dev/bots
dart pub get -C ./dev/tools

- name: 🧪 Run Tests
run: dart ./dev/bots/test.dart
74 changes: 38 additions & 36 deletions dev/bots/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const Map<String, List<String>> kWebTestFileKnownFailures = <String, List<String
};

const String kTestHarnessShardName = 'test_harness_tests';
const List<String> _kAllBuildModes = <String>['debug', 'profile', 'release'];
const List<String> _kAllBuildModes = <String>['release'];

// The seed used to shuffle tests. If not passed with
// --test-randomize-ordering-seed=<seed> on the command line, it will be set the
Expand Down Expand Up @@ -241,24 +241,24 @@ Future<void> main(List<String> args) async {
printProgress('Running task: ${Platform.environment[CIRRUS_TASK_NAME]}');
}
await selectShard(<String, ShardRunner>{
'add_to_app_life_cycle_tests': _runAddToAppLifeCycleTests,
'build_tests': _runBuildTests,
'framework_coverage': _runFrameworkCoverage,
// 'add_to_app_life_cycle_tests': _runAddToAppLifeCycleTests,
// 'build_tests': _runBuildTests,
// 'framework_coverage': _runFrameworkCoverage,
'framework_tests': _runFrameworkTests,
'tool_tests': _runToolTests,
// web_tool_tests is also used by HHH: https://dart.googlesource.com/recipes/+/refs/heads/master/recipes/dart/flutter_engine.py
'web_tool_tests': _runWebToolTests,
'tool_integration_tests': _runIntegrationToolTests,
'tool_host_cross_arch_tests': _runToolHostCrossArchTests,
// All the unit/widget tests run using `flutter test --platform=chrome --web-renderer=html`
'web_tests': _runWebHtmlUnitTests,
// All the unit/widget tests run using `flutter test --platform=chrome --web-renderer=canvaskit`
'web_canvaskit_tests': _runWebCanvasKitUnitTests,
// All web integration tests
'web_long_running_tests': _runWebLongRunningTests,
'flutter_plugins': _runFlutterPackagesTests,
'skp_generator': _runSkpGeneratorTests,
kTestHarnessShardName: _runTestHarnessTests, // Used for testing this script; also run as part of SHARD=framework_tests, SUBSHARD=misc.
// 'tool_tests': _runToolTests,
// // web_tool_tests is also used by HHH: https://dart.googlesource.com/recipes/+/refs/heads/master/recipes/dart/flutter_engine.py
// 'web_tool_tests': _runWebToolTests,
// 'tool_integration_tests': _runIntegrationToolTests,
// 'tool_host_cross_arch_tests': _runToolHostCrossArchTests,
// // All the unit/widget tests run using `flutter test --platform=chrome --web-renderer=html`
// 'web_tests': _runWebHtmlUnitTests,
// // All the unit/widget tests run using `flutter test --platform=chrome --web-renderer=canvaskit`
// 'web_canvaskit_tests': _runWebCanvasKitUnitTests,
// // All web integration tests
// 'web_long_running_tests': _runWebLongRunningTests,
// 'flutter_plugins': _runFlutterPackagesTests,
// 'skp_generator': _runSkpGeneratorTests,
// kTestHarnessShardName: _runTestHarnessTests, // Used for testing this script; also run as part of SHARD=framework_tests, SUBSHARD=misc.
});
} catch (error, stackTrace) {
foundError(<String>[
Expand Down Expand Up @@ -319,7 +319,8 @@ Future<void> _validateEngineHash() async {
Future<void> _runTestHarnessTests() async {
printProgress('${green}Running test harness tests...$reset');

await _validateEngineHash();
// TODO(felangel): flutter_test executable does not point to the shorebird engine revision.
// await _validateEngineHash();

// Verify that the tests actually return failure on failure and success on
// success.
Expand Down Expand Up @@ -399,10 +400,11 @@ Future<void> _runTestHarnessTests() async {
}

// Verify that we correctly generated the version file.
final String? versionError = await verifyVersion(File(path.join(flutterRoot, 'version')));
if (versionError != null) {
foundError(<String>[versionError]);
}
// TODO(felangel): teach shorebird to generate the correct version file
// final String? versionError = await verifyVersion(File(path.join(flutterRoot, 'version')));
// if (versionError != null) {
// foundError(<String>[versionError]);
// }
}

final String _toolsPath = path.join(flutterRoot, 'packages', 'flutter_tools');
Expand Down Expand Up @@ -978,10 +980,10 @@ Future<void> _runFrameworkTests() async {
Future<void> runMisc() async {
printProgress('${green}Running package tests$reset for directories other than packages/flutter');
await _runTestHarnessTests();
await runExampleTests();
await _runDartTest(path.join(flutterRoot, 'dev', 'bots'));
await _runDartTest(path.join(flutterRoot, 'dev', 'devicelab'), ensurePrecompiledTool: false); // See https://github.com/flutter/flutter/issues/86209
await _runDartTest(path.join(flutterRoot, 'dev', 'conductor', 'core'), forceSingleCore: true);
// await runExampleTests();
// await _runDartTest(path.join(flutterRoot, 'dev', 'bots'));
// await _runDartTest(path.join(flutterRoot, 'dev', 'devicelab'), ensurePrecompiledTool: false); // See https://github.com/flutter/flutter/issues/86209
// await _runDartTest(path.join(flutterRoot, 'dev', 'conductor', 'core'), forceSingleCore: true);
// TODO(gspencergoog): Remove the exception for fatalWarnings once https://github.com/flutter/flutter/issues/113782 has landed.
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'android_semantics_testing'), fatalWarnings: false);
await _runFlutterTest(path.join(flutterRoot, 'dev', 'integration_tests', 'ui'));
Expand All @@ -991,12 +993,12 @@ Future<void> _runFrameworkTests() async {
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'gen_keycodes'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'benchmarks', 'test_apps', 'stocks'));
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_driver'), tests: <String>[path.join('test', 'src', 'real_tests')]);
await _runFlutterTest(path.join(flutterRoot, 'packages', 'integration_test'), options: <String>[
'--enable-vmservice',
// Web-specific tests depend on Chromium, so they run as part of the web_long_running_tests shard.
'--exclude-tags=web',
]);
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_goldens'));
// await _runFlutterTest(path.join(flutterRoot, 'packages', 'integration_test'), options: <String>[
// '--enable-vmservice',
// // Web-specific tests depend on Chromium, so they run as part of the web_long_running_tests shard.
// '--exclude-tags=web',
// ]);
// await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_goldens'));
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_localizations'));
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter_test'));
await _runFlutterTest(path.join(flutterRoot, 'packages', 'fuchsia_remote_debug_protocol'));
Expand Down Expand Up @@ -1028,9 +1030,9 @@ Future<void> _runFrameworkTests() async {
}

await selectSubshard(<String, ShardRunner>{
'widgets': runWidgets,
'libraries': runLibraries,
'slow': runSlow,
// 'widgets': runWidgets,
// 'libraries': runLibraries,
// 'slow': runSlow,
'misc': runMisc,
});
}
Expand Down