Skip to content
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
20 changes: 20 additions & 0 deletions .github/workflows/check-msrv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check MSRV

on: [push]

jobs:
msrv:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Run check
run: |
# extract the MSRV from Root `Cargo.toml`
MSRV=$(grep '^rust-version ' Cargo.toml | cut -d= -f2- | tr -d ' "')
rustup default "${MSRV}"
cargo check --all-targets
59 changes: 59 additions & 0 deletions .github/workflows/run-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Run the Rust tests 🦀

on:
push:

env:
CARGO_TERM_COLOR: always

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Switch to nightly Rust
run: |
rustup default nightly
rustup component add llvm-tools-preview

- name: Set RUSTDOCFLAGS
run: |
echo "RUSTDOCFLAGS=-Cinstrument-coverage -Z unstable-options --persist-doctests $(pwd)/target/debug/doctestbins" >> "$GITHUB_ENV"

- name: Run tests 🦀
env:
RUSTFLAGS: '-Cinstrument-coverage -Clink-dead-code'
run: |
cargo test --workspace --exclude mchep_pyapi --no-fail-fast 2> >(tee stderr 1>&2)
if [ "${{ matrix.os }}" != "macos-latest" ]; then
sed -i 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' stderr
fi

- name: Generate code coverage
if: matrix.os == 'ubuntu-latest'
run: |
find . -name '*.profraw' -exec $(rustc --print target-libdir)/../bin/llvm-profdata merge -sparse -o mchep.profdata {} +
sed -nE 's/[[:space:]]+Running( unittests|) [^[:space:]]+ \(([^)]+)\)/\2/p' stderr | \
xargs printf ' --object %s' | \
xargs $(rustc --print target-libdir)/../bin/llvm-cov export \
--ignore-filename-regex=index.crates.io \
--ignore-filename-regex=rustc \
--ignore-filename-regex=mchep/tests \
--ignore-filename-regex=mchep_capi \
--instr-profile=mchep.profdata \
--skip-functions \
--format lcov > lcov.info
grep SF lcov.info | sort -u | sed 's/SF://'

- name: Upload to codecov.io
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: rust
Loading