From 73eb8d88a72bc8d5a70bdbf092e3f7d4b50f29dd Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Mon, 6 Feb 2023 16:12:15 +0200 Subject: [PATCH 01/22] Downgrade macOS and Ubuntu build OS --- .github/workflows/build-native.yml | 2 +- .github/workflows/ci.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-native.yml b/.github/workflows/build-native.yml index aa1a2c089..239341628 100644 --- a/.github/workflows/build-native.yml +++ b/.github/workflows/build-native.yml @@ -18,7 +18,7 @@ on: jobs: build-native: - runs-on: ${{ inputs.runner }}-latest + runs-on: ${{ inputs.runner }} name: Build native timeout-minutes: 60 strategy: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23f8a28a8..e84de74aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,7 +129,7 @@ jobs: name: Build Windows uses: ./.github/workflows/build-native.yml with: - runner: windows + runner: windows-2022 binary: windows build: '["windows"]' @@ -137,7 +137,7 @@ jobs: name: Build MacOS uses: ./.github/workflows/build-native.yml with: - runner: macos + runner: macos-11 binary: macos build: '["macos"]' @@ -145,7 +145,7 @@ jobs: name: Build Linux uses: ./.github/workflows/build-native.yml with: - runner: ubuntu + runner: ubuntu-20.04 binary: linux build: '["linux"]' @@ -153,7 +153,7 @@ jobs: name: Build Android uses: ./.github/workflows/build-native.yml with: - runner: ubuntu + runner: ubuntu-20.04 binary: android build: '["android-x86", "android-x86_64", "android-armeabi-v7a", "android-arm64-v8a"]' @@ -161,7 +161,7 @@ jobs: name: Build IOS uses: ./.github/workflows/build-native.yml with: - runner: macos + runner: macos-11 binary: ios build: '["ios-device", "ios-simulator", "ios-catalyst"]' From 68dec68216b57fb2dda0099838cf2e2561ebbd2e Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Mon, 6 Feb 2023 17:08:56 +0200 Subject: [PATCH 02/22] Loading realm library errors for all paths --- .github/workflows/build-native.yml | 2 +- lib/src/init.dart | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-native.yml b/.github/workflows/build-native.yml index 239341628..dd981926d 100644 --- a/.github/workflows/build-native.yml +++ b/.github/workflows/build-native.yml @@ -37,7 +37,7 @@ jobs: uses: actions/cache@v3 with: path: ./binary/** - key: binaries-${{ matrix.build }}-${{hashFiles('./src/**')}} + key: binaries-${{ matrix.build }}-{{ inputs.runner }}-${{hashFiles('./src/**')}} - name: Setup Ninja if: contains(github.head_ref, 'release/') || steps.check-cache.outputs.cache-hit != 'true' diff --git a/lib/src/init.dart b/lib/src/init.dart index 6637807f8..ff7211767 100644 --- a/lib/src/init.dart +++ b/lib/src/init.dart @@ -65,7 +65,7 @@ DynamicLibrary _openRealmLib() { final root = _getNearestProjectRoot(Platform.script.path) ?? _getNearestProjectRoot(p.current); // Try to open lib from various candidate paths - Error? ex; + LoadRealmLibraryError? ex; for (final open in [ () => _open(libName), // just ask OS.. () => _open(p.join(_exeDirName, libName)), // try finding it next to the executable @@ -75,7 +75,8 @@ DynamicLibrary _openRealmLib() { try { return open(); } on Error catch (e) { - ex ??= e; // remember first exception, if everything fails + ex ??= LoadRealmLibraryError(); + ex.add(e); } } throw ex!; // rethrow first @@ -112,3 +113,20 @@ DynamicLibrary initRealm() { return _library = realmLibrary; } + +class LoadRealmLibraryError extends Error { + List loadingFromPathErrors = []; + void add(Error err) { + loadingFromPathErrors.add(err); + } + + @override + @override + String toString() { + List errMessages = []; + for (Error err in loadingFromPathErrors) { + errMessages.add(err.toString()); + } + return errMessages.join('\n'); + } +} From bfb8b07f7305b22e7825fc2cfc08c5989c4871a6 Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Mon, 6 Feb 2023 17:22:44 +0200 Subject: [PATCH 03/22] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 690d29898..bef08bd2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ **This project is in Release Candidate stage.** ### Enhancements -* None +* Improved error information returned when the `realm_dart` library failed to load. ([#1143](https://github.com/realm/realm-dart/pull/1143)) ### Fixed * Improve performance of interprocess mutexes on iOS which don’t need to support reader-writer locking. The primary beneficiary of this is beginning and ending read transactions, which is now almost as fast as pre-v13.0.0 (Core upgrade). From 5e33a1e2e356a60945cfa09e03c681ca8ec4414b Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 00:36:25 +0200 Subject: [PATCH 04/22] Run tests on ubuntu 20.4 --- .github/workflows/ci.yml | 37 +++++++++++++++++++++ .github/workflows/dart-desktop-tests.yml | 6 +++- .github/workflows/flutter-desktop-tests.yml | 6 +++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e84de74aa..fa96e7187 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,9 +48,11 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux + - dart-tests-linux20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux + - flutter-desktop-tests-linux20 - flutter-ios - flutter-android steps: @@ -70,9 +72,11 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux + - dart-tests-linux20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux + - flutter-desktop-tests-linux20 - flutter-ios - flutter-android strategy: @@ -186,6 +190,7 @@ jobs: secrets: inherit with: os: windows + runner: windows-latest app: dw cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -198,6 +203,7 @@ jobs: secrets: inherit with: os: macos + runner: macos-latest app: dm cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -210,6 +216,7 @@ jobs: secrets: inherit with: os: macos + runner: macos-arm architecture: arm app: dma cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -223,6 +230,20 @@ jobs: secrets: inherit with: os: linux + runner: ubuntu-latest + app: dl + cluster: ${{ needs.deploy-cluster.outputs.clusterName }} + + dart-tests-linux20: + name: Linux 20 Dart Tests + uses: ./.github/workflows/dart-desktop-tests.yml + needs: + - build-linux + - deploy-cluster + secrets: inherit + with: + os: linux + runner: ubuntu-20.04 app: dl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -237,6 +258,7 @@ jobs: secrets: inherit with: os: windows + runner: windows-latest app: fw cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -249,6 +271,7 @@ jobs: secrets: inherit with: os: macos + runner: macos-latest app: fm cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -261,6 +284,20 @@ jobs: secrets: inherit with: os: linux + runner: ubuntu-latest + app: fl + cluster: ${{ needs.deploy-cluster.outputs.clusterName }} + + flutter-desktop-tests-linux20: + name: Linux 20 Flutter Tests + uses: ./.github/workflows/flutter-desktop-tests.yml + needs: + - build-linux + - deploy-cluster + secrets: inherit + with: + os: linux + runner: ubuntu-20.04 app: fl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} diff --git a/.github/workflows/dart-desktop-tests.yml b/.github/workflows/dart-desktop-tests.yml index 146c3311e..b8fb8c4ae 100644 --- a/.github/workflows/dart-desktop-tests.yml +++ b/.github/workflows/dart-desktop-tests.yml @@ -7,6 +7,10 @@ on: description: OS to execute on. required: true type: string + runner: + description: GitHub runnar image to execute on. + required: true + type: string architecture: description: Architecture to execute on. required: false @@ -29,7 +33,7 @@ env: jobs: dart-tests: - runs-on: ${{ inputs.os == 'linux' && 'ubuntu' || inputs.os }}-${{ inputs.architecture || 'latest' }} + runs-on: ${{ inputs.runner }} name: Dart tests on ${{inputs.os }} ${{ inputs.architecture }} timeout-minutes: 45 env: diff --git a/.github/workflows/flutter-desktop-tests.yml b/.github/workflows/flutter-desktop-tests.yml index 3befc3cf7..5d14fb607 100644 --- a/.github/workflows/flutter-desktop-tests.yml +++ b/.github/workflows/flutter-desktop-tests.yml @@ -7,6 +7,10 @@ on: description: OS to execute on. required: true type: string + runner: + description: GitHub runnar image to execute on. + required: true + type: string architecture: description: Architecture to execute on. required: false @@ -29,7 +33,7 @@ env: jobs: flutter-tests: - runs-on: ${{ inputs.os == 'linux' && 'ubuntu' || inputs.os }}-${{ inputs.architecture || 'latest' }} + runs-on: ${{ inputs.runner }} name: Flutter tests on ${{inputs.os }}-${{ inputs.architecture }} timeout-minutes: 45 env: From 5471102cf6b719a6d89059bbc545cf55cdd9ca5b Mon Sep 17 00:00:00 2001 From: Desislava Stefanova <95419820+desistefanova@users.noreply.github.com> Date: Tue, 7 Feb 2023 00:46:37 +0200 Subject: [PATCH 05/22] Update lib/src/init.dart Co-authored-by: blagoev --- lib/src/init.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/init.dart b/lib/src/init.dart index ff7211767..7e5958790 100644 --- a/lib/src/init.dart +++ b/lib/src/init.dart @@ -120,7 +120,7 @@ class LoadRealmLibraryError extends Error { loadingFromPathErrors.add(err); } - @override + @override String toString() { List errMessages = []; From 19fa6217d174d90d8742b5f05c99219f29fcf20e Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 00:50:06 +0200 Subject: [PATCH 06/22] Fix sintax --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa96e7187..b72cb67a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,7 +235,7 @@ jobs: cluster: ${{ needs.deploy-cluster.outputs.clusterName }} dart-tests-linux20: - name: Linux 20 Dart Tests + name: Linux20 Dart Tests uses: ./.github/workflows/dart-desktop-tests.yml needs: - build-linux @@ -289,7 +289,7 @@ jobs: cluster: ${{ needs.deploy-cluster.outputs.clusterName }} flutter-desktop-tests-linux20: - name: Linux 20 Flutter Tests + name: Linux20 Flutter Tests uses: ./.github/workflows/flutter-desktop-tests.yml needs: - build-linux From 89f21d386af7ac657a2ee37f6d0cd2a5912c497d Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 00:52:15 +0200 Subject: [PATCH 07/22] Fix ci syntax error --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b72cb67a2..05ad5b5eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,7 +235,7 @@ jobs: cluster: ${{ needs.deploy-cluster.outputs.clusterName }} dart-tests-linux20: - name: Linux20 Dart Tests + name: Linux 20 Dart Tests uses: ./.github/workflows/dart-desktop-tests.yml needs: - build-linux @@ -288,8 +288,8 @@ jobs: app: fl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} - flutter-desktop-tests-linux20: - name: Linux20 Flutter Tests + flutter-desktop-tests-linux20: + name: Linux 20 Flutter Tests uses: ./.github/workflows/flutter-desktop-tests.yml needs: - build-linux From 9d221b7645c4c63973bcfaaea33f76d2d361136e Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 01:08:11 +0200 Subject: [PATCH 08/22] Return windows and macos buils to latest runners --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05ad5b5eb..b1613bf0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -133,7 +133,7 @@ jobs: name: Build Windows uses: ./.github/workflows/build-native.yml with: - runner: windows-2022 + runner: windows-latest binary: windows build: '["windows"]' @@ -141,7 +141,7 @@ jobs: name: Build MacOS uses: ./.github/workflows/build-native.yml with: - runner: macos-11 + runner: macos-latest binary: macos build: '["macos"]' @@ -165,7 +165,7 @@ jobs: name: Build IOS uses: ./.github/workflows/build-native.yml with: - runner: macos-11 + runner: macos-latest binary: ios build: '["ios-device", "ios-simulator", "ios-catalyst"]' From 74c40eefce024d690dc24c21afe71b233bb03857 Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 01:25:06 +0200 Subject: [PATCH 09/22] Fix tests for ubuntu-20.04 --- .github/workflows/ci.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1613bf0d..ee02a09e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,9 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux - - dart-tests-linux20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux - - flutter-desktop-tests-linux20 - flutter-ios - flutter-android steps: @@ -72,11 +70,9 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux - - dart-tests-linux20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux - - flutter-desktop-tests-linux20 - flutter-ios - flutter-android strategy: @@ -228,19 +224,6 @@ jobs: - build-linux - deploy-cluster secrets: inherit - with: - os: linux - runner: ubuntu-latest - app: dl - cluster: ${{ needs.deploy-cluster.outputs.clusterName }} - - dart-tests-linux20: - name: Linux 20 Dart Tests - uses: ./.github/workflows/dart-desktop-tests.yml - needs: - - build-linux - - deploy-cluster - secrets: inherit with: os: linux runner: ubuntu-20.04 @@ -282,19 +265,6 @@ jobs: - build-linux - deploy-cluster secrets: inherit - with: - os: linux - runner: ubuntu-latest - app: fl - cluster: ${{ needs.deploy-cluster.outputs.clusterName }} - - flutter-desktop-tests-linux20: - name: Linux 20 Flutter Tests - uses: ./.github/workflows/flutter-desktop-tests.yml - needs: - - build-linux - - deploy-cluster - secrets: inherit with: os: linux runner: ubuntu-20.04 From 404456c4fb7a341e5b7555b1ea74cf8356ffb9f1 Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 01:48:13 +0200 Subject: [PATCH 10/22] Return back testing on Linux latest --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee02a09e0..1061266e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -226,7 +226,7 @@ jobs: secrets: inherit with: os: linux - runner: ubuntu-20.04 + runner: ubuntu-latest app: dl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -267,7 +267,7 @@ jobs: secrets: inherit with: os: linux - runner: ubuntu-20.04 + runner: ubuntu-latest app: fl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} From 12d28af67136c21b774e21e5a0c3adbdc6959e7d Mon Sep 17 00:00:00 2001 From: blagoev Date: Tue, 7 Feb 2023 10:57:31 +0200 Subject: [PATCH 11/22] fix expectation --- test/subscription_test.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/subscription_test.dart b/test/subscription_test.dart index ed1e4133d..d6e7906c3 100644 --- a/test/subscription_test.dart +++ b/test/subscription_test.dart @@ -552,11 +552,11 @@ Future main([List? args]) async { await realm.subscriptions.waitForSynchronization(); fail("Expected exception not thrown"); } catch (e) { - expect(e is RealmException, isTrue); + expect(e, isA()); expect((e as RealmException).message, expectedErrorMessage); expect(realm.subscriptions.state, SubscriptionSetState.error); expect(realm.subscriptions.error, isNotNull); - expect(realm.subscriptions.error is RealmException, isTrue); + expect(realm.subscriptions.error, isA()); expect((realm.subscriptions.error as RealmException).message, expectedErrorMessage); } }); From 333e8bf40795b539e98ec4e16dfb3c313c42d0b0 Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 12:35:38 +0200 Subject: [PATCH 12/22] Throw RealmError on loading library --- lib/src/init.dart | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/lib/src/init.dart b/lib/src/init.dart index 7e5958790..e9c3e9e98 100644 --- a/lib/src/init.dart +++ b/lib/src/init.dart @@ -2,6 +2,7 @@ import 'dart:ffi'; import 'dart:io'; import 'package:path/path.dart' as p; +import 'package:realm_common/realm_common.dart'; import '../realm.dart' as realm show isFlutterPlatform; import '../realm.dart' show realmBinaryName; @@ -65,7 +66,7 @@ DynamicLibrary _openRealmLib() { final root = _getNearestProjectRoot(Platform.script.path) ?? _getNearestProjectRoot(p.current); // Try to open lib from various candidate paths - LoadRealmLibraryError? ex; + List errMessages = []; for (final open in [ () => _open(libName), // just ask OS.. () => _open(p.join(_exeDirName, libName)), // try finding it next to the executable @@ -75,11 +76,10 @@ DynamicLibrary _openRealmLib() { try { return open(); } on Error catch (e) { - ex ??= LoadRealmLibraryError(); - ex.add(e); + errMessages.add(e.toString()); } } - throw ex!; // rethrow first + throw RealmError(errMessages.join('\n')); } DynamicLibrary _open(String lib) => DynamicLibrary.open(lib); @@ -113,20 +113,3 @@ DynamicLibrary initRealm() { return _library = realmLibrary; } - -class LoadRealmLibraryError extends Error { - List loadingFromPathErrors = []; - void add(Error err) { - loadingFromPathErrors.add(err); - } - - - @override - String toString() { - List errMessages = []; - for (Error err in loadingFromPathErrors) { - errMessages.add(err.toString()); - } - return errMessages.join('\n'); - } -} From 1550a2deb915ee77833bb53c703c59e80199a71e Mon Sep 17 00:00:00 2001 From: blagoev Date: Tue, 7 Feb 2023 12:38:12 +0200 Subject: [PATCH 13/22] fix publish release yaml --- .github/workflows/publish-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index a38c45f75..a661b7e22 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -193,7 +193,7 @@ jobs: dart pub publish --directory common --force dart pub publish --directory generator --force dart pub publish --directory realm_dart --force - # Passing `release/realm` directory as target because of a how the `flutter pub publish` command handles the --directory argument + #Passing `release/realm` directory as target because of a how the `flutter pub publish` command handles the --directory argument flutter pub publish --directory release/realm --force working-directory: release From af387f4a30e5559e2928575b96a975c690fbfc9a Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 12:47:18 +0200 Subject: [PATCH 14/22] Added tests for ubunto 20.04 --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1061266e1..93d316167 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,9 +48,11 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux + - dart-tests-linux20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux + - flutter-desktop-tests-linux20 - flutter-ios - flutter-android steps: @@ -70,9 +72,11 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux + - dart-tests-linux20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux + - flutter-desktop-tests-linux20 - flutter-ios - flutter-android strategy: @@ -85,12 +89,16 @@ jobs: description: dart macos-arm - app: dl description: dart linux + - app: dl2 + description: dart linux 20 - app: dw description: dart windows - app: fm description: flutter macos - app: fl description: flutter linux + - app: fl2 + description: flutter linux 20 - app: fw description: flutter windows - app: fa @@ -230,6 +238,19 @@ jobs: app: dl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} + dart-tests-linux20: + name: Linux 20 Dart Tests + uses: ./.github/workflows/dart-desktop-tests.yml + needs: + - build-linux + - deploy-cluster + secrets: inherit + with: + os: linux + runner: ubuntu-20.04 + app: dl2 + cluster: ${{ needs.deploy-cluster.outputs.clusterName }} + # Flutter jobs flutter-desktop-tests-windows: @@ -271,6 +292,20 @@ jobs: app: fl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} + flutter-desktop-tests-linux20: + name: Linux 20 Flutter Tests + uses: ./.github/workflows/flutter-desktop-tests.yml + needs: + - build-linux + - deploy-cluster + secrets: inherit + with: + os: linux + runner: ubuntu-20.04 + app: fl2 + cluster: ${{ needs.deploy-cluster.outputs.clusterName }} + + flutter-ios: runs-on: macos-latest name: IOS Flutter Tests From 58c62305a47984d7179c49b3ddbe2ddbd470d8eb Mon Sep 17 00:00:00 2001 From: blagoev Date: Tue, 7 Feb 2023 12:53:29 +0200 Subject: [PATCH 15/22] fix up tests --- test/subscription_test.dart | 85 +++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/test/subscription_test.dart b/test/subscription_test.dart index d6e7906c3..d8795055e 100644 --- a/test/subscription_test.dart +++ b/test/subscription_test.dart @@ -352,7 +352,7 @@ Future main([List? args]) async { final subscriptions = realm.subscriptions; // Illegal query for subscription: - final query = realm.query('tasks.@count > 10'); + final query = realm.query('tasks.@count > 10 SORT(id ASC)'); subscriptions.update((mutableSubscriptions) { mutableSubscriptions.add(query); @@ -519,47 +519,48 @@ Future main([List? args]) async { expect(() => realm.write(() => realm.add(Task(ObjectId()))), throws("no flexible sync subscription has been created")); }); - testSubscriptions('Subscription on non-queryable field should throw', (realm) async { - realm.subscriptions.update((mutableSubscriptions) { - mutableSubscriptions.add(realm.all()); - }); - - realm.write(() { - realm.addAll([ - Event(ObjectId(), name: "NPMG Event", isCompleted: true, durationInMinutes: 30, assignedTo: "@me"), - Event( - ObjectId(), - name: "NPMG Meeting", - isCompleted: false, - durationInMinutes: 10, - ), - Event(ObjectId(), name: "Some other event", isCompleted: true, durationInMinutes: 60), - ]); - }); - - await realm.syncSession.waitForUpload(); - - realm.subscriptions.update((mutableSubscriptions) { - mutableSubscriptions.removeByQuery(realm.all()); - mutableSubscriptions.add(realm.query(r'assignedTo BEGINSWITH $0 AND boolQueryField == $1 AND intQueryField > $2', ["@me", true, 20]), - name: "filter"); - }); - - String expectedErrorMessage = - "Client provided query with bad syntax: unsupported query for table \"${(Event).toString()}\": key \"assignedTo\" is not a queryable field"; - - try { - await realm.subscriptions.waitForSynchronization(); - fail("Expected exception not thrown"); - } catch (e) { - expect(e, isA()); - expect((e as RealmException).message, expectedErrorMessage); - expect(realm.subscriptions.state, SubscriptionSetState.error); - expect(realm.subscriptions.error, isNotNull); - expect(realm.subscriptions.error, isA()); - expect((realm.subscriptions.error as RealmException).message, expectedErrorMessage); - } - }); + //TODO: remove after App Services support for all queryable fields has landed + // testSubscriptions('Subscription on non-queryable field should throw', (realm) async { + // realm.subscriptions.update((mutableSubscriptions) { + // mutableSubscriptions.add(realm.all()); + // }); + + // realm.write(() { + // realm.addAll([ + // Event(ObjectId(), name: "NPMG Event", isCompleted: true, durationInMinutes: 30, assignedTo: "@me"), + // Event( + // ObjectId(), + // name: "NPMG Meeting", + // isCompleted: false, + // durationInMinutes: 10, + // ), + // Event(ObjectId(), name: "Some other event", isCompleted: true, durationInMinutes: 60), + // ]); + // }); + + // await realm.syncSession.waitForUpload(); + + // realm.subscriptions.update((mutableSubscriptions) { + // mutableSubscriptions.removeByQuery(realm.all()); + // mutableSubscriptions.add(realm.query(r'assignedTo BEGINSWITH $0 AND boolQueryField == $1 AND intQueryField > $2', ["@me", true, 20]), + // name: "filter"); + // }); + + // String expectedErrorMessage = + // "Client provided query with bad syntax: unsupported query for table \"${(Event).toString()}\": key \"assignedTo\" is not a queryable field"; + + // try { + // await realm.subscriptions.waitForSynchronization(); + // fail("Expected exception not thrown"); + // } catch (e) { + // expect(e, isA()); + // expect((e as RealmException).message, expectedErrorMessage); + // expect(realm.subscriptions.state, SubscriptionSetState.error); + // expect(realm.subscriptions.error, isNotNull); + // expect(realm.subscriptions.error, isA()); + // expect((realm.subscriptions.error as RealmException).message, expectedErrorMessage); + // } + // }); testSubscriptions('Filter realm data using query subscription', (realm) async { realm.subscriptions.update((mutableSubscriptions) { From 49657ea084351475eea19e6ff25fe1cb73d7ec71 Mon Sep 17 00:00:00 2001 From: blagoev Date: Tue, 7 Feb 2023 13:27:55 +0200 Subject: [PATCH 16/22] expect with a specific message --- test/subscription_test.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/subscription_test.dart b/test/subscription_test.dart index d8795055e..7c404c2b0 100644 --- a/test/subscription_test.dart +++ b/test/subscription_test.dart @@ -30,7 +30,7 @@ import '../lib/src/subscription.dart'; import 'test.dart'; @isTest -void testSubscriptions(String name, FutureOr Function(Realm) tester) async { +void testSubscriptions(String name, FutureOr Function(Realm) testFunc) async { baasTest(name, (appConfiguration) async { final app = App(appConfiguration); final credentials = Credentials.anonymous(); @@ -42,7 +42,7 @@ void testSubscriptions(String name, FutureOr Function(Realm) tester) async ]) ..sessionStopPolicy = SessionStopPolicy.immediately; final realm = getRealm(configuration); - await tester(realm); + await testFunc(realm); }); } @@ -358,7 +358,7 @@ Future main([List? args]) async { mutableSubscriptions.add(query); }); - expect(() async => await subscriptions.waitForSynchronization(), throws()); + expect(() async => await subscriptions.waitForSynchronization(), throws("invalid RQL")); }); testSubscriptions('MutableSubscriptionSet.remove same query, different classes', (realm) { From 04ff522667dfe04f71d0d6ed1c336f844e70ed00 Mon Sep 17 00:00:00 2001 From: blagoev Date: Tue, 7 Feb 2023 13:29:30 +0200 Subject: [PATCH 17/22] Update .github/workflows/flutter-desktop-tests.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kasper Overgård Nielsen --- .github/workflows/flutter-desktop-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutter-desktop-tests.yml b/.github/workflows/flutter-desktop-tests.yml index 5d14fb607..0590575c3 100644 --- a/.github/workflows/flutter-desktop-tests.yml +++ b/.github/workflows/flutter-desktop-tests.yml @@ -8,7 +8,7 @@ on: required: true type: string runner: - description: GitHub runnar image to execute on. + description: GitHub runner image to execute on. required: true type: string architecture: From 50e423f9f4b1791fa7f46d431252c073b6ab492f Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 13:39:18 +0200 Subject: [PATCH 18/22] jobs renamed --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93d316167..fd4f477ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,11 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux - - dart-tests-linux20 + - dart-tests-linux-ubuntu-20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux - - flutter-desktop-tests-linux20 + - flutter-desktop-tests-linux-ubuntu-20 - flutter-ios - flutter-android steps: @@ -72,11 +72,11 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux - - dart-tests-linux20 + - dart-tests-linux-ubuntu-20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux - - flutter-desktop-tests-linux20 + - flutter-desktop-tests-linux-ubuntu-20 - flutter-ios - flutter-android strategy: @@ -238,8 +238,8 @@ jobs: app: dl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} - dart-tests-linux20: - name: Linux 20 Dart Tests + dart-tests-linux-ubuntu-20: + name: Linux Dart Tests (ubuntu 20) uses: ./.github/workflows/dart-desktop-tests.yml needs: - build-linux @@ -292,8 +292,8 @@ jobs: app: fl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} - flutter-desktop-tests-linux20: - name: Linux 20 Flutter Tests + flutter-desktop-tests-linux-ubuntu-20: + name: Linux Flutter Tests (ubuntu 20) uses: ./.github/workflows/flutter-desktop-tests.yml needs: - build-linux From ad3dfc829abee67cdd9ec6ee50e123bb383486a9 Mon Sep 17 00:00:00 2001 From: Desislava Stefanova Date: Tue, 7 Feb 2023 13:44:00 +0200 Subject: [PATCH 19/22] Add a commnet next to the build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd4f477ff..a442898f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,7 +153,7 @@ jobs: name: Build Linux uses: ./.github/workflows/build-native.yml with: - runner: ubuntu-20.04 + runner: ubuntu-20.04 # Building on the lowest possible Linux (Ubuntu) version for compatibility binary: linux build: '["linux"]' From 48d2009f237a7b0b2e708c190578ac9e2131d60a Mon Sep 17 00:00:00 2001 From: blagoev Date: Tue, 7 Feb 2023 13:45:23 +0200 Subject: [PATCH 20/22] remove not needed test --- test/subscription_test.dart | 43 ------------------------------------- 1 file changed, 43 deletions(-) diff --git a/test/subscription_test.dart b/test/subscription_test.dart index 7c404c2b0..4f3376eb1 100644 --- a/test/subscription_test.dart +++ b/test/subscription_test.dart @@ -519,49 +519,6 @@ Future main([List? args]) async { expect(() => realm.write(() => realm.add(Task(ObjectId()))), throws("no flexible sync subscription has been created")); }); - //TODO: remove after App Services support for all queryable fields has landed - // testSubscriptions('Subscription on non-queryable field should throw', (realm) async { - // realm.subscriptions.update((mutableSubscriptions) { - // mutableSubscriptions.add(realm.all()); - // }); - - // realm.write(() { - // realm.addAll([ - // Event(ObjectId(), name: "NPMG Event", isCompleted: true, durationInMinutes: 30, assignedTo: "@me"), - // Event( - // ObjectId(), - // name: "NPMG Meeting", - // isCompleted: false, - // durationInMinutes: 10, - // ), - // Event(ObjectId(), name: "Some other event", isCompleted: true, durationInMinutes: 60), - // ]); - // }); - - // await realm.syncSession.waitForUpload(); - - // realm.subscriptions.update((mutableSubscriptions) { - // mutableSubscriptions.removeByQuery(realm.all()); - // mutableSubscriptions.add(realm.query(r'assignedTo BEGINSWITH $0 AND boolQueryField == $1 AND intQueryField > $2', ["@me", true, 20]), - // name: "filter"); - // }); - - // String expectedErrorMessage = - // "Client provided query with bad syntax: unsupported query for table \"${(Event).toString()}\": key \"assignedTo\" is not a queryable field"; - - // try { - // await realm.subscriptions.waitForSynchronization(); - // fail("Expected exception not thrown"); - // } catch (e) { - // expect(e, isA()); - // expect((e as RealmException).message, expectedErrorMessage); - // expect(realm.subscriptions.state, SubscriptionSetState.error); - // expect(realm.subscriptions.error, isNotNull); - // expect(realm.subscriptions.error, isA()); - // expect((realm.subscriptions.error as RealmException).message, expectedErrorMessage); - // } - // }); - testSubscriptions('Filter realm data using query subscription', (realm) async { realm.subscriptions.update((mutableSubscriptions) { mutableSubscriptions.add(realm.all()); From 7625372580a9778271e3b61e22aa5091d2adccf5 Mon Sep 17 00:00:00 2001 From: Desislava Stefanova <95419820+desistefanova@users.noreply.github.com> Date: Tue, 7 Feb 2023 15:31:10 +0200 Subject: [PATCH 21/22] Update .github/workflows/ci.yml Co-authored-by: blagoev --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a442898f3..160921026 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -305,7 +305,6 @@ jobs: app: fl2 cluster: ${{ needs.deploy-cluster.outputs.clusterName }} - flutter-ios: runs-on: macos-latest name: IOS Flutter Tests From a8c4947746120512bd96f2edf1e32464235607cc Mon Sep 17 00:00:00 2001 From: Desislava Stefanova <95419820+desistefanova@users.noreply.github.com> Date: Tue, 7 Feb 2023 15:33:17 +0200 Subject: [PATCH 22/22] Apply suggestions from code review Co-authored-by: blagoev --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 160921026..e72a05a45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: - app: dl description: dart linux - app: dl2 - description: dart linux 20 + description: dart linux (ubuntu 20) - app: dw description: dart windows - app: fm @@ -98,7 +98,7 @@ jobs: - app: fl description: flutter linux - app: fl2 - description: flutter linux 20 + description: flutter linux (ubuntu 20) - app: fw description: flutter windows - app: fa