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

tarpaulin #575

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
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
62 changes: 16 additions & 46 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,9 @@ jobs:
run: |
cargo test --locked --features "bench, mimalloc" --all-targets -- --nocapture
cargo test --locked --features "bench, mimalloc" --doc -- --nocapture

codecov:
# See <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/source-based-code-coverage.html>
name: Coverage
tarpaulin:
name: Tarpaulin Coverage
runs-on: ubuntu-latest
env:
RUSTFLAGS: -Cinstrument-coverage
RUSTDOCFLAGS: -C instrument-coverage -Z unstable-options --persist-doctests target/debug/doctestbins
LLVM_PROFILE_FILE: profile-%m.profraw
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -130,8 +124,14 @@ jobs:
toolchain: ${{ env.NIGHTLY_VERSION }}
override: true
components: llvm-tools-preview
- name: Install cargo-binutils
run: cargo install cargo-binutils
- name: Install protobuf-compiler
run: sudo apt-get install -y protobuf-compiler
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Cache
uses: actions/cache@v3
continue-on-error: false
Expand All @@ -141,45 +141,15 @@ jobs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ env.RUST_VERSION }}-${{ env.NIGHTLY_VERSION }}-cargo-cov-${{ hashFiles('**/Cargo.lock') }}-cov
restore-keys: ${{ env.RUST_VERSION }}-${{ env.NIGHTLY_VERSION }}-cargo-cov-
- name: Install cargo-binutils
run: cargo install cargo-binutils
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Build tests with coverage
run: |
cargo test --locked --features "bench, mimalloc" --all-targets --no-fail-fast --no-run
cargo test --locked --features "bench, mimalloc" --doc --no-fail-fast -- --help
- name: Run tests with coverage
key: ${{ env.RUST_VERSION }}-${{ env.NIGHTLY_VERSION }}-tarpaulin-${{ hashFiles('**/Cargo.lock') }}-cov
restore-keys: ${{ env.RUST_VERSION }}-${{ env.NIGHTLY_VERSION }}-tarpaulin-
- name: Install cargo trapaulin
run: cargo install cargo-tarpaulin
- name: Generate code coverage
run: |
cargo test --locked --features "bench, mimalloc" --all-targets --no-fail-fast -- --nocapture
cargo test --locked --features "bench, mimalloc" --doc --no-fail-fast
- name: Merge execution traces
run: cargo profdata -- merge -sparse $(find . -iname "profile-*.profraw") -o profile.profdata
- name: Export to lcov format for codecov
# See <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/instrument-coverage.html#including-doc-tests>
run:
cargo cov -- export
--format=lcov > profile.lcov
--instr-profile=profile.profdata
$(
for file in
$(
cargo test --locked --features "bench, mimalloc" --all-targets
--no-fail-fast --no-run --message-format=json
| jq -r "select(.profile.test == true) | .filenames[]"
| grep -v dSYM -
)
target/debug/doctestbins/*/rust_out;
do
[[ -x $file ]] && printf "%s %s " -object $file ;
done
)
- name: Submit to codecov.io
uses: codecov/[email protected]
cargo tarpaulin --avoid-cfg-tarpaulin --no-dead-code --follow-exec --engine llvm --timeout 120 --out Xml
- name: Upload to codecov.io
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }} # Optional for public repos
flags: test
Expand Down
2 changes: 2 additions & 0 deletions tests/dynamic_batch_sizes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(not(tarpaulin))]

mod common;

use std::str::FromStr;
Expand Down
Loading