feat: add coverage to MRs
This commit is contained in:
parent
e78bf3fc09
commit
073d98cf3d
|
|
@ -14,6 +14,8 @@ native/
|
||||||
test/.test_coverage.dart
|
test/.test_coverage.dart
|
||||||
coverage/
|
coverage/
|
||||||
coverage_badge.svg
|
coverage_badge.svg
|
||||||
|
coverage.xml
|
||||||
|
TEST-report.*
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
*.iml
|
*.iml
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ workflow:
|
||||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
FLUTTER_IMAGE_TAG: '3.0.3'
|
FLUTTER_IMAGE_TAG: '3.0.5'
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -23,9 +23,18 @@ coverage:
|
||||||
- rm -r example
|
- rm -r example
|
||||||
- ./scripts/prepare.sh
|
- ./scripts/prepare.sh
|
||||||
- ./scripts/test.sh
|
- ./scripts/test.sh
|
||||||
|
coverage: /^\s*lines\.*:\s*\d+.\d+\%/
|
||||||
artifacts:
|
artifacts:
|
||||||
|
when: always
|
||||||
paths:
|
paths:
|
||||||
- coverage/
|
- coverage/
|
||||||
|
- coverage.xml
|
||||||
|
- TEST-report.xml
|
||||||
|
reports:
|
||||||
|
coverage_report:
|
||||||
|
coverage_format: cobertura
|
||||||
|
path: coverage.xml
|
||||||
|
junit: TEST-report.xml
|
||||||
|
|
||||||
coverage_without_olm:
|
coverage_without_olm:
|
||||||
tags:
|
tags:
|
||||||
|
|
@ -33,9 +42,26 @@ coverage_without_olm:
|
||||||
stage: test
|
stage: test
|
||||||
image: dart
|
image: dart
|
||||||
dependencies: []
|
dependencies: []
|
||||||
|
variables:
|
||||||
|
NO_OLM: 1
|
||||||
|
before_script:
|
||||||
|
- apt-get update && apt-get install --no-install-recommends --no-install-suggests -y curl lcov python3 python3-distutils
|
||||||
|
- curl -o /bin/lcov_cobertura.py https://raw.githubusercontent.com/eriwen/lcov-to-cobertura-xml/master/lcov_cobertura/lcov_cobertura.py && sed 's/env python/env python3/' -i /bin/lcov_cobertura.py && chmod +x /bin/lcov_cobertura.py
|
||||||
script:
|
script:
|
||||||
- dart pub get
|
- dart pub get
|
||||||
- dart pub run test
|
- ./scripts/test.sh
|
||||||
|
coverage: /^\s*lines\.*:\s*\d+.\d+\%/
|
||||||
|
artifacts:
|
||||||
|
when: always
|
||||||
|
paths:
|
||||||
|
- coverage/
|
||||||
|
- coverage.xml
|
||||||
|
- TEST-report.xml
|
||||||
|
reports:
|
||||||
|
coverage_report:
|
||||||
|
coverage_format: cobertura
|
||||||
|
path: coverage.xml
|
||||||
|
junit: TEST-report.xml
|
||||||
|
|
||||||
e2ee_test:
|
e2ee_test:
|
||||||
tags:
|
tags:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,42 @@
|
||||||
#!/bin/sh -e
|
#!/bin/bash
|
||||||
# pub run test -p vm
|
if which flutter >/dev/null; then
|
||||||
flutter test --coverage
|
flutter pub global activate junitreport
|
||||||
flutter pub global activate remove_from_coverage
|
flutter test --coverage --machine | tee TEST-report.json
|
||||||
flutter pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
|
TEST_CODE=${PIPESTATUS[0]}
|
||||||
|
|
||||||
|
# junit report
|
||||||
|
flutter pub global run junitreport:tojunit --input TEST-report.json --output TEST-report.xml
|
||||||
|
# remove shell escapes since those are invalid xml
|
||||||
|
sed 's///g' -i TEST-report.xml
|
||||||
|
|
||||||
|
# coverage
|
||||||
|
flutter pub global activate remove_from_coverage
|
||||||
|
flutter pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
|
||||||
|
else
|
||||||
|
dart pub global activate junitreport
|
||||||
|
dart test --coverage=coverage --file-reporter='json:TEST-report.json'
|
||||||
|
TEST_CODE=$?
|
||||||
|
|
||||||
|
# junit report
|
||||||
|
dart pub global run junitreport:tojunit --input TEST-report.json --output TEST-report.xml
|
||||||
|
# remove shell escapes since those are invalid xml
|
||||||
|
sed 's///g' -i TEST-report.xml
|
||||||
|
|
||||||
|
# coverage
|
||||||
|
dart pub global activate coverage
|
||||||
|
|
||||||
|
reporton="--report-on=lib/"
|
||||||
|
if [ -n "$NO_OLM" ]; then reporton="--report-on=lib/src --report-on=lib/msc_extensions"; fi
|
||||||
|
|
||||||
|
dart pub global run coverage:format_coverage -i coverage/ --lcov -o coverage/lcov.info $reporton
|
||||||
|
dart pub global activate remove_from_coverage
|
||||||
|
dart pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# coverage html report
|
||||||
genhtml -o coverage coverage/lcov.info || true
|
genhtml -o coverage coverage/lcov.info || true
|
||||||
|
|
||||||
|
# https://github.com/eriwen/lcov-to-cobertura-xml
|
||||||
|
lcov_cobertura.py coverage/lcov.info || true
|
||||||
|
|
||||||
|
exit $TEST_CODE
|
||||||
|
|
|
||||||
|
|
@ -270,5 +270,10 @@ void main() {
|
||||||
if (!olmEnabled) return;
|
if (!olmEnabled) return;
|
||||||
await client.dispose(closeDatabase: true);
|
await client.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,5 +117,10 @@ void main() {
|
||||||
if (!olmEnabled) return;
|
if (!olmEnabled) return;
|
||||||
await client.dispose(closeDatabase: true);
|
await client.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,5 +102,10 @@ void main() {
|
||||||
if (!olmEnabled) return;
|
if (!olmEnabled) return;
|
||||||
await client.dispose(closeDatabase: true);
|
await client.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,5 +120,10 @@ void main() {
|
||||||
await client.dispose(closeDatabase: true);
|
await client.dispose(closeDatabase: true);
|
||||||
await otherClient.dispose(closeDatabase: true);
|
await otherClient.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -572,5 +572,10 @@ void main() {
|
||||||
if (!olmEnabled) return;
|
if (!olmEnabled) return;
|
||||||
await client.dispose(closeDatabase: false);
|
await client.dispose(closeDatabase: false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -400,5 +400,10 @@ void main() {
|
||||||
|
|
||||||
await matrix.dispose(closeDatabase: true);
|
await matrix.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ void main() async {
|
||||||
true);
|
true);
|
||||||
await client1.encryption!.keyVerificationManager.cleanup();
|
await client1.encryption!.keyVerificationManager.cleanup();
|
||||||
await client2.encryption!.keyVerificationManager.cleanup();
|
await client2.encryption!.keyVerificationManager.cleanup();
|
||||||
});
|
}, skip: skip);
|
||||||
|
|
||||||
test('ask SSSS start', () async {
|
test('ask SSSS start', () async {
|
||||||
client1.userDeviceKeys[client1.userID]!.masterKey!
|
client1.userDeviceKeys[client1.userID]!.masterKey!
|
||||||
|
|
@ -257,7 +257,7 @@ void main() async {
|
||||||
|
|
||||||
await req1.cancel();
|
await req1.cancel();
|
||||||
await client1.encryption!.keyVerificationManager.cleanup();
|
await client1.encryption!.keyVerificationManager.cleanup();
|
||||||
});
|
}, skip: skip);
|
||||||
|
|
||||||
test('ask SSSS end', () async {
|
test('ask SSSS end', () async {
|
||||||
FakeMatrixApi.calledEndpoints.clear();
|
FakeMatrixApi.calledEndpoints.clear();
|
||||||
|
|
@ -379,7 +379,7 @@ void main() async {
|
||||||
|
|
||||||
await client1.encryption!.keyVerificationManager.cleanup();
|
await client1.encryption!.keyVerificationManager.cleanup();
|
||||||
await client2.encryption!.keyVerificationManager.cleanup();
|
await client2.encryption!.keyVerificationManager.cleanup();
|
||||||
});
|
}, skip: skip);
|
||||||
|
|
||||||
test('reject verification', () async {
|
test('reject verification', () async {
|
||||||
FakeMatrixApi.calledEndpoints.clear();
|
FakeMatrixApi.calledEndpoints.clear();
|
||||||
|
|
@ -412,7 +412,7 @@ void main() async {
|
||||||
|
|
||||||
await client1.encryption!.keyVerificationManager.cleanup();
|
await client1.encryption!.keyVerificationManager.cleanup();
|
||||||
await client2.encryption!.keyVerificationManager.cleanup();
|
await client2.encryption!.keyVerificationManager.cleanup();
|
||||||
});
|
}, skip: skip);
|
||||||
|
|
||||||
test('reject sas', () async {
|
test('reject sas', () async {
|
||||||
FakeMatrixApi.calledEndpoints.clear();
|
FakeMatrixApi.calledEndpoints.clear();
|
||||||
|
|
@ -488,7 +488,7 @@ void main() async {
|
||||||
|
|
||||||
await client1.encryption!.keyVerificationManager.cleanup();
|
await client1.encryption!.keyVerificationManager.cleanup();
|
||||||
await client2.encryption!.keyVerificationManager.cleanup();
|
await client2.encryption!.keyVerificationManager.cleanup();
|
||||||
});
|
}, skip: skip);
|
||||||
|
|
||||||
test('other device accepted', () async {
|
test('other device accepted', () async {
|
||||||
FakeMatrixApi.calledEndpoints.clear();
|
FakeMatrixApi.calledEndpoints.clear();
|
||||||
|
|
@ -536,6 +536,11 @@ void main() async {
|
||||||
'/client/v3/rooms/!1234%3AfakeServer.notExisting/send/m.key.verification.cancel'));
|
'/client/v3/rooms/!1234%3AfakeServer.notExisting/send/m.key.verification.cancel'));
|
||||||
await client1.encryption!.keyVerificationManager.cleanup();
|
await client1.encryption!.keyVerificationManager.cleanup();
|
||||||
await client2.encryption!.keyVerificationManager.cleanup();
|
await client2.encryption!.keyVerificationManager.cleanup();
|
||||||
});
|
}, skip: skip);
|
||||||
}, skip: skip);
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
}, skip: skip != 'false' ? 'false' : 'No need for dummy');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -264,5 +264,10 @@ void main() {
|
||||||
if (!olmEnabled) return;
|
if (!olmEnabled) return;
|
||||||
await client.dispose(closeDatabase: true);
|
await client.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,5 +120,10 @@ void main() {
|
||||||
if (!olmEnabled) return;
|
if (!olmEnabled) return;
|
||||||
await client.dispose(closeDatabase: false);
|
await client.dispose(closeDatabase: false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -496,5 +496,10 @@ void main() {
|
||||||
if (!olmEnabled) return;
|
if (!olmEnabled) return;
|
||||||
await client.dispose(closeDatabase: true);
|
await client.dispose(closeDatabase: true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,5 +73,10 @@ void main() {
|
||||||
expect(shrinkedImage.blurhash, 'L75NyU5kvvbx^7AF#kSgZxOZ%5NE',
|
expect(shrinkedImage.blurhash, 'L75NyU5kvvbx^7AF#kSgZxOZ%5NE',
|
||||||
reason: 'Unexpected scaled image blur');
|
reason: 'Unexpected scaled image blur');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1662,5 +1662,10 @@ void main() {
|
||||||
expect(event.onlyEmotes, false);
|
expect(event.onlyEmotes, false);
|
||||||
expect(event.numberEmotes, 2);
|
expect(event.numberEmotes, 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(milliseconds: 400));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,10 @@ void main() {
|
||||||
expect(data.tryGet<Map<String, dynamic>>('pam')?.tryGet<String>('beep'),
|
expect(data.tryGet<Map<String, dynamic>>('pam')?.tryGet<String>('beep'),
|
||||||
null);
|
null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(milliseconds: 400));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,5 +65,10 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(matrixException.error, MatrixError.M_UNKNOWN);
|
expect(matrixException.error, MatrixError.M_UNKNOWN);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// see https://github.com/dart-lang/test/issues/1698
|
||||||
|
test('KeyVerification dummy test', () async {
|
||||||
|
await Future.delayed(Duration(milliseconds: 400));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue