diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46238bb9..57b38648 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,14 @@ name: Build on: - push: pull_request: + paths-ignore: + - "**.md" + push: + branches: + - master + paths-ignore: + - "**.md" schedule: # runs the CI everyday at 10AM - cron: "0 10 * * *" @@ -10,16 +16,35 @@ on: jobs: flutter: runs-on: ubuntu-latest - container: cirrusci/flutter:${{matrix.channel}} strategy: matrix: channel: + - master - dev - beta steps: - uses: actions/checkout@v2 + - uses: actions/checkout@v3.1.0 + with: + fetch-depth: 2 + + - uses: subosito/flutter-action@v2.7.1 + with: + channel: ${{ matrix.channel }} + + - name: Add pub cache bin to PATH + run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH + - name: Add pub cache to PATH + run: echo "PUB_CACHE="$HOME/.pub-cache"" >> $GITHUB_ENV + + - name: Install dependencies + run: flutter pub get + + - run: flutter format lib test --set-exit-if-changed + - run: flutter analyze --no-current-package - - name: Execute test script - run: curl -s https://raw.githubusercontent.com/rrousselGit/ci/master/scripts/ci.sh | bash -s nnbd + - run: flutter test --no-pub --coverage test/null_safe + - run: flutter test --no-pub --coverage --no-sound-null-safety test/mixed_mode + if: matrix.package_path != 'master' diff --git a/example/test_driver/app_test.dart b/example/test_driver/app_test.dart index eceed86b..e9250f53 100644 --- a/example/test_driver/app_test.dart +++ b/example/test_driver/app_test.dart @@ -1,4 +1,3 @@ -// ignore: import_of_legacy_library_into_null_safe import 'package:flutter_driver/flutter_driver.dart'; import 'package:test/test.dart'; diff --git a/scripts/flutter_test.sh b/scripts/flutter_test.sh deleted file mode 100755 index b76104b1..00000000 --- a/scripts/flutter_test.sh +++ /dev/null @@ -1,9 +0,0 @@ -set -e # abort CI if an error happens -cd $1 -flutter packages get -flutter format --set-exit-if-changed lib test -flutter analyze --no-current-package lib test/ -flutter test --no-pub --coverage $(ls test/*_test.dart | grep -v _legacy_) -flutter test --no-pub --coverage --no-sound-null-safety $(ls test/*_legacy_test.dart) -# resets to the original state -cd - diff --git a/test/common_legacy.dart b/test/mixed_mode/common_legacy.dart similarity index 100% rename from test/common_legacy.dart rename to test/mixed_mode/common_legacy.dart diff --git a/test/inherited_provider_legacy_test.dart b/test/mixed_mode/inherited_provider_legacy_test.dart similarity index 97% rename from test/inherited_provider_legacy_test.dart rename to test/mixed_mode/inherited_provider_legacy_test.dart index 5e52c45e..b3ca8951 100644 --- a/test/inherited_provider_legacy_test.dart +++ b/test/mixed_mode/inherited_provider_legacy_test.dart @@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:provider/provider.dart'; -import 'common.dart'; +import '../null_safe/common.dart'; BuildContext get context => find.byType(Context).evaluate().single; diff --git a/test/provider_legacy_mixing_impl.dart b/test/mixed_mode/provider_legacy_mixing_impl.dart similarity index 100% rename from test/provider_legacy_mixing_impl.dart rename to test/mixed_mode/provider_legacy_mixing_impl.dart diff --git a/test/provider_legacy_mixing_test.dart b/test/mixed_mode/provider_legacy_mixing_test.dart similarity index 100% rename from test/provider_legacy_mixing_test.dart rename to test/mixed_mode/provider_legacy_mixing_test.dart diff --git a/test/provider_legacy_test.dart b/test/mixed_mode/provider_legacy_test.dart similarity index 99% rename from test/provider_legacy_test.dart rename to test/mixed_mode/provider_legacy_test.dart index 65919784..874b214c 100644 --- a/test/provider_legacy_test.dart +++ b/test/mixed_mode/provider_legacy_test.dart @@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:provider/provider.dart'; -import 'common.dart'; +import '../null_safe/common.dart'; void main() { // See `provider_test.dart` for corresponding sound mode test. diff --git a/test/builder_test.dart b/test/null_safe/builder_test.dart similarity index 100% rename from test/builder_test.dart rename to test/null_safe/builder_test.dart diff --git a/test/change_notifier_provider_test.dart b/test/null_safe/change_notifier_provider_test.dart similarity index 100% rename from test/change_notifier_provider_test.dart rename to test/null_safe/change_notifier_provider_test.dart diff --git a/test/common.dart b/test/null_safe/common.dart similarity index 99% rename from test/common.dart rename to test/null_safe/common.dart index 79fb621b..1a6eb3fe 100644 --- a/test/common.dart +++ b/test/null_safe/common.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; diff --git a/test/consumer_test.dart b/test/null_safe/consumer_test.dart similarity index 99% rename from test/consumer_test.dart rename to test/null_safe/consumer_test.dart index 20fbfb83..de04ffde 100644 --- a/test/consumer_test.dart +++ b/test/null_safe/consumer_test.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; diff --git a/test/context_test.dart b/test/null_safe/context_test.dart similarity index 99% rename from test/context_test.dart rename to test/null_safe/context_test.dart index 44316a66..6f809d76 100644 --- a/test/context_test.dart +++ b/test/null_safe/context_test.dart @@ -1,6 +1,5 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; diff --git a/test/devtool_test.dart b/test/null_safe/devtool_test.dart similarity index 100% rename from test/devtool_test.dart rename to test/null_safe/devtool_test.dart diff --git a/test/future_provider_test.dart b/test/null_safe/future_provider_test.dart similarity index 99% rename from test/future_provider_test.dart rename to test/null_safe/future_provider_test.dart index 3f3beebd..ee00e112 100644 --- a/test/future_provider_test.dart +++ b/test/null_safe/future_provider_test.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; diff --git a/test/inherited_provider_test.dart b/test/null_safe/inherited_provider_test.dart similarity index 99% rename from test/inherited_provider_test.dart rename to test/null_safe/inherited_provider_test.dart index ddc80fcd..0cede616 100644 --- a/test/inherited_provider_test.dart +++ b/test/null_safe/inherited_provider_test.dart @@ -1,7 +1,6 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; import 'package:provider/single_child_widget.dart'; @@ -554,7 +553,8 @@ The context used was: Context ), ); - final rootElement = tester.element(find.bySubtype()); + final rootElement = + tester.element(find.byWidgetPredicate((w) => w is InheritedProvider)); expect( rootElement.toString(), @@ -583,7 +583,8 @@ The context used was: Context ), ); - final rootElement = tester.element(find.bySubtype()); + final rootElement = + tester.element(find.byWidgetPredicate((w) => w is InheritedProvider)); expect( rootElement.toString(), @@ -607,7 +608,8 @@ The context used was: Context ), ); - final rootElement = tester.element(find.bySubtype()); + final rootElement = + tester.element(find.byWidgetPredicate((w) => w is InheritedProvider)); expect( rootElement.toString(), @@ -634,8 +636,8 @@ The context used was: Context ), ); - final rootElement = - tester.element(find.bySubtype()); + final rootElement = tester.element( + find.byWidgetPredicate((w) => w is DeferredInheritedProvider)); expect( rootElement.toString(), @@ -666,7 +668,8 @@ DeferredInheritedProvider(controller: 42, value: 24)'''), ), ); - final rootElement = tester.element(find.bySubtype()); + final rootElement = + tester.element(find.byWidgetPredicate((w) => w is InheritedProvider)); expect( rootElement.toString(), diff --git a/test/listenable_provider_test.dart b/test/null_safe/listenable_provider_test.dart similarity index 99% rename from test/listenable_provider_test.dart rename to test/null_safe/listenable_provider_test.dart index 0574d07b..832bcfb9 100644 --- a/test/listenable_provider_test.dart +++ b/test/null_safe/listenable_provider_test.dart @@ -1,7 +1,6 @@ // ignore_for_file: invalid_use_of_protected_member import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; diff --git a/test/listenable_proxy_provider_test.dart b/test/null_safe/listenable_proxy_provider_test.dart similarity index 99% rename from test/listenable_proxy_provider_test.dart rename to test/null_safe/listenable_proxy_provider_test.dart index b9b12caf..f4257f29 100644 --- a/test/listenable_proxy_provider_test.dart +++ b/test/null_safe/listenable_proxy_provider_test.dart @@ -1,7 +1,6 @@ // ignore_for_file: invalid_use_of_protected_member import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; diff --git a/test/matchers.dart b/test/null_safe/matchers.dart similarity index 100% rename from test/matchers.dart rename to test/null_safe/matchers.dart diff --git a/test/multi_provider_test.dart b/test/null_safe/multi_provider_test.dart similarity index 100% rename from test/multi_provider_test.dart rename to test/null_safe/multi_provider_test.dart diff --git a/test/provider_test.dart b/test/null_safe/provider_test.dart similarity index 100% rename from test/provider_test.dart rename to test/null_safe/provider_test.dart diff --git a/test/proxy_provider_test.dart b/test/null_safe/proxy_provider_test.dart similarity index 99% rename from test/proxy_provider_test.dart rename to test/null_safe/proxy_provider_test.dart index b8319901..ce933630 100644 --- a/test/proxy_provider_test.dart +++ b/test/null_safe/proxy_provider_test.dart @@ -1,6 +1,5 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; diff --git a/test/reassemble_test.dart b/test/null_safe/reassemble_test.dart similarity index 100% rename from test/reassemble_test.dart rename to test/null_safe/reassemble_test.dart diff --git a/test/selector_test.dart b/test/null_safe/selector_test.dart similarity index 99% rename from test/selector_test.dart rename to test/null_safe/selector_test.dart index 9598a2fd..dc8db0d3 100644 --- a/test/selector_test.dart +++ b/test/null_safe/selector_test.dart @@ -1,9 +1,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart' as mockito show when; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; import 'package:provider/single_child_widget.dart'; diff --git a/test/stateful_provider_test.dart b/test/null_safe/stateful_provider_test.dart similarity index 96% rename from test/stateful_provider_test.dart rename to test/null_safe/stateful_provider_test.dart index beee96d2..daf1b2f7 100644 --- a/test/stateful_provider_test.dart +++ b/test/null_safe/stateful_provider_test.dart @@ -1,6 +1,5 @@ import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; import 'package:provider/src/provider.dart'; diff --git a/test/stream_provider_test.dart b/test/null_safe/stream_provider_test.dart similarity index 98% rename from test/stream_provider_test.dart rename to test/null_safe/stream_provider_test.dart index 3e831ae4..763df853 100644 --- a/test/stream_provider_test.dart +++ b/test/null_safe/stream_provider_test.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; diff --git a/test/value_listenable_test.dart b/test/null_safe/value_listenable_test.dart similarity index 98% rename from test/value_listenable_test.dart rename to test/null_safe/value_listenable_test.dart index 073b2e94..b87b3a3a 100644 --- a/test/value_listenable_test.dart +++ b/test/null_safe/value_listenable_test.dart @@ -1,7 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; -// ignore: import_of_legacy_library_into_null_safe import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart';