mirror of https://github.com/AMT-Cheif/drift.git
Test and coverage the sql parser
This commit is contained in:
parent
b4cdcf0431
commit
4c7874dd91
|
@ -3,8 +3,15 @@ container:
|
|||
image: "google/dart:latest"
|
||||
|
||||
task:
|
||||
name: Analysis and Tests
|
||||
pub_cache:
|
||||
folder: $HOME/.pub-cache
|
||||
pub_get_script: tool/pub_get.sh
|
||||
analyze_script: tool/analyze.sh
|
||||
test_moor_script: tool/test_moor.sh
|
||||
test_moor_script: tool/test_moor.sh
|
||||
test_sqlparser_script: tool/test_sqlparser.sh
|
||||
|
||||
upload_coverage_task:
|
||||
name: Upload coverage
|
||||
depends_on: [task]
|
||||
format_coverage_task: tool/upload_coverage.sh
|
|
@ -1,2 +1,4 @@
|
|||
**/.idea
|
||||
**/*.iml
|
||||
|
||||
lcov.info
|
|
@ -8,7 +8,7 @@ env:
|
|||
- PKG="sqlparser"
|
||||
|
||||
script: ./tool/mono_repo_wrapper.sh
|
||||
after_success: ./tool/upload_coverage.sh
|
||||
#after_success: ./tool/upload_coverage.sh
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
|
|
@ -9,7 +9,16 @@ Future main() async {
|
|||
packagesPath: 'moor/.packages',
|
||||
);
|
||||
|
||||
final coverage = await parseCoverage([File('moor/coverage.json')], 1);
|
||||
final potentialFiles = [
|
||||
File('moor/coverage.json'),
|
||||
File('sqlparser/coverage.json'),
|
||||
];
|
||||
|
||||
final existingFiles = [
|
||||
for (var file in potentialFiles) if (file.existsSync()) file
|
||||
];
|
||||
|
||||
final coverage = await parseCoverage(existingFiles, 1);
|
||||
|
||||
// report coverage for the moor and moor_generator package
|
||||
final lcov = await LcovFormatter(
|
||||
|
@ -17,9 +26,10 @@ Future main() async {
|
|||
reportOn: [
|
||||
'moor/lib/',
|
||||
'moor_generator/lib',
|
||||
'sqlparser/lib',
|
||||
],
|
||||
basePath: '.',
|
||||
).format(coverage);
|
||||
|
||||
File('moor/lcov.info').writeAsStringSync(lcov);
|
||||
File('lcov.info').writeAsStringSync(lcov);
|
||||
}
|
||||
|
|
|
@ -9,3 +9,5 @@ build/
|
|||
|
||||
# Directory created by dartdoc
|
||||
doc/api/
|
||||
|
||||
coverage.json
|
|
@ -16,3 +16,7 @@ dependencies:
|
|||
|
||||
dev_dependencies:
|
||||
test: ^1.6.0
|
||||
test_core: any # version will be determined by "test"
|
||||
path: ^1.6.0
|
||||
coverage:
|
||||
git: https://github.com/simolus3/coverage.git
|
|
@ -0,0 +1,12 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:coverage/coverage.dart';
|
||||
import 'package:path/path.dart';
|
||||
|
||||
void main() async {
|
||||
final tests = join(File.fromUri(Platform.script).parent.path, 'tester.dart');
|
||||
final coverage = await runAndCollect(tests, onExit: true, printOutput: true);
|
||||
|
||||
File('coverage.json').writeAsStringSync(json.encode(coverage));
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import 'package:test_core/src/executable.dart' as test;
|
||||
|
||||
void main() async {
|
||||
await test.main([]);
|
||||
|
||||
print('Tests ran, now collecting coverage...');
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd sqlparser
|
||||
dart tool/coverage.dart
|
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$PKG" == "moor" ]; then
|
||||
pushd moor
|
||||
bash <(curl -s https://codecov.io/bash) -f lcov.info
|
||||
fi
|
||||
# The formatter is in the moor directory
|
||||
pushd moor
|
||||
dart tool/format_coverage.dart
|
||||
popd
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) -f lcov.info
|
||||
|
|
Loading…
Reference in New Issue