Skip to content

Commit

Permalink
iox-#5 Add coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jun 22, 2022
1 parent a9ba2f7 commit 2d4f6fd
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust Build & Test (Ubuntu, macOS, Windows)
name: Build & Test

on:
push:
Expand Down Expand Up @@ -29,7 +29,56 @@ jobs:
run: |
sudo apt update
sudo apt install -y libacl1-dev libncurses5-dev
- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: test-${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --all --examples
- name: Run tests
run: cargo test -- --test-threads=1 # prevent running multiple RouDiEnvironments in parallel

coverage:
runs-on: ubuntu-latest
steps:
- uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
components: llvm-tools-preview
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libacl1-dev libncurses5-dev
cargo install grcov
- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: test-coverage-llvm-tools-preview-${{ runner.os }}-cargo-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build
env:
RUSTFLAGS: -Cinstrument-coverage
run: cargo build
- name: Run test
env:
LLVM_PROFILE_FILE: iceoryx-rs-%p-%m.profraw
RUSTFLAGS: -Cinstrument-coverage
run: cargo test -- --test-threads=1 # prevent running multiple RouDiEnvironments in parallel
- name: Generate coverage
run: |
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing -o ./lcov.info
bash <(curl -s https://codecov.io/bash) -f lcov.info

0 comments on commit 2d4f6fd

Please sign in to comment.