chore: add coverage badge

This commit is contained in:
Aleksey Kulikov 2022-01-26 19:34:31 +03:00
parent 23d6a7f332
commit ed62447eb2
3 changed files with 34 additions and 7 deletions

View file

@ -1,5 +1,7 @@
# libgit2dart
![Coverage](coverage_badge.svg)
**Dart bindings to libgit2**
libgit2dart package provides ability to use [libgit2](https://github.com/libgit2/libgit2) in Dart/Flutter.
@ -717,6 +719,8 @@ submodule.sync();
Fork libgit2dart, improve libgit2dart, send a pull request.
---
## Development
### Troubleshooting
@ -743,23 +747,24 @@ To generate bindings with ffigen use (adjust paths to yours):
dart run ffigen --compiler-opts "-I/path/to/libgit2dart/libgit2/headers/ -I/lib64/clang/12.0.1/include"
```
## Running Tests
### Running Tests
To run all tests and generate coverage report use the following commands:
To run all tests and generate coverage report make sure to have activated packages and [lcov](https://github.com/linux-test-project/lcov) installed:
```sh
$ dart pub global activate coverage
$ dart test --coverage="coverage"
$ format_coverage --lcov --check-ignore --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib
$ dart pub global activate flutter_coverage_badge
```
To view the generated coverage report you can use [lcov](https://github.com/linux-test-project/lcov):
And run:
```sh
$ genhtml coverage/lcov.info -o coverage/
$ ./coverage.sh
$ open coverage/index.html
```
---
## Licence
MIT. See LICENSE file for more information.
MIT. See [LICENSE](LICENSE) file for more information.

2
coverage.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
dart test --coverage="coverage" --test-randomize-ordering-seed random && format_coverage --lcov --check-ignore --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib && genhtml coverage/lcov.info -o coverage/ && dart pub global run flutter_coverage_badge

20
coverage_badge.svg Normal file
View file

@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="102" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="a">
<rect width="102" height="20" rx="3" fill="#fff"/>
</clipPath>
<g clip-path="url(#a)">
<path fill="#555" d="M0 0h59v20H0z"/>
<path fill="#44cc11" d="M59 0h43v20H59z"/>
<path fill="url(#b)" d="M0 0h102v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
<text x="305" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="490">coverage</text>
<text x="305" y="140" transform="scale(.1)" textLength="490">coverage</text>
<text x="795" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">100%</text>
<text x="795" y="140" transform="scale(.1)" textLength="330">100%</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1 KiB