Skip to content

Commit 015079b

Browse files
authored
Merge pull request #391 from Mingun/coverage
Collect coverage information during tests
2 parents 532990d + 13d79c0 commit 015079b

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

.github/workflows/rust.yml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,58 @@ jobs:
1010

1111
runs-on: ${{ matrix.platform }}
1212

13+
# Set variable to enable coverage
14+
env:
15+
RUSTFLAGS: -C instrument-coverage
16+
1317
steps:
18+
- name: Install coverage reporter (llvm-tools-preview)
19+
if: runner.os == 'Linux'
20+
run: rustup component add llvm-tools-preview
21+
- name: Install coverage reporter (grcov)
22+
if: runner.os == 'Linux'
23+
run: cargo install grcov
1424
- uses: actions/checkout@v1
1525
- name: Build
1626
run: cargo build
1727
- name: Run tests (no features)
28+
env:
29+
LLVM_PROFILE_FILE: coverage/no-features-%p-%m.profraw
1830
run: cargo test --no-default-features
1931
- name: Run tests (serialize)
32+
env:
33+
LLVM_PROFILE_FILE: coverage/serialize-%p-%m.profraw
2034
run: cargo test --features serialize
21-
- name: Run tests (encoding+serialize)
22-
run: cargo test --features encoding,serialize
23-
- name: Run tests (escape-html+serialize)
24-
run: cargo test --features escape-html,serialize
35+
- name: Run tests (serialize+encoding)
36+
env:
37+
LLVM_PROFILE_FILE: coverage/serialize-encoding-%p-%m.profraw
38+
run: cargo test --features serialize,encoding
39+
- name: Run tests (serialize+escape-html)
40+
env:
41+
LLVM_PROFILE_FILE: coverage/serialize-escape-html-%p-%m.profraw
42+
run: cargo test --features serialize,escape-html
43+
- name: Prepare coverage information for upload
44+
if: runner.os == 'Linux'
45+
# --token is required by grcov, but not required by coveralls.io, so pass
46+
# something to get it work. See https://github.com/mozilla/grcov/issues/833
47+
run: |
48+
grcov ./coverage \
49+
-s . \
50+
--binary-path ./target/debug/ \
51+
--branch \
52+
--ignore-not-existing \
53+
--ignore 'tests/*' \
54+
-t coveralls+ \
55+
--token ? \
56+
-o ./coveralls.json
57+
- name: Upload coverage to codecov.io
58+
if: runner.os == 'Linux'
59+
uses: codecov/codecov-action@v2
60+
with:
61+
files: ./coveralls.json
62+
flags: unittests
63+
verbose: true
64+
continue-on-error: true
2565
- name: Check fmt
2666
run: cargo fmt -- --check
2767

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@
3131
|`DeError::EndOfAttributes`|Renamed to `DeError::KeyNotFound`
3232
|`DeError::ExpectedStart`|Added
3333

34+
- [#391]: Added code coverage
35+
3436
### New Tests
3537

3638
- [#9]: Added tests for incorrect nested tags in input
3739

3840
[#8]: https://github.com/Mingun/fast-xml/pull/8
3941
[#9]: https://github.com/Mingun/fast-xml/pull/9
42+
[#391]: https://github.com/tafia/quick-xml/pull/391
4043

4144
## 0.23.0 -- 2022-05-08
4245

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
![status](https://github.com/tafia/quick-xml/actions/workflows/rust.yml/badge.svg)
44
[![Crate](https://img.shields.io/crates/v/quick-xml.svg)](https://crates.io/crates/quick-xml)
5+
[![codecov](https://img.shields.io/codecov/c/github/tafia/quick-xml)](https://codecov.io/gh/tafia/quick-xml)
56

67
High performance xml pull reader/writer.
78

0 commit comments

Comments
 (0)