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 27, 2022
1 parent 33bd997 commit f24459b
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ignore:
- "build.rs"
- "examples"
- "src/testing"
- "src/tests"

61 changes: 56 additions & 5 deletions .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 All @@ -15,15 +15,23 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest] #Todo add windows-latest
rust: [stable, nightly]
toolchain: [stable, nightly]

steps:
- uses: actions/checkout@v3
- uses: hecrj/setup-rust-action@v1
with:
rust-version: ${{ matrix.rust }}
- uses: actions/checkout@v3
rust-version: ${{ matrix.toolchain }}
- name: Setup cache
uses: actions/cache@v2
with:
submodules: recursive
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cache-${{ runner.os }}-toolchain-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/build.rs') }}
- if: startsWith(matrix.os, 'ubuntu-latest') == true
name: Install dependencies
run: |
Expand All @@ -33,3 +41,46 @@ jobs:
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: actions/checkout@v3
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: llvm-tools-preview
override: true
- name: Setup cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: coverage-llvm-tools-preview-cache-${{ runner.os }}-toolchain-nightly-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/build.rs') }}
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libacl1-dev libncurses5-dev
grcov --version > /dev/null || cargo install grcov
- 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
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./lcov.info
fail_ci_if_error: true

0 comments on commit f24459b

Please sign in to comment.