From 76141a9b2a55432246fe972d3a3c43b97cf6bdcc Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Mon, 3 Oct 2022 15:09:19 +0300 Subject: [PATCH 01/15] Update flutter environment --- android/app/build.gradle | 2 +- android/build.gradle | 2 +- lib/features/detail/detail_page.dart | 2 +- pubspec.lock | 61 ++++++++++++++------- pubspec.yaml | 7 ++- test/features/home/home_viewmodel_test.dart | 2 - 6 files changed, 48 insertions(+), 28 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 36549ca..3248193 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/android/build.gradle b/android/build.gradle index 9b6ed06..7603b16 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.6.10' repositories { google() jcenter() diff --git a/lib/features/detail/detail_page.dart b/lib/features/detail/detail_page.dart index 9929d0e..6daab05 100644 --- a/lib/features/detail/detail_page.dart +++ b/lib/features/detail/detail_page.dart @@ -54,7 +54,7 @@ class _DetailPageState extends State { ); _detailViewModel.setDetailType(widget.type); - WidgetsBinding.instance?.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { switch (widget.type) { case DetailPageType.edit: _detailViewModel.setItemEditing(widget.item!); diff --git a/pubspec.lock b/pubspec.lock index 0ec3560..61940df 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "3.1.11" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -28,14 +28,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -49,7 +49,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" crypto: dependency: transitive description: @@ -63,21 +63,21 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.0.5" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.0" + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -88,6 +88,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" flutter_test: dependency: "direct dev" description: flutter @@ -103,20 +110,34 @@ packages: description: flutter source: sdk version: "0.0.0" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" nested: dependency: transitive description: @@ -130,28 +151,28 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.0" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.2.1" + version: "4.2.4" provider: dependency: "direct main" description: name: provider url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.3" sky_engine: dependency: transitive description: flutter @@ -163,7 +184,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -205,7 +226,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.9" typed_data: dependency: transitive description: @@ -219,21 +240,21 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" very_good_analysis: dependency: "direct dev" description: name: very_good_analysis url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "3.0.2" vm_service: dependency: transitive description: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "6.2.0" + version: "8.2.2" webdriver: dependency: transitive description: @@ -242,5 +263,5 @@ packages: source: hosted version: "3.0.0" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0 <3.0.0" flutter: ">=1.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index e25ed10..88a3bcd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,16 +11,17 @@ environment: dependencies: flutter: sdk: flutter + cupertino_icons: ^1.0.5 + provider: ^6.0.3 - cupertino_icons: ^1.0.2 - provider: ^5.0.0 dev_dependencies: flutter_test: sdk: flutter integration_test: sdk: flutter - very_good_analysis: ^2.1.0 + very_good_analysis: ^3.0.2 + flutter_lints: ^2.0.1 flutter: uses-material-design: true diff --git a/test/features/home/home_viewmodel_test.dart b/test/features/home/home_viewmodel_test.dart index 64a2b33..9ba639f 100644 --- a/test/features/home/home_viewmodel_test.dart +++ b/test/features/home/home_viewmodel_test.dart @@ -6,9 +6,7 @@ import 'package:semaphoreci_flutter_demo/viewmodels/todo_viewmodel.dart'; void main() { test('Should show empty list if TodoViewModel is null ', () { // Arrange - const todoViewModel = null; final homeViewModel = HomeViewModel( - todoViewModel: todoViewModel, ); // Act From 947067995b8adae20035e880dc9c06c74c638c91 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 06:13:04 +0000 Subject: [PATCH 02/15] Update Semaphore configuration --- .semaphore/semaphore.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 20c0122..bc62bff 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -2,8 +2,11 @@ version: v1.0 name: Main agent: machine: - type: a1-standard-4 - os_image: macos-xcode12 + type: e1-standard-2 + os_image: ubuntu2004 + containers: + - name: main + image: 'registry.semaphoreci.com/android:30-flutter' fail_fast: stop: when: 'true' From a411a399769d8aedacb32de5ca705b4481630783 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 06:16:45 +0000 Subject: [PATCH 03/15] Update Semaphore configuration --- .semaphore/semaphore.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index bc62bff..3f680f6 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -31,7 +31,6 @@ blocks: commands: - checkout - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - - flutter pub get jobs: - name: Format commands: From 129ba67fdfa6e23ec13a1973973096518d110346 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 09:44:48 +0300 Subject: [PATCH 04/15] Update tools.build:gradle and gradle. --- android/build.gradle | 2 +- android/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 7603b16..ef64012 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:7.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index bc6a58a..b8793d3 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip From be14c910bd5f1b35eebf59eabe7be7e6516f7816 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 10:12:55 +0300 Subject: [PATCH 05/15] remove un used null-aware operator in detail_viewmodel.dart --- lib/features/detail/detail_viewmodel.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/features/detail/detail_viewmodel.dart b/lib/features/detail/detail_viewmodel.dart index 418b45a..25681b2 100644 --- a/lib/features/detail/detail_viewmodel.dart +++ b/lib/features/detail/detail_viewmodel.dart @@ -9,7 +9,7 @@ class DetailViewModel extends ChangeNotifier { required this.todoViewModel, }); - final TodoViewModel? todoViewModel; + final TodoViewModel todoViewModel; DetailPageType type = DetailPageType.add; @@ -57,7 +57,7 @@ class DetailViewModel extends ChangeNotifier { updatedAt: timestamp, ); - todoViewModel?.addItemToList(item); + todoViewModel.addItemToList(item); break; case DetailPageType.edit: final item = TodoItem( @@ -68,12 +68,12 @@ class DetailViewModel extends ChangeNotifier { updatedAt: timestamp, ); - todoViewModel?.updateItem(item); + todoViewModel.updateItem(item); break; } } - void deleteItemById(int id) => todoViewModel?.deleteItemById(id); + void deleteItemById(int id) => todoViewModel.deleteItemById(id); void reset() { type = DetailPageType.add; From b35e6142e5c8055cd6dc779c6a4a808973d76408 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 10:29:09 +0300 Subject: [PATCH 06/15] delete old semaphore.yml --- .semaphore/semaphore.yml | 84 ---------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 .semaphore/semaphore.yml diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml deleted file mode 100644 index 3f680f6..0000000 --- a/.semaphore/semaphore.yml +++ /dev/null @@ -1,84 +0,0 @@ -version: v1.0 -name: Main -agent: - machine: - type: e1-standard-2 - os_image: ubuntu2004 - containers: - - name: main - image: 'registry.semaphoreci.com/android:30-flutter' -fail_fast: - stop: - when: 'true' -blocks: - - name: Install dependencies - task: - jobs: - - name: Install and cache flutter - commands: - - checkout - - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - - flutter pub get - - 'cache store flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - prologue: - commands: - - checkout - - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - - flutter pub get - - name: Lint - task: - prologue: - commands: - - checkout - - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - jobs: - - name: Format - commands: - - flutter format --set-exit-if-changed . - - name: Analyze - commands: - - flutter analyze . - - name: Unit and widget tests - task: - prologue: - commands: - - checkout - - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - - flutter pub get - jobs: - - name: Test - commands: - - flutter test test - - name: Run UI tests - task: - prologue: - commands: - - checkout - - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - - flutter pub get - - device_uuid=$(xcrun simctl create ios-simulator com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro com.apple.CoreSimulator.SimRuntime.iOS-14-5) - - xcrun simctl boot $device_uuid - jobs: - - name: Add new item - commands: - - flutter test integration_test/add_new_todo_item_test.dart - - name: Edit exist item - commands: - - flutter test integration_test/edit_existing_item_test.dart - - name: Delete item - commands: - - flutter test integration_test/delete_existing_item_test.dart - run: - when: 'change_in(''/lib'', {default_branch: ''main'', pipeline_file: ''ignore''})' - - name: Build artifact - task: - prologue: - commands: - - checkout - - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - - flutter pub get - jobs: - - name: Generate IPA - commands: - - flutter build ios --no-codesign - - artifact push job build/ios/iphoneos/Runner.app From 15a60a551b27ee87f3045055832c36fe7034e762 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 07:33:41 +0000 Subject: [PATCH 07/15] Update Semaphore configuration --- .semaphore/semaphore.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .semaphore/semaphore.yml diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml new file mode 100644 index 0000000..4dab8c3 --- /dev/null +++ b/.semaphore/semaphore.yml @@ -0,0 +1,19 @@ +version: v1.0 +name: Initial Pipeline +agent: + machine: + type: e1-standard-2 + os_image: ubuntu1804 + containers: + - name: main + image: 'registry.semaphoreci.com/android:30-flutte' +blocks: + - name: install dependencies + task: + jobs: + - name: Install + commands: + - checkout + - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' + - flutter pub get + - 'cache store flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages /root/.pub-cache' From 921886d67ae8e3fb88b78116202b406b3a58c846 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 07:36:50 +0000 Subject: [PATCH 08/15] Update Semaphore configuration --- .semaphore/semaphore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 4dab8c3..38492da 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -6,7 +6,7 @@ agent: os_image: ubuntu1804 containers: - name: main - image: 'registry.semaphoreci.com/android:30-flutte' + image: 'registry.semaphoreci.com/android:30-flutter' blocks: - name: install dependencies task: From ce54456043389e19db921de4447c67ca83de2d36 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 07:38:23 +0000 Subject: [PATCH 09/15] Update Semaphore configuration --- .semaphore/semaphore.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 38492da..9ad43ba 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -17,3 +17,16 @@ blocks: - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' - flutter pub get - 'cache store flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages /root/.pub-cache' + - name: Linting + task: + prologue: + commands: + - checkout + - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' + jobs: + - name: Format code + commands: + - flutter format --set-exit-if-changed . + - name: Run code lint + commands: + - flutter analyze . From 08e3086ea82a33599c7854dab2693857c2fdac4c Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 07:45:35 +0000 Subject: [PATCH 10/15] Update Semaphore configuration --- .semaphore/semaphore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 9ad43ba..8dfb276 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -26,7 +26,7 @@ blocks: jobs: - name: Format code commands: - - flutter format --set-exit-if-changed . + - flutter format . --set-exit-if-changed . - name: Run code lint commands: - flutter analyze . From f724da38229097adfc64afebe979e05203726149 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 11:09:22 +0300 Subject: [PATCH 11/15] edit some analysis_options.yaml rules . some edits depends on flutter_lints. --- analysis_options.yaml | 2 + lib/features/detail/detail_page.dart | 42 ++++++++++----------- lib/features/home/home_page.dart | 6 +-- test/features/home/home_viewmodel_test.dart | 3 +- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index ee86098..7f58cfa 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -7,3 +7,5 @@ linter: sort_constructors_first: false use_key_in_widget_constructors: false public_member_api_docs: false + sort_pub_dependencies: false + use_setters_to_change_properties: false diff --git a/lib/features/detail/detail_page.dart b/lib/features/detail/detail_page.dart index 6daab05..5c0dbef 100644 --- a/lib/features/detail/detail_page.dart +++ b/lib/features/detail/detail_page.dart @@ -55,14 +55,11 @@ class _DetailPageState extends State { _detailViewModel.setDetailType(widget.type); WidgetsBinding.instance.addPostFrameCallback((_) { - switch (widget.type) { - case DetailPageType.edit: - _detailViewModel.setItemEditing(widget.item!); - - _titleController.text = widget.item!.title; - _descriptionController.text = widget.item!.description; - break; - default: + if (widget.type == DetailPageType.edit) { + _detailViewModel.setItemEditing(widget.item!); + + _titleController.text = widget.item!.title; + _descriptionController.text = widget.item!.description; // Do nothing } }); @@ -109,7 +106,7 @@ class _DetailPageState extends State { labelText: 'Title', border: OutlineInputBorder( borderRadius: BorderRadius.all( - Radius.circular(10.0), + Radius.circular(10), ), ), ), @@ -125,7 +122,7 @@ class _DetailPageState extends State { labelText: 'Description', border: OutlineInputBorder( borderRadius: BorderRadius.all( - Radius.circular(10.0), + Radius.circular(10), ), ), ), @@ -144,18 +141,19 @@ class _DetailPageState extends State { ), ), ), - widget.type == DetailPageType.edit - ? TextButton( - key: const ValueKey('button.delete'), - child: const Text( - 'Delete', - style: TextStyle( - color: Colors.red, - ), - ), - onPressed: _deleteItem, - ) - : Container(), + if (widget.type == DetailPageType.edit) + TextButton( + key: const ValueKey('button.delete'), + child: const Text( + 'Delete', + style: TextStyle( + color: Colors.red, + ), + ), + onPressed: _deleteItem, + ) + else + Container(), ], ), ), diff --git a/lib/features/home/home_page.dart b/lib/features/home/home_page.dart index 2bcfb5b..8855246 100644 --- a/lib/features/home/home_page.dart +++ b/lib/features/home/home_page.dart @@ -40,7 +40,7 @@ class _HomePageState extends State { onPressed: () { Navigator.push( context, - CupertinoPageRoute( + CupertinoPageRoute( builder: (_) => const DetailPage( type: DetailPageType.add, ), @@ -64,7 +64,7 @@ class _HomePageState extends State { hintText: 'Search', border: OutlineInputBorder( borderRadius: BorderRadius.all( - Radius.circular(10.0), + Radius.circular(10), ), ), ), @@ -80,7 +80,7 @@ class _HomePageState extends State { onTap: () { Navigator.push( context, - CupertinoPageRoute( + CupertinoPageRoute( builder: (_) => DetailPage( type: DetailPageType.edit, item: data.todos[i], diff --git a/test/features/home/home_viewmodel_test.dart b/test/features/home/home_viewmodel_test.dart index 9ba639f..0ee49cb 100644 --- a/test/features/home/home_viewmodel_test.dart +++ b/test/features/home/home_viewmodel_test.dart @@ -6,8 +6,7 @@ import 'package:semaphoreci_flutter_demo/viewmodels/todo_viewmodel.dart'; void main() { test('Should show empty list if TodoViewModel is null ', () { // Arrange - final homeViewModel = HomeViewModel( - ); + final homeViewModel = HomeViewModel(); // Act // Do nothing From fe3a27e83b79ca7c58498e3d9738508a03b2c511 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 11:10:52 +0300 Subject: [PATCH 12/15] edit format code jobs commands. --- .semaphore/semaphore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 8dfb276..9ad43ba 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -26,7 +26,7 @@ blocks: jobs: - name: Format code commands: - - flutter format . --set-exit-if-changed . + - flutter format --set-exit-if-changed . - name: Run code lint commands: - flutter analyze . From 1f8f5a4e29d83822e3c4f45926f94b66b6b59e42 Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 08:16:36 +0000 Subject: [PATCH 13/15] Update Semaphore configuration From f96e580827aaf0c83a7a9f3e94893efbe881df2a Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 08:22:00 +0000 Subject: [PATCH 14/15] Update Semaphore configuration --- .semaphore/semaphore.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 9ad43ba..d36f72e 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -30,3 +30,37 @@ blocks: - name: Run code lint commands: - flutter analyze . + - name: Tests + task: + jobs: + - name: Run unit and widget tests + commands: + - checkout + - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' + - flutter test test + - name: Integration tests + task: + prologue: + commands: + - checkout + - 'cache restore flutter-packages-$SEMAPHORE_GIT_BRANCH-$(checksum pubspec.yaml),flutter-packages-$(checksum pubspec.yaml),flutter-packages' + - sdkmanager "platform-tools" "platforms;android-29" "build-tools;30.0.0" "emulator" + - sdkmanager "system-images;android-29;google_apis;x86" + - echo no | avdmanager create avd -n test-emulator -k "system-images;android-29;google_apis;x86" + - emulator -avd test-emulator -noaudio -no-boot-anim -gpu off -no-window & + - 'adb wait-for-device shell ''while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;''' + - adb shell wm dismiss-keyguard + - sleep 1 + - adb shell settings put global window_animation_scale 0 + - adb shell settings put global transition_animation_scale 0 + - adb shell settings put global animator_duration_scale 0 + jobs: + - name: Add new item test + commands: + - flutter test integration_test/add_new_todo_item_test.dart + - name: Edit existing item test + commands: + - flutter test integration_test/edit_existing_item_test.dart + - name: Delete existing item test + commands: + - flutter test integration_test/delete_existing_item_test.dart From 61b0d741ec68c7a56dedaee6a45921476153d10c Mon Sep 17 00:00:00 2001 From: Khawlah mohammed Date: Tue, 4 Oct 2022 08:42:42 +0000 Subject: [PATCH 15/15] Update Semaphore configuration --- .semaphore/semaphore.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index d36f72e..28e45ed 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -64,3 +64,10 @@ blocks: - name: Delete existing item test commands: - flutter test integration_test/delete_existing_item_test.dart + agent: + machine: + type: e1-standard-2 + os_image: ubuntu2004 + containers: + - name: main + image: 'registry.semaphoreci.com/android:30-flutter'