1
0
mirror of https://github.com/flutter/samples.git synced 2026-04-16 03:52:35 +00:00
Configure CI to skip samples that only fail in beta
This commit is contained in:
Eric Windmill
2026-04-14 16:49:05 -07:00
committed by GitHub
parent dcaf555586
commit 7a04286eb7
22 changed files with 267 additions and 399 deletions

View File

@@ -1,69 +0,0 @@
name: Beta Branch CI
# Declare default permissions as read only.
permissions: read-all
on:
push:
branches: [beta]
pull_request:
branches: [beta]
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
# Test all samples on the beta channel. Since the beta channel will soon be
# promoted to stable, this branch is only concerned with the beta.
Beta-CI:
name: Test flutter beta channel
runs-on: ${{ matrix.os }}
if: github.repository == 'flutter/samples'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046
with:
channel: beta
- run: flutter pub get && dart tool/ci_script.dart
# Verify the Android add-to-app samples build and pass tests with the beta
# channel.
android-build:
runs-on: ubuntu-latest
if: github.repository == 'flutter/samples'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046
with:
channel: beta
- run: ./tool/android_ci_script.sh
# Verify the iOS add-to-app samples build and pass tests with the beta
# channel.
# ios-build:
# runs-on: macos-latest
# if: github.repository == 'flutter/samples'
# steps:
# - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
# - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
# with:
# distribution: 'zulu'
# java-version: '17'
# - uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046
# with:
# channel: beta
# - run: ./tool/ios_ci_script.sh

View File

@@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
flutter_version: [stable, beta]
flutter_version: [stable]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd

View File

@@ -13,22 +13,25 @@ class SheetPage extends StatelessWidget {
onPressed: () {
Navigator.of(context).push(
CupertinoSheetRoute<void>(
builder: (BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: const Text('Sheet'),
trailing: GestureDetector(
child: const Icon(CupertinoIcons.xmark),
onTap: () {
Navigator.of(context).pop();
},
),
),
child: const Center(
child: Text('This is a sheet'),
),
);
},
scrollableBuilder:
(BuildContext context, ScrollController controller) {
Widget widgetBuilder(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: const Text('Sheet'),
trailing: GestureDetector(
child: const Icon(CupertinoIcons.xmark),
onTap: () {
Navigator.of(context).pop();
},
),
),
child: const Center(child: Text('This is a sheet')),
);
}
return widgetBuilder(context);
},
),
);
},

View File

@@ -0,0 +1,28 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
//
// Generated file. Do not edit.
//
import PackageDescription
let package = Package(
name: "FlutterGeneratedPluginSwiftPackage",
platforms: [
.iOS("13.0")
],
products: [
.library(name: "FlutterGeneratedPluginSwiftPackage", type: .static, targets: ["FlutterGeneratedPluginSwiftPackage"])
],
dependencies: [
.package(name: "url_launcher_ios", path: "../.packages/url_launcher_ios")
],
targets: [
.target(
name: "FlutterGeneratedPluginSwiftPackage",
dependencies: [
.product(name: "url-launcher-ios", package: "url_launcher_ios")
]
)
]
)

View File

@@ -0,0 +1,32 @@
#
# Generated file, do not edit.
#
import lldb
def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
base = frame.register["x0"].GetValueAsAddress()
page_len = frame.register["x1"].GetValueAsUnsigned()
# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
# first page to see if handled it correctly. This makes diagnosing
# misconfiguration (e.g. missing breakpoint) easier.
data = bytearray(page_len)
data[0:8] = b'IHELPED!'
error = lldb.SBError()
frame.GetThread().GetProcess().WriteMemory(base, data, error)
if not error.Success():
print(f'Failed to write into {base}[+{page_len}]', error)
return
def __lldb_init_module(debugger: lldb.SBDebugger, _):
target = debugger.GetDummyTarget()
# Caveat: must use BreakpointCreateByRegEx here and not
# BreakpointCreateByName. For some reasons callback function does not
# get carried over from dummy target for the later.
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
bp.SetAutoContinue(True)
print("-- LLDB integration loaded --")

View File

@@ -0,0 +1,5 @@
#
# Generated file, do not edit.
#
command script import --relative-to-command-file flutter_lldb_helper.py

View File

@@ -0,0 +1 @@
/Users/ewindmill/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/

View File

@@ -0,0 +1,11 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/ewindmill/development/flutter
FLUTTER_APPLICATION_PATH=/Users/ewindmill/development/samples/gemini_tasks
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=.dart_tool/package_config.json

View File

