Skip to content

Commit

Permalink
Run dart tests on M1 (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev authored Jun 13, 2022
1 parent b285f8c commit 268ca27
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 199 deletions.
213 changes: 41 additions & 172 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
package: flutter
- platform: android
package: flutter
- platform: macos-arm
package: dart
runs-on: ubuntu-latest
name: Deploy apps ${{ matrix.platform }} for ${{ matrix.package }}
timeout-minutes: 20
Expand Down Expand Up @@ -71,14 +73,10 @@ jobs:
runs-on: ubuntu-latest
name: Cleanup cluster
needs:
- tests-linux
- flutter-linux
- tests-macos
- flutter-macos
- tests-windows
- flutter-windows
- flutter-desktop
- flutter-ios
- flutter-android
- tests-dart
if: always()
timeout-minutes: 5
steps:
Expand Down Expand Up @@ -247,14 +245,23 @@ jobs:
librealm-android-armeabi-v7a
librealm-android-arm64-v8a
# Linux jobs
# Dart jobs

tests-linux:
runs-on: ubuntu-latest
name: Tests Linux
tests-dart:
runs-on: ${{ matrix.platform == 'linux' && 'ubuntu' || matrix.platform }}-${{ matrix.architecture || 'latest' }}
name: Tests ${{ matrix.platform }} ${{ matrix.architecture }}
strategy:
fail-fast: false
matrix:
include:
- platform: macos
- platform: macos
architecture: arm
- platform: windows
- platform: linux
env:
BAAS_CLUSTER: ${{ needs.deploy-cluster.outputs.clusterName }}
BAAS_DIFFERENTIATOR: dart-linux
BAAS_DIFFERENTIATOR: dart-${{ matrix.platform }}${{ matrix.architecture && format('-{0}', matrix.architecture) || '' }}
needs:
- baas-matrix
- deploy-cluster
Expand All @@ -265,29 +272,39 @@ jobs:
with:
submodules: false

- name: Cleanup Workspace
run: git clean -fdx

- name: Fetch artifacts
uses: actions/download-artifact@v2
with:
name: librealm-linux
path: binary/linux
name: librealm-${{ matrix.platform }}
path: binary/${{ matrix.platform }}

- name : Setup Dart SDK
uses: dart-lang/setup-dart@main
with:
sdk: stable
architecture: ${{ matrix.architecture == 'arm' && 'arm64' || 'x64'}}

- name: Install dependencies
run: dart pub get

- name: Run tests
run: dart test -r expanded -j 1 --test-randomize-ordering-seed random
run: ${{ matrix.architecture == 'arm' && 'arch -arm64 ' || '' }}dart test -r expanded -j 1 --test-randomize-ordering-seed random

flutter-linux:
runs-on: ubuntu-latest
name: Flutter Tests Linux
# Flutter jobs

flutter-desktop:
runs-on: ${{ matrix.platform == 'linux' && 'ubuntu' || matrix.platform }}-latest
strategy:
fail-fast: false
matrix:
platform: [ 'macos', 'windows', 'linux']
name: Flutter ${{ matrix.platform }}
env:
BAAS_CLUSTER: ${{ needs.deploy-cluster.outputs.clusterName }}
BAAS_DIFFERENTIATOR: flutter-linux
BAAS_DIFFERENTIATOR: flutter-${{ matrix.platform }}
needs:
- baas-matrix
- deploy-cluster
Expand All @@ -299,182 +316,36 @@ jobs:
submodules: false

- name: Setup GTK
if: ${{ matrix.platform == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y libgtk-3-dev xvfb
- name: Setup Ninja
if: ${{ matrix.platform == 'linux' }}
uses: seanmiddleditch/gha-setup-ninja@master

- name: Fetch artifacts
uses: actions/download-artifact@v2
with:
name: librealm-linux
path: binary/linux

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'

- name: Enable Flutter Desktop support
run: flutter config --enable-linux-desktop

- name: Install dependencies
run: flutter pub get

- name: Run tests
run: xvfb-run flutter drive -d linux --target=test_driver/app.dart --suppress-analytics --dart-entrypoint-args="" #--verbose #-a="Some test name"
working-directory: ./flutter/realm_flutter/tests

# macOS jobs

tests-macos:
runs-on: macos-latest
name: Tests macOS
env:
BAAS_CLUSTER: ${{ needs.deploy-cluster.outputs.clusterName }}
BAAS_DIFFERENTIATOR: dart-macos
needs:
- baas-matrix
- deploy-cluster
- build-native
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: false

- name: Fetch artifacts
uses: actions/download-artifact@v2
with:
name: librealm-macos
path: binary/macos

- name : Setup Dart SDK
uses: dart-lang/setup-dart@main
with:
sdk: stable

- name: Install dependencies
run: dart pub get

- name: Run tests
run: dart test -r expanded -j 1 --test-randomize-ordering-seed random

flutter-macos:
runs-on: macos-latest
name: Flutter Tests macOS
env:
BAAS_CLUSTER: ${{ needs.deploy-cluster.outputs.clusterName }}
BAAS_DIFFERENTIATOR: flutter-macos
needs:
- baas-matrix
- deploy-cluster
- build-native
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: false

- name: Fetch artifacts
uses: actions/download-artifact@v2
with:
name: librealm-macos
path: binary/macos

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'

- name: Enable Flutter Desktop support
run: flutter config --enable-macos-desktop

- name: Install dependencies
run: flutter pub get

- name: Run tests
run: flutter drive -d macos --target=test_driver/app.dart --suppress-analytics --dart-entrypoint-args="" #--verbose #-a="Some test name"
working-directory: ./flutter/realm_flutter/tests

# Windows jobs

tests-windows:
runs-on: windows-latest
name: Tests Windows
env:
BAAS_CLUSTER: ${{ needs.deploy-cluster.outputs.clusterName }}
BAAS_DIFFERENTIATOR: dart-windows
needs:
- baas-matrix
- deploy-cluster
- build-native
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: false

- name: Fetch artifacts
uses: actions/download-artifact@v2
with:
name: librealm-windows
path: binary/windows

- name : Setup Dart SDK
uses: dart-lang/setup-dart@main
with:
sdk: stable

- name: Install dependencies
run: dart pub get

- name: Run tests
run: |
dart test -r expanded -j 1 --test-randomize-ordering-seed random
flutter-windows:
# TODO: build on windows-latest
runs-on: windows-2019
name: Flutter Tests Windows
env:
BAAS_CLUSTER: ${{ needs.deploy-cluster.outputs.clusterName }}
BAAS_DIFFERENTIATOR: flutter-windows
needs:
- baas-matrix
- deploy-cluster
- build-native
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: false

- name: Fetch artifacts
uses: actions/download-artifact@v2
with:
name: librealm-windows
path: binary/windows
name: librealm-${{ matrix.platform }}
path: binary/${{ matrix.platform }}

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'

- name: Enable Flutter Desktop support
run: flutter config --enable-windows-desktop
run: flutter config --enable-${{ matrix.platform }}-desktop

- name: Install dependencies
run: flutter pub get

- name: Run tests
run: flutter drive -d windows --target=test_driver/app.dart --suppress-analytics --dart-entrypoint-args="" #--verbose #-a="Some test name"
run: ${{ matrix.platform == 'linux' && 'xvfb-run ' || '' }}flutter drive -d ${{ matrix.platform }} --target=test_driver/app.dart --suppress-analytics --dart-entrypoint-args="" #--verbose #-a="Some test name"
working-directory: ./flutter/realm_flutter/tests

# iOS jobs

flutter-ios:
runs-on: macos-latest
name: Flutter Tests iOS
Expand Down Expand Up @@ -520,8 +391,6 @@ jobs:
flutter drive --target=test_driver/app.dart --dart-define=testName="" --suppress-analytics
working-directory: ./flutter/realm_flutter/tests

# Android jobs

flutter-android:
runs-on: macos-latest
name: Flutter Tests Android
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
changelog: ${{ github.workspace }}/CHANGELOG.md
version-suffix: '+beta'


- name: Update pubspec.yaml
uses: jacobtomlinson/gha-find-replace@b76729678e8d52dadb12e0e16454a93e301a919d #! 2.0.0
with:
Expand Down
3 changes: 0 additions & 3 deletions test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import 'realm_object_test.dart';
import 'test.dart';

Future<void> main([List<String>? args]) async {
print("Current PID $pid");

await setupTests(args);

test('AppConfiguration can be initialized', () {
Expand Down Expand Up @@ -184,7 +182,6 @@ Future<void> main([List<String>? args]) async {
expect(app.users, [user1, user]);
});


baasTest('Realm.logger', (configuration) async {
Realm.logger = Logger.detached(generateRandomString(10))..level = RealmLogLevel.all;
configuration = AppConfiguration(
Expand Down
2 changes: 0 additions & 2 deletions test/configuration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import '../lib/realm.dart';
import 'test.dart';

Future<void> main([List<String>? args]) async {
print("Current PID $pid");

await setupTests(args);

test('Configuration can be created', () {
Expand Down
4 changes: 0 additions & 4 deletions test/credentials_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,13 @@
//
////////////////////////////////////////////////////////////////////////////////
import 'dart:io';

import 'package:test/test.dart' hide test, throws;
import '../lib/realm.dart';
import 'test.dart';

Future<void> main([List<String>? args]) async {
const String strongPassword = "SWV23R#@T#VFQDV";

print("Current PID $pid");

await setupTests(args);

test('Credentials anonymous', () {
Expand Down
3 changes: 0 additions & 3 deletions test/list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@
// ignore_for_file: unused_local_variable

import 'dart:io';
import 'package:test/test.dart' hide test, throws;
import '../lib/realm.dart';
import 'test.dart';

Future<void> main([List<String>? args]) async {
print("Current PID $pid");

await setupTests(args);

test('Lists add object with a list property', () {
Expand Down
3 changes: 0 additions & 3 deletions test/realm_object_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import 'dart:io';
import 'package:test/test.dart' hide test, throws;
import '../lib/realm.dart';
import '../lib/realm.dart';

import 'test.dart';

Expand Down Expand Up @@ -84,8 +83,6 @@ extension on DateTime {
}

Future<void> main([List<String>? args]) async {
print("Current PID $pid");

await setupTests(args);

test('RealmObject get property', () {
Expand Down
2 changes: 0 additions & 2 deletions test/realm_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import '../lib/realm.dart';
import 'test.dart';

Future<void> main([List<String>? args]) async {
print("Current PID $pid");

await setupTests(args);

test('Realm can be created', () {
Expand Down
Loading

0 comments on commit 268ca27

Please sign in to comment.