Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement coverage measurement #1

Merged
merged 1 commit into from
Nov 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions .github/workflows/toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,30 @@ jobs:
profile: minimal
toolchain: nightly
override: true
components: llvm-tools-preview
- uses: actions-rs/cargo@v1
with:
command: test
args: -- --test-threads=1
command: install
args: cargo-binutils rustfilt
- name: Build tests
run: |
cargo rustc --message-format=json --tests -- -Zinstrument-coverage | jq -r '.executable | strings' > executables.txt
- name: Run tests
run: |
while read p; do
exec "$p" --test-threads=1
done <executables.txt
env:
RUSTFLAGS: "-Zinstrument-coverage"
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v2
with:
path: ${{ runner.temp }}/llvm
key: llvm-11.0
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "11.0"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
LLVM_PROFILE_FILE: "prof/%m.profraw"
- name: Generate coverage report
run: |
llvm-profdata merge -sparse default.profraw -o default.profdata
rust-profdata merge -sparse prof/*.profraw -o default.profdata
cat executables.txt | xargs -d '\n' rust-cov export -format='lcov' -instr-profile='default.profdata' > lcov.info
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
file: default.profdata
fail_ci_if_error: true
- uses: actions/upload-artifact@v2
with:
name: Upload coverage artifact
path: lcov.info
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![CI Status](https://github.com/Diggsey/ijson/workflows/CI/badge.svg)](https://github.com/Diggsey/ijson/actions?query=workflow%3ACI)
[![Documentation](https://docs.rs/ijson/badge.svg)](https://docs.rs/ijson)
[![crates.io](https://img.shields.io/crates/v/ijson.svg)](https://crates.io/crates/ijson)
[![codecov](https://codecov.io/gh/Diggsey/ijson/branch/master/graph/badge.svg?token=XZ1UCUKSYB)](https://codecov.io/gh/Diggsey/ijson)

This crate offers a replacement for `serde-json`'s `Value` type, which is
significantly more memory efficient.
Expand Down