@@ -0,0 +1,28 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
//
// Generated file. Do not edit.
//
import PackageDescription
let package = Package(
name: "FlutterGeneratedPluginSwiftPackage",
platforms: [
.macOS("10.15")
],
products: [
.library(name: "FlutterGeneratedPluginSwiftPackage", type: .static, targets: ["FlutterGeneratedPluginSwiftPackage"])
],
dependencies: [
.package(name: "url_launcher_macos", path: "../.packages/url_launcher_macos")
],
targets: [
.target(
name: "FlutterGeneratedPluginSwiftPackage",
dependencies: [
.product(name: "url-launcher-macos", package: "url_launcher_macos")
]
)
]
)

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/ewindmill/development/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/ewindmill/development/samples/gemini_tasks"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"

View File

@@ -0,0 +1 @@
/Users/ewindmill/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.4/

View File

@@ -61,3 +61,8 @@ skip_ci:
- add_to_app/multiple_flutters/multiple_flutters_module
- add_to_app/plugin/flutter_module_using_plugin
- add_to_app/prebuilt_module/flutter_module
skip_ci_beta:
- material_3_demo
# TODO(ewindmill): info - lib/basic_text_input_client.dart:262:11 - 'setStyle' is deprecated and shouldn't be used. Use updateStyle instead. This feature was deprecated after v3.41.0-0.0.pre. Try replacing the use of the deprecated member with the replacement. - deprecated_member_use on beta branch
- simplistic_editor

View File

@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';
@@ -8,19 +9,39 @@ Future<void> main() async {
final pubspecContent = await pubspecFile.readAsString();
final pubspecYaml = loadYaml(pubspecContent);
// contains full list of samples
final workspace = pubspecYaml['workspace'] as YamlList?;
if (workspace == null) {
print('No workspace found in pubspec.yaml');
exit(1);
}
// CI always skips the samples on this list
final skipCiList = pubspecYaml['skip_ci'] as YamlList?;
// CI will also skip for samples on specific branches
// This is useful when API changes in the beta branch are causing CI to fail
// and there isn't a solution that works in both beta and main
final channel = await _getFlutterChannel();
print('Current Flutter channel: $channel');
final channelSkipKey = 'skip_ci_$channel';
final channelSkipList = pubspecYaml[channelSkipKey] as YamlList?;
if (channelSkipList != null) {
print('Applying skips for channel "$channel": $channelSkipList');
}
// pub workspace, only run 'get' once
await _runCommand('flutter', ['pub', 'get'], workingDirectory: rootDir.path);
final packages = workspace
.where((e) => skipCiList == null || !skipCiList.contains(e))
.where((e) {
if (skipCiList != null && skipCiList.contains(e)) return false;
if (channelSkipList != null && channelSkipList.contains(e))
return false;
return true;
})
.map((e) => e.toString())
.toList();
@@ -70,3 +91,23 @@ Future<void> _runCommand(
exit(exitCode);
}
}
Future<String> _getFlutterChannel() async {
try {
final result = await Process.run('flutter', [
'--version',
'--machine',
], runInShell: true);
if (result.exitCode != 0) {
print('Flutter version command failed with exit code ${result.exitCode}');
print('Stdout: ${result.stdout}');
print('Stderr: ${result.stderr}');
return 'unknown';
}
final machineInfo = jsonDecode(result.stdout as String);
return machineInfo['channel'] as String? ?? 'unknown';
} catch (e) {
print('Error detecting Flutter channel: $e');
return 'unknown';
}
}

76
tool/clean_all.dart Normal file
View File

@@ -0,0 +1,76 @@
import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';
/// Runs `flutter clean` in every package listed in the root pubspec.yaml
/// workspace. Useful for clearing stale build artifacts after switching Flutter
/// channels.
Future<void> main() async {
final rootDir = Directory.current;
final pubspecFile = File(path.join(rootDir.path, 'pubspec.yaml'));
final pubspecContent = await pubspecFile.readAsString();
final pubspecYaml = loadYaml(pubspecContent);
final workspace = pubspecYaml['workspace'] as YamlList?;
if (workspace == null) {
print('No workspace found in pubspec.yaml');
exit(1);
}
final flutterBin = _resolveFlutterBin();
print('Using flutter: $flutterBin');
var cleaned = 0;
var skipped = 0;
for (final entry in workspace) {
final package = entry.toString();
final packagePath = path.join(rootDir.path, package);
// Only clean packages that have a pubspec.yaml (i.e. are Flutter/Dart pkgs)
final pubspec = File(path.join(packagePath, 'pubspec.yaml'));
if (!await pubspec.exists()) {
print('-- Skipping \'$package\' (no pubspec.yaml found)');
skipped++;
continue;
}
print('== Cleaning \'$package\' ==');
final process = await Process.start(
flutterBin,
['clean'],
workingDirectory: packagePath,
runInShell: true,
mode: ProcessStartMode.inheritStdio,
);
final exitCode = await process.exitCode;
if (exitCode != 0) {
print(
'Warning: flutter clean failed with exit code $exitCode in $packagePath',
);
} else {
cleaned++;
}
}
print('');
print('Done. Cleaned $cleaned package(s), skipped $skipped.');
}
/// Resolves the path to the `flutter` binary by finding it relative to the
/// running Dart SDK. Falls back to 'flutter' (uses PATH) if not found.
String _resolveFlutterBin() {
// Platform.resolvedExecutable points to the dart binary, e.g.:
// /path/to/flutter/bin/cache/dart-sdk/bin/dart
// Flutter binary is at /path/to/flutter/bin/flutter
final dartBin = File(Platform.resolvedExecutable);
final flutterBin = path.join(
dartBin.parent.parent.parent.parent.path,
'bin',
'flutter',
);
if (File(flutterBin).existsSync()) {
return flutterBin;
}
return 'flutter'; // fallback to PATH
}

