diff --git a/.ci.yaml b/.ci.yaml index 1687b69e18963..fdac6349508c9 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -385,6 +385,31 @@ targets: timeout: 120 properties: release_build: "true" + config_name: linux_web_engine_build + # Do not remove(https://github.com/flutter/flutter/issues/144644) + # Scheduler will fail to get the platform + drone_dimensions: + - os=Linux + dimensions: + # This is needed so that orchestrators that only spawn subbuilds are not + # assigned to the large 32 core workers when doing release builds. + # For more details see the issue + # at https://github.com/flutter/flutter/issues/152186. + cores: "8" + runIf: + - DEPS + - .ci.yaml + - lib/web_ui/** + - web_sdk/** + - tools/** + - ci/** + - flutter_frontend_server/** + + - name: Linux linux_web_engine_build + bringup: true + recipe: engine_v2/engine_v2 + timeout: 120 + properties: config_name: linux_web_engine # Do not remove(https://github.com/flutter/flutter/issues/144644) # Scheduler will fail to get the platform diff --git a/ci/builders/linux_web_engine.json b/ci/builders/linux_web_engine.json index f4159952eafc2..ce0950e9c5e87 100644 --- a/ci/builders/linux_web_engine.json +++ b/ci/builders/linux_web_engine.json @@ -25,17 +25,6 @@ "flutter/web_sdk:flutter_web_sdk_archive" ] }, - "archives": [ - { - "name": "wasm_release", - "base_path": "out/wasm_release/zip_archives/", - "type": "gcs", - "include_paths": [ - "out/wasm_release/zip_archives/flutter-web-sdk.zip" - ], - "realm": "production" - } - ], "generators": { "tasks": [ { diff --git a/ci/builders/linux_web_engine_build.json b/ci/builders/linux_web_engine_build.json new file mode 100644 index 0000000000000..6b7f2430ee881 --- /dev/null +++ b/ci/builders/linux_web_engine_build.json @@ -0,0 +1,55 @@ +{ + "_comment": "THIS IS A GENERATED FILE. Do not edit this file directly.", + "_comment2": "See `generate_builder_json.dart` for the generator code", + "builds": [ + { + "name": "web_tests/artifacts", + "drone_dimensions": [ + "device_type=none", + "os=Linux", + "cores=32" + ], + "gclient_variables": { + "download_android_deps": false, + "download_jdk": false, + "download_emsdk": true + }, + "gn": [ + "--web", + "--runtime-mode=release", + "--no-goma" + ], + "ninja": { + "config": "wasm_release", + "targets": [ + "flutter/web_sdk:flutter_web_sdk_archive" + ] + }, + "archives": [ + { + "name": "wasm_release", + "base_path": "out/wasm_release/zip_archives/", + "type": "gcs", + "include_paths": [ + "out/wasm_release/zip_archives/flutter-web-sdk.zip" + ], + "realm": "production" + } + ], + "generators": { + "tasks": [ + { + "name": "copy artifacts for web tests", + "parameters": [ + "test", + "--copy-artifacts" + ], + "scripts": [ + "flutter/lib/web_ui/dev/felt" + ] + } + ] + } + } + ] +} diff --git a/lib/web_ui/dev/generate_builder_json.dart b/lib/web_ui/dev/generate_builder_json.dart index d4263e423b357..f9d324f1fcf20 100644 --- a/lib/web_ui/dev/generate_builder_json.dart +++ b/lib/web_ui/dev/generate_builder_json.dart @@ -28,32 +28,63 @@ class GenerateBuilderJsonCommand extends Command { final FeltConfig config = FeltConfig.fromFile( path.join(environment.webUiTestDir.path, 'felt_config.yaml') ); - final String configString = generate(config, packageLock); - final io.File configFile = io.File(path.join( + + // Generate the config that only builds the engine, but does not run tests. + // This allows starting framework as soon as the engine is built, without + // waiting for the engine tests. This is also used to skip tests entirely + // when running in the merge queue. + final String buildConfigString = generateBuildConfig(config, packageLock); + final io.File buildConfigFile = io.File(path.join( + environment.flutterDirectory.path, + 'ci', + 'builders', + 'linux_web_engine_build.json', + )); + buildConfigFile.writeAsStringSync('$buildConfigString\n'); + + // Generate the config for the full build that includes both the engine + // build and tests. + final String buildAndTestConfigString = generate(config, packageLock); + final io.File buildAndTestConfigFile = io.File(path.join( environment.flutterDirectory.path, 'ci', 'builders', 'linux_web_engine.json', )); - configFile.writeAsStringSync('$configString\n'); + buildAndTestConfigFile.writeAsStringSync('$buildAndTestConfigString\n'); + return true; } + String generateBuildConfig(FeltConfig config, PackageLock packageLock) { + final Map outputJson = { + '_comment': 'THIS IS A GENERATED FILE. Do not edit this file directly.', + '_comment2': 'See `generate_builder_json.dart` for the generator code', + 'builds': [ + _getArtifactBuildStep(forTesting: false), + ], + }; + return const JsonEncoder.withIndent(' ').convert(outputJson); + } + String generate(FeltConfig config, PackageLock packageLock) { final Map outputJson = { '_comment': 'THIS IS A GENERATED FILE. Do not edit this file directly.', '_comment2': 'See `generate_builder_json.dart` for the generator code', 'builds': [ - _getArtifactBuildStep(), - for (final TestBundle bundle in config.testBundles) - _getBundleBuildStep(bundle), + _getArtifactBuildStep(forTesting: true), + if (true) + for (final TestBundle bundle in config.testBundles) + _getBundleBuildStep(bundle), ], 'tests': _getAllTestSteps(config.testSuites, packageLock) }; return const JsonEncoder.withIndent(' ').convert(outputJson); } - Map _getArtifactBuildStep() { + Map _getArtifactBuildStep({ + required bool forTesting, + }) { return { 'name': 'web_tests/artifacts', 'drone_dimensions': [ @@ -77,34 +108,36 @@ class GenerateBuilderJsonCommand extends Command { 'flutter/web_sdk:flutter_web_sdk_archive' ] }, - 'archives': [ - { - 'name': 'wasm_release', - 'base_path': 'out/wasm_release/zip_archives/', - 'type': 'gcs', - 'include_paths': [ - 'out/wasm_release/zip_archives/flutter-web-sdk.zip' - ], - 'realm': 'production', - } - ], - 'generators': { - 'tasks': [ + if (!forTesting) + 'archives': [ { - 'name': 'check licenses', - 'parameters': [ - 'check-licenses' + 'name': 'wasm_release', + 'base_path': 'out/wasm_release/zip_archives/', + 'type': 'gcs', + 'include_paths': [ + 'out/wasm_release/zip_archives/flutter-web-sdk.zip' ], - 'scripts': [ 'flutter/lib/web_ui/dev/felt' ], - - }, - { - 'name': 'web engine analysis', - 'parameters': [ - 'analyze' - ], - 'scripts': [ 'flutter/lib/web_ui/dev/felt' ], - }, + 'realm': 'production', + } + ], + 'generators': { + 'tasks': [ + if (forTesting) + { + 'name': 'check licenses', + 'parameters': [ + 'check-licenses' + ], + 'scripts': [ 'flutter/lib/web_ui/dev/felt' ], + }, + if (forTesting) + { + 'name': 'web engine analysis', + 'parameters': [ + 'analyze' + ], + 'scripts': [ 'flutter/lib/web_ui/dev/felt' ], + }, { 'name': 'copy artifacts for web tests', 'parameters': [