From d22f6d15f64879dbf9711574aba4bba6e227f128 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Wed, 2 Oct 2024 15:17:36 +0800 Subject: [PATCH] feat: CI setting for mono-repo --- .github/workflows/ci.workflow.yml | 9 ++++---- melos.yaml | 23 ++++++++++++++++++- .../test/ap_common_plugin_test.dart | 20 ---------------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.workflow.yml b/.github/workflows/ci.workflow.yml index b49fc809..6bde02a0 100644 --- a/.github/workflows/ci.workflow.yml +++ b/.github/workflows/ci.workflow.yml @@ -27,11 +27,12 @@ jobs: channel: 'stable' cache: true cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' - - run: flutter pub get - - name: Model test - run: flutter test test/model_test.dart + - name: 'Bootstrap package' + run: melos bootstrap --scope tests + - name: Run Test + run: melos run test --no-select - name: Analyze files - run: flutter analyze . + run: melos run analyze-ci - name: Build Web run: flutter build web working-directory: ./example diff --git a/melos.yaml b/melos.yaml index c5de7a46..393fae32 100644 --- a/melos.yaml +++ b/melos.yaml @@ -16,4 +16,25 @@ scripts: exec: dart analyze . clean: run: | - melos clean \ No newline at end of file + melos clean + fix: + run: | + melos exec -c 1 -- \ + dart fix --apply + description: | + Run `dart fix --apply` in all packages. + analyze-ci: + run: | + melos exec -c 1 -- \ + dart analyze . --fatal-infos + description: | + Run `dart analyze` in all packages. + - Note: you can also rely on your IDEs Dart Analysis / Issues window. + test: + run: | + melos exec -c 6 --fail-fast -- \ + "flutter test" + description: Run `flutter test` for a specific package. + packageFilters: + dirExists: + - test \ No newline at end of file diff --git a/packages/ap_common_plugin/test/ap_common_plugin_test.dart b/packages/ap_common_plugin/test/ap_common_plugin_test.dart index efa26289..153f0556 100644 --- a/packages/ap_common_plugin/test/ap_common_plugin_test.dart +++ b/packages/ap_common_plugin/test/ap_common_plugin_test.dart @@ -1,23 +1,3 @@ -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:ap_common_plugin/ap_common_plugin.dart'; - void main() { - const MethodChannel channel = MethodChannel('ap_common_plugin'); - - TestWidgetsFlutterBinding.ensureInitialized(); - - setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); - }); - - tearDown(() { - channel.setMockMethodCallHandler(null); - }); - test('getPlatformVersion', () async { - expect(await ApCommonPlugin.platformVersion, '42'); - }); }