View File

@@ -1,62 +0,0 @@
#!/bin/bash
set -e
DIR="${BASH_SOURCE%/*}"
source "$DIR/flutter_ci_script_shared.sh"
flutter doctor -v
declare -ar PROJECT_NAMES=(
"add_to_app/android_view/flutter_module_using_plugin"
"add_to_app/books/flutter_module_books"
"add_to_app/fullscreen/flutter_module"
"add_to_app/multiple_flutters/multiple_flutters_module"
"add_to_app/plugin/flutter_module_using_plugin"
"add_to_app/prebuilt_module/flutter_module"
"analysis_defaults"
"android_splash_screen"
"animations"
"asset_transformation"
"background_isolate_channels"
"code_sharing/client"
"code_sharing/server"
"code_sharing/shared"
"compass_app/app"
"compass_app/server"
"context_menus"
"deeplink_store_example"
"desktop_photo_search/fluent_ui"
"desktop_photo_search/material"
"dynamic_theme"
"flutter_maps_firestore"
"form_app"
"game_template"
"google_maps"
"infinite_list"
"ios_app_clip"
# TODO(ewindmill): replace deprecated activeColor with activeThumbColor in 3.33
# "isolate_example"
# TODO(ewindmill) - RadioGroup api changed.
# "material_3_demo"
"navigation_and_routing"
# TODO(domesticmouse): Angle brackets will be interpreted as HTML.
# "pedometer"
"pedometer/example"
"place_tracker"
"platform_channels"
"platform_design"
"platform_view_swift"
"provider_counter"
"provider_shopper"
"simple_shader"
"simplistic_calculator"
"simplistic_editor"
"testing_app"
"veggieseasons"
"web_embedding/element_embedding_demo"
)
ci_projects "beta" "${PROJECT_NAMES[@]}"
echo "-- Success --"

View File

@@ -1,65 +0,0 @@
#!/bin/bash
set -e
DIR="${BASH_SOURCE%/*}"
source "$DIR/flutter_ci_script_shared.sh"
flutter doctor -v
declare -ar PROJECT_NAMES=(
"add_to_app/android_view/flutter_module_using_plugin"
"add_to_app/books/flutter_module_books"
"add_to_app/fullscreen/flutter_module"
"add_to_app/multiple_flutters/multiple_flutters_module"
"add_to_app/plugin/flutter_module_using_plugin"
"add_to_app/prebuilt_module/flutter_module"
"analysis_defaults"
"android_splash_screen"
"animations"
"asset_transformation"
"background_isolate_channels"
"code_sharing/client"
# TODO(ewindmill): The integration tests are failing
# "code_sharing/server"
"code_sharing/shared"
"compass_app/app"
# TODO(ewindmill): The integration tests are failing
# "compass_app/server"
"context_menus"
"date_planner"
"deeplink_store_example"
"desktop_photo_search/fluent_ui"
"desktop_photo_search/material"
"dynamic_theme"
"flutter_maps_firestore"
"form_app"
"game_template"
"google_maps"
"infinite_list"
"ios_app_clip"
# TODO(ewindmill): replace deprecated activeColor with activeThumbColor in 3.33
# "isolate_example"
# TODO(ewindmill) - RadioGroup api changed.
# "material_3_demo"
"navigation_and_routing"
# TODO(domesticmouse): Angle brackets will be interpreted as HTML.
# "pedometer"
"pedometer/example"
"place_tracker"
"platform_channels"
"platform_design"
"platform_view_swift"
"provider_counter"
"provider_shopper"
"simple_shader"
"simplistic_calculator"
"simplistic_editor"
"testing_app"
"veggieseasons"
"web_embedding/element_embedding_demo"
)
ci_projects "master" "${PROJECT_NAMES[@]}"
echo "-- Success --"

View File

@@ -1,33 +0,0 @@
function ci_projects () {
local channel="$1"
shift
local arr=("$@")
for PROJECT_NAME in "${arr[@]}"
do
echo "== Testing '${PROJECT_NAME}' on Flutter's $channel channel =="
pushd "${PROJECT_NAME}"
# Grab packages.
flutter pub get
# Run the analyzer to find any static analysis issues.
dart analyze --fatal-infos --fatal-warnings
# Run the formatter on all the dart files to make sure everything's linted.
dart format --output none .
# Run the actual tests.
if [ -d "test" ]
then
if grep -q "flutter:" "pubspec.yaml"; then
flutter test
else
# If the project is not a Flutter project, use the Dart CLI.
dart test
fi
fi
popd
done
}

View File

@@ -1,59 +0,0 @@
#!/bin/bash
set -e
DIR="${BASH_SOURCE%/*}"
source "$DIR/flutter_ci_script_shared.sh"
flutter doctor -v
declare -ar PROJECT_NAMES=(
"add_to_app/android_view/flutter_module_using_plugin"
"add_to_app/books/flutter_module_books"
"add_to_app/fullscreen/flutter_module"
"add_to_app/multiple_flutters/multiple_flutters_module"
"add_to_app/plugin/flutter_module_using_plugin"
"add_to_app/prebuilt_module/flutter_module"
"analysis_defaults"
"android_splash_screen"
"animations"
"asset_transformation"
"background_isolate_channels"
"code_sharing/client"
"code_sharing/server"
"code_sharing/shared"
"compass_app/app"
"compass_app/server"
"context_menus"
"deeplink_store_example"
"desktop_photo_search/fluent_ui"
"desktop_photo_search/material"
"dynamic_theme"
"flutter_maps_firestore"
"form_app"
"game_template"
"google_maps"
"infinite_list"
"ios_app_clip"
"isolate_example"
"material_3_demo"
"platform_channels"
"platform_design"
"navigation_and_routing"
"pedometer"
"pedometer/example"
"place_tracker"
"platform_view_swift"
"provider_counter"
"provider_shopper"
"simple_shader"
"simplistic_calculator"
"simplistic_editor"
"testing_app"
"veggieseasons"
"web_embedding/element_embedding_demo"
)
ci_projects "stable" "${PROJECT_NAMES[@]}"
echo "-- Success --"

View File

@@ -1,77 +0,0 @@
#!/bin/bash
set -e
flutter doctor -v
declare -ar PROJECT_NAMES=(
"add_to_app/android_view/flutter_module_using_plugin"
"add_to_app/books/flutter_module_books"
"add_to_app/fullscreen/flutter_module"
"add_to_app/multiple_flutters/multiple_flutters_module"
"add_to_app/plugin/flutter_module_using_plugin"
"add_to_app/prebuilt_module/flutter_module"
"ai_recipe_generation"
"analysis_defaults"
"android_splash_screen"
"animations"
"asset_transformation"
"background_isolate_channels"
"code_sharing/client"
"code_sharing/server"
"code_sharing/shared"
"context_menus"
"deeplink_store_example"
"desktop_photo_search/fluent_ui"
"desktop_photo_search/material"
"dynamic_theme"
"experimental/federated_plugin/federated_plugin"
"experimental/federated_plugin/federated_plugin/example"
"experimental/federated_plugin/federated_plugin_macos"
"experimental/federated_plugin/federated_plugin_platform_interface"
"experimental/federated_plugin/federated_plugin_web"
"experimental/federated_plugin/federated_plugin_windows"
"experimental/pedometer"
"experimental/pedometer/example"
"experimental/varfont_shader_puzzle"
"experimental/web_dashboard"
"flutter_maps_firestore"
"form_app"
"game_template"
"google_maps"
"infinite_list"
"ios_app_clip"
"isolate_example"
"material_3_demo"
"navigation_and_routing"
"place_tracker"
"platform_channels"
"platform_design"
"platform_view_swift"
"provider_counter"
"provider_shopper"
"simple_shader"
"simplistic_calculator"
"simplistic_editor"
"testing_app"
"veggieseasons"
"web_embedding/element_embedding_demo"
)
echo "--- Running flutter clean and flutter pub get for each sample ---"
for PROJECT_NAME in "${PROJECT_NAMES[@]}"
do
echo "== Cleaning '${PROJECT_NAME}' with Flutter clean =="
pushd "${PROJECT_NAME}"
# run `flutter clean` for project
flutter clean
# Grab packages.
flutter pub get
popd
done
echo "--- Success ---"

View File

@@ -1,16 +0,0 @@
#!/bin/bash
set -e
scriptDirectory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# It seems federated_plugin_* isn't happy to run flutter pub upgrade
for dir in `find "${scriptDirectory}/.." -name pubspec.yaml -exec dirname {} \; | grep -v federated_plugin | grep -v experimental | sort`
do
(
cd $dir
echo "Updating `pwd`"
flutter pub upgrade
flutter pub outdated
)
done