Skip to content

Commit

Permalink
Collect coverage information during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed May 29, 2022
1 parent 532990d commit 13d79c0
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
48 changes: 44 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,58 @@ jobs:

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

# Set variable to enable coverage
env:
RUSTFLAGS: -C instrument-coverage

steps:
- name: Install coverage reporter (llvm-tools-preview)
if: runner.os == 'Linux'
run: rustup component add llvm-tools-preview
- name: Install coverage reporter (grcov)
if: runner.os == 'Linux'
run: cargo install grcov
- uses: actions/checkout@v1
- name: Build
run: cargo build
- name: Run tests (no features)
env:
LLVM_PROFILE_FILE: coverage/no-features-%p-%m.profraw
run: cargo test --no-default-features
- name: Run tests (serialize)
env:
LLVM_PROFILE_FILE: coverage/serialize-%p-%m.profraw
run: cargo test --features serialize
- name: Run tests (encoding+serialize)
run: cargo test --features encoding,serialize
- name: Run tests (escape-html+serialize)
run: cargo test --features escape-html,serialize
- name: Run tests (serialize+encoding)
env:
LLVM_PROFILE_FILE: coverage/serialize-encoding-%p-%m.profraw
run: cargo test --features serialize,encoding
- name: Run tests (serialize+escape-html)
env:
LLVM_PROFILE_FILE: coverage/serialize-escape-html-%p-%m.profraw
run: cargo test --features serialize,escape-html
- name: Prepare coverage information for upload
if: runner.os == 'Linux'
# --token is required by grcov, but not required by coveralls.io, so pass
# something to get it work. See https://github.com/mozilla/grcov/issues/833
run: |
grcov ./coverage \
-s . \
--binary-path ./target/debug/ \
--branch \
--ignore-not-existing \
--ignore 'tests/*' \
-t coveralls+ \
--token ? \
-o ./coveralls.json
- name: Upload coverage to codecov.io
if: runner.os == 'Linux'
uses: codecov/codecov-action@v2
with:
files: ./coveralls.json
flags: unittests
verbose: true
continue-on-error: true
- name: Check fmt
run: cargo fmt -- --check

3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@
|`DeError::EndOfAttributes`|Renamed to `DeError::KeyNotFound`
|`DeError::ExpectedStart`|Added

- [#391]: Added code coverage

### New Tests

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

[#8]: https://github.com/Mingun/fast-xml/pull/8
[#9]: https://github.com/Mingun/fast-xml/pull/9
[#391]: https://github.com/tafia/quick-xml/pull/391

## 0.23.0 -- 2022-05-08

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

High performance xml pull reader/writer.

Expand Down

0 comments on commit 13d79c0

Please sign in to comment.