diff --git a/.github/workflows/build-native.yml b/.github/workflows/build-native.yml index aa1a2c089..dd981926d 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: @@ -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/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23f8a28a8..e72a05a45 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-linux-ubuntu-20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux + - flutter-desktop-tests-linux-ubuntu-20 - flutter-ios - flutter-android steps: @@ -70,9 +72,11 @@ jobs: - dart-tests-macos - dart-tests-macos-arm - dart-tests-linux + - dart-tests-linux-ubuntu-20 - flutter-desktop-tests-windows - flutter-desktop-tests-macos - flutter-desktop-tests-linux + - flutter-desktop-tests-linux-ubuntu-20 - flutter-ios - flutter-android strategy: @@ -85,12 +89,16 @@ jobs: description: dart macos-arm - app: dl description: dart linux + - app: dl2 + description: dart linux (ubuntu 20) - app: dw description: dart windows - app: fm description: flutter macos - app: fl description: flutter linux + - app: fl2 + description: flutter linux (ubuntu 20) - app: fw description: flutter windows - app: fa @@ -129,7 +137,7 @@ jobs: name: Build Windows uses: ./.github/workflows/build-native.yml with: - runner: windows + runner: windows-latest binary: windows build: '["windows"]' @@ -137,7 +145,7 @@ jobs: name: Build MacOS uses: ./.github/workflows/build-native.yml with: - runner: macos + runner: macos-latest binary: macos build: '["macos"]' @@ -145,7 +153,7 @@ jobs: name: Build Linux uses: ./.github/workflows/build-native.yml with: - runner: ubuntu + runner: ubuntu-20.04 # Building on the lowest possible Linux (Ubuntu) version for compatibility binary: linux build: '["linux"]' @@ -153,7 +161,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 +169,7 @@ jobs: name: Build IOS uses: ./.github/workflows/build-native.yml with: - runner: macos + runner: macos-latest binary: ios build: '["ios-device", "ios-simulator", "ios-catalyst"]' @@ -186,6 +194,7 @@ jobs: secrets: inherit with: os: windows + runner: windows-latest app: dw cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -198,6 +207,7 @@ jobs: secrets: inherit with: os: macos + runner: macos-latest app: dm cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -210,6 +220,7 @@ jobs: secrets: inherit with: os: macos + runner: macos-arm architecture: arm app: dma cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -223,9 +234,23 @@ jobs: secrets: inherit with: os: linux + runner: ubuntu-latest app: dl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} + dart-tests-linux-ubuntu-20: + name: Linux Dart Tests (ubuntu 20) + 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: @@ -237,6 +262,7 @@ jobs: secrets: inherit with: os: windows + runner: windows-latest app: fw cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -249,6 +275,7 @@ jobs: secrets: inherit with: os: macos + runner: macos-latest app: fm cluster: ${{ needs.deploy-cluster.outputs.clusterName }} @@ -261,9 +288,23 @@ jobs: secrets: inherit with: os: linux + runner: ubuntu-latest app: fl cluster: ${{ needs.deploy-cluster.outputs.clusterName }} + flutter-desktop-tests-linux-ubuntu-20: + name: Linux Flutter Tests (ubuntu 20) + 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 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..0590575c3 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 runner 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: 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). diff --git a/lib/src/init.dart b/lib/src/init.dart index 6637807f8..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 - Error? 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,10 +76,10 @@ DynamicLibrary _openRealmLib() { try { return open(); } on Error catch (e) { - ex ??= e; // remember first exception, if everything fails + errMessages.add(e.toString()); } } - throw ex!; // rethrow first + throw RealmError(errMessages.join('\n')); } DynamicLibrary _open(String lib) => DynamicLibrary.open(lib);