feat: codecov (#327)

* [llc] add codecov in gh action

* update flag

* update path

* fix codevcov script

* fix codevcov script

* [persistence]: add basic test

* [persistence] add codecov

* [persistence] vgv action

* update threashold

* fix ci

* add coverage for ui packages

* fix ci

* test gh action

* test gh action

* update threashold

* fix(persistence): fix tests

Signed-off-by: Sahil Kumar <[email protected]>

Co-authored-by: Sahil Kumar <[email protected]>
This commit is contained in:
Salvatore Giordano
2021-03-11 16:36:22 +01:00
committed by GitHub
co-authored by Sahil Kumar
parent 4b6f1f54b6
commit 39c2106497
9 changed files with 120 additions and 84 deletions
@@ -1,5 +1,6 @@
import 'dart:io';
import 'dart:isolate';
import 'package:moor/ffi.dart';
import 'package:moor/isolate.dart';
import 'package:moor/moor.dart';
@@ -20,17 +21,20 @@ class SharedDB {
static Future<VmDatabase> constructDatabase(
String userId, {
bool logStatements = false,
bool persistOnDisk = true,
}) async {
final dbName = 'db_$userId';
if (Platform.isIOS || Platform.isAndroid) {
final dir = await getApplicationDocumentsDirectory();
final path = join(dir.path, '$dbName.sqlite');
final file = File(path);
return VmDatabase(file, logStatements: logStatements);
}
if (Platform.isMacOS || Platform.isLinux) {
final file = File('$dbName.sqlite');
return VmDatabase(file, logStatements: logStatements);
if (persistOnDisk) {
if (Platform.isIOS || Platform.isAndroid) {
final dir = await getApplicationDocumentsDirectory();
final path = join(dir.path, '$dbName.sqlite');
final file = File(path);
return VmDatabase(file, logStatements: logStatements);
}
if (Platform.isMacOS || Platform.isLinux) {
final file = File('$dbName.sqlite');
return VmDatabase(file, logStatements: logStatements);
}
}
return VmDatabase.memory(logStatements: logStatements);
}
@@ -8,6 +8,7 @@ class SharedDB {
static dynamic constructDatabase(
String userId, {
bool logStatements = false,
bool persistOnDisk = true,
}) {
throw 'Unsupported Platform';
}
@@ -12,6 +12,7 @@ class SharedDB {
static Future<WebDatabase> constructDatabase(
String userId, {
bool logStatements = false,
bool persistOnDisk = true, // ignored on web
}) async {
final dbName = 'db_$userId';
return WebDatabase(dbName, logStatements: logStatements);