Skip to content

iox-#64 Raw pointer API for publisher and subscriber #222

iox-#64 Raw pointer API for publisher and subscriber

iox-#64 Raw pointer API for publisher and subscriber #222

Workflow file for this run

name: Build & Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
pre-flight-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: cargo fmt --check
cargo-nextest:
needs: pre-flight-check
strategy:
matrix:
os: [ubuntu-latest, macOS-latest] #Todo add windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Build and cache cargo-nextest
uses: ./.github/actions/build-and-cache-rust-tool
with:
rust-toolchain: stable
check-and-install-cmd: cargo-nextest --version > /dev/null || cargo install cargo-nextest --locked
print-version-cmd: cargo-nextest --version
cache-key: cache-1-${{ runner.os }}-cargo-nextest
artifact-path: ~/.cargo/bin/cargo-nextest
artifact-name: ${{ runner.os }}-cargo-nextest
grcov:
needs: pre-flight-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and cache grcov
uses: ./.github/actions/build-and-cache-rust-tool
with:
rust-toolchain: nightly
rust-components: llvm-tools-preview
check-and-install-cmd: grcov --version > /dev/null || cargo install grcov
print-version-cmd: grcov --version
cache-key: cache-1-${{ runner.os }}-grcov
artifact-path: ~/.cargo/bin/grcov
artifact-name: ${{ runner.os }}-grcov
build-test:
needs: cargo-nextest
strategy:
matrix:
os: [ubuntu-latest, macOS-latest] #Todo add windows-latest
toolchain: [stable, beta]
include:
- os: ubuntu-latest
toolchain: nightly
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.toolchain != 'stable' }}
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: Create version_info file
run: |
rustc --version > version_info
cargo --version >> version_info
cargo clippy --version >> version_info
cat version_info
- name: Setup cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cache-1-${{ runner.os }}-toolchain-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml', '**/build.rs', 'version_info') }}
- name: Download cargo-nextest artifact
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-cargo-nextest
path: ~/.cargo/bin
- name: Make cargo-nextest artifact executable
run: |
chmod +x ~/.cargo/bin/cargo-nextest
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install -y libacl1-dev
fi
- name: Build
run: cargo build --all --examples
- if: runner.os == 'Linux' && matrix.toolchain == 'stable'
name: Run clippy # clippy can reuse the previous build artifacts
run: cargo clippy
- name: Run tests
run: cargo nextest run --test-threads 1
coverage:
needs: [cargo-nextest, grcov]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
components: llvm-tools-preview
- name: Create version_info file
run: |
rustc --version > version_info
cargo --version >> version_info
cat version_info
- name: Setup cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: coverage-llvm-tools-preview-cache-1-${{ runner.os }}-toolchain-nightly-${{ hashFiles('**/Cargo.toml', '**/build.rs', 'version_info') }}
- name: Remove outdated files from cache
run: |
find . -type f -wholename "**/lcov.info" -exec rm {} \;
find . -type f -wholename "**/*.profraw" -exec rm {} \;
rm -rf target/debug/coverage-html
- name: Download artifact cargo-nextest
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-cargo-nextest
path: ~/.cargo/bin
- name: Download artifact grcov
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-grcov
path: ~/.cargo/bin
- name: Make cargo-nextest and grcov artifacts executable
run: |
chmod +x ~/.cargo/bin/cargo-nextest
chmod +x ~/.cargo/bin/grcov
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libacl1-dev
- name: Build
env:
LLVM_PROFILE_FILE: target/debug/llvm-profile-files/iceoryx-rs-%p-%m.profraw
RUSTFLAGS: -Cinstrument-coverage
run: cargo build
- name: Run test
env:
LLVM_PROFILE_FILE: target/debug/llvm-profile-files/iceoryx-rs-%p-%m.profraw
RUSTFLAGS: -Cinstrument-coverage
run: cargo nextest run --test-threads 1
- name: Generate coverage results for html artifacts
run: |
grcov \
target/debug/llvm-profile-files \
iceoryx-sys/target/debug/llvm-profile-files \
--binary-path target/debug \
--source-dir . \
--output-type html \
--branch \
--ignore-not-existing \
--ignore "examples/*" \
--ignore "iceoryx-sys/build.rs" \
--ignore "iceoryx-sys/src/roudi_environment.rs" \
--ignore "src/tests/*" \
--ignore "**/.cargo/*" \
--output-path target/debug/coverage-html
sed -i 's/coverage/grcov/' target/debug/coverage-html/coverage.json
- name: Archive coverage-html artifacts
uses: actions/upload-artifact@v3
with:
name: coverage-html
path: target/debug/coverage-html/*
retention-days: 90
- name: Generate coverage report for Codecov
run: |
grcov \
target/debug/llvm-profile-files \
iceoryx-sys/target/debug/llvm-profile-files \
--binary-path target/debug \
--source-dir . \
--output-type lcov \
--branch \
--ignore-not-existing \
--ignore "examples/*" \
--ignore "iceoryx-sys/build.rs" \
--ignore "iceoryx-sys/src/roudi_environment.rs" \
--ignore "src/tests/*" \
--ignore "**/.cargo/*" \
--output-path target/debug/lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: target/debug/lcov.info
fail_ci_if_error: true