Skip to content

Commit

Permalink
Merge branch 'main' into ni/object-schema
Browse files Browse the repository at this point in the history
* main:
  Switch to integration tests (#1461)
  Always use persistent handles when passing dart objects as userdata to callbacks (#1491)

# Conflicts:
#	test/dynamic_realm_test.dart
  • Loading branch information
nirinchev committed Jan 26, 2024
2 parents e51674d + 517ace7 commit a3d3d2b
Show file tree
Hide file tree
Showing 115 changed files with 972 additions and 735 deletions.
39 changes: 36 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,23 @@ jobs:

- name: Run tests on iOS Simulator
run: |
flutter drive --target=test_driver/app.dart --dart-define=testName="" --suppress-analytics --debug
flutter test integration_test/all_tests.dart \
--dart-define=BAAS_BAASAAS_API_KEY=$BAAS_BAASAAS_API_KEY \
--dart-define=BAAS_DIFFERENTIATOR=$BAAS_DIFFERENTIATOR \
--file-reporter=json:test-results.json \
--suppress-analytics
working-directory: ./flutter/realm_flutter/tests

- name: Publish Test Report
uses: dorny/[email protected]
if: success() || failure()
with:
name: Test Results Flutter iOS
path: test-results.json
reporter: dart-json
only-summary: true
working-directory: ./flutter/realm_flutter/tests

cleanup-cluster-flutter-ios:
name: Cleanup Cluster for Flutter iOS
uses: ./.github/workflows/terminate-baas.yml
Expand All @@ -342,7 +356,7 @@ jobs:
differentiator: fa${{ github.run_id }}${{ github.run_attempt }}

flutter-tests-android:
runs-on: macos-latest
runs-on: ubuntu-latest
name: Flutter Tests Android
timeout-minutes: 45
needs:
Expand All @@ -358,6 +372,15 @@ jobs:
with:
submodules: 'recursive'

- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Gradle cache
uses: gradle/gradle-build-action@v2

- name: Set up Java
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -411,7 +434,17 @@ jobs:
ndk: 21.0.6113669
arch: x86
cmake: 3.10.2.4988404
script: flutter build apk --debug --target=test_driver/app.dart && flutter install --debug && flutter drive --target=test_driver/app.dart --dart-define=testName="" --suppress-analytics --debug
script: flutter test integration_test/all_tests.dart --dart-define=BAAS_BAASAAS_API_KEY=$BAAS_BAASAAS_API_KEY --dart-define=BAAS_DIFFERENTIATOR=$BAAS_DIFFERENTIATOR --file-reporter=json:test-results.json --suppress-analytics
working-directory: ./flutter/realm_flutter/tests

- name: Publish Test Report
uses: dorny/[email protected]
if: success() || failure()
with:
name: Test Results Flutter Android
path: test-results.json
reporter: dart-json
only-summary: true
working-directory: ./flutter/realm_flutter/tests

cleanup-cluster-flutter-android:
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/flutter-desktop-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,23 @@ jobs:
if: ${{ contains(inputs.os, 'macos') }}

- name: Run tests
run: ${{ inputs.os == 'linux' && 'xvfb-run' || '' }} flutter drive -d ${{ inputs.os }} --target=test_driver/app.dart --suppress-analytics --dart-entrypoint-args="" --debug # -a="Some test name"
run: |
${{ inputs.os == 'linux' && 'xvfb-run' || '' }} \
flutter test integration_test/all_tests.dart \
--dart-define=BAAS_BAASAAS_API_KEY=$BAAS_BAASAAS_API_KEY \
--dart-define=BAAS_DIFFERENTIATOR=$BAAS_DIFFERENTIATOR \
--device-id=${{ inputs.os }} \
--file-reporter=json:test-results.json \
--suppress-analytics
shell: bash
working-directory: ./flutter/realm_flutter/tests

- name: Publish Test Report
uses: dorny/[email protected]
if: success() || failure()
with:
name: Test Results Flutter ${{ inputs.os }} ${{ inputs.architecture }}
path: test-results.json
reporter: dart-json
only-summary: true
working-directory: ./flutter/realm_flutter/tests
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
## vNext (TBD)

### Enhancements
* None
* Added `RealmObject.getBacklinks<SourceType>('sourceProperty')` which is a method allowing you to look up all objects of type `SourceType` which link to the current object via their `sourceProperty` property. (Issue [#1480](https://github.com/realm/realm-dart/issues/1480))

### Fixed
* None
* Fix a possible hang (or in rare cases crash) during notification handling. (Issue [#1492](https://github.com/realm/realm-dart/issues/1492))
* Fix Flutter app build on Linux. A contribution from [thiagokisaki](https://github.com/thiagokisaki). (PR [#1488](https://github.com/realm/realm-dart/pull/1488))

### Compatibility
* Realm Studio: 13.0.0 or later.

### Internal
* Using Core x.y.z.
* Using Core 13.26.0

## 1.7.0 (2024-01-23)

Expand Down Expand Up @@ -40,7 +41,6 @@
The map keys may not contain `.` or start with `$`. (Issue [#685](https://github.com/realm/realm-dart/issues/685))
* Added a new exception - `MigrationRequiredException` that will be thrown when a local Realm is opened with a schema that differs from the schema on disk and no migration callback is supplied. Additionally, a `helpLink` property has been added to `RealmException` and its subclasses to provide a link to the documentation for the error. (Issue [#1448](https://github.com/realm/realm-dart/issues/1448))
* Downgrade minimum dependencies to Dart 3.0.0 and Flutter 3.10.0. (PR [#1457](https://github.com/realm/realm-dart/pull/1457))
* Added `RealmObject.getBacklinks<SourceType>('sourceProperty')` which is a method allowing you to look up all objects of type `SourceType` which link to the current object via their `sourceProperty` property. (Issue [#1480](https://github.com/realm/realm-dart/issues/1480))

### Fixed
* Fixed warnings being emitted by the realm generator requesting that `xyz.g.dart` be included with `part 'xyz.g.dart';` for `xyz.dart` files that import `realm` but don't have realm models defined. Those should not need generated parts and including the part file would have resulted in an empty file with `// ignore_for_file: type=lint` being generated. (PR [#1443](https://github.com/realm/realm-dart/pull/1443))
Expand Down
1 change: 0 additions & 1 deletion common/topic.md

This file was deleted.

10 changes: 0 additions & 10 deletions dartdoc_options.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
dartdoc:
categories:
"Configuration":
markdown: topic.md
name: Configuration
"Annotations":
markdown: topic.md
name: Annotations
"Realm":
markdown: topic.md
name: Realm
"Application":
markdown: topic.md
name: Application
"Sync":
markdown: topic.md
name: Sync
categoryOrder: ["Realm", "Configuration", "Annotations", "Application", "Sync"]
examplePathPrefix: 'example'
# nodoc: ['generator/flutter/ffigen/scripts/src/test/*.g.dart']
Expand Down
6 changes: 0 additions & 6 deletions flavor_helpers.dart

This file was deleted.

1 change: 0 additions & 1 deletion flutter/realm_flutter/data

This file was deleted.

19 changes: 0 additions & 19 deletions flutter/realm_flutter/realm_flutter.iml

This file was deleted.

36 changes: 34 additions & 2 deletions flutter/realm_flutter/tests/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,39 @@
# This file should be version controlled and should not be manually edited.

version:
revision: f18b9281c2280c2646aa3d4348715ed5bb9446c8
channel: beta
revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: android
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: ios
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: linux
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: macos
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
- platform: windows
create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4
base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
35 changes: 24 additions & 11 deletions flutter/realm_flutter/tests/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,21 +22,31 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
namespace "io.realm.tests"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.realm.tests"
minSdkVersion 16
targetSdkVersion 30
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand All @@ -52,3 +63,5 @@ android {
flutter {
source '../..'
}

dependencies {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.realm.tests">
<!-- Flutter needs it to communicate with the running application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.realm.tests">
<application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="tests"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand All @@ -18,15 +19,6 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.realm.tests

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.realm.tests">
<!-- Flutter needs it to communicate with the running application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
Loading

0 comments on commit a3d3d2b

Please sign in to comment.