name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_call:
env:
CARGO_TERM_COLOR: always
jobs:
format:
name: Code Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install rustfmt
run: rustup component add rustfmt
- name: Check Format (Rust)
run: cargo fmt --all -- --check
coverage:
name: Test Coverage
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "${{github.workspace}}/target/coverage/coverage-%p-%m.profraw"
POCL_LLVM_CPU_NAME: x86-64
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- name: Install llvm-tools
run: rustup component add llvm-tools-preview
- name: Build
run: cargo build --all-features --verbose
- name: Run tests
run: cargo test --all-features --verbose
- name: Run grcov
run: |
curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -
./grcov . -s . --binary-path target/debug --keep-only 'src/*' -t lcov --service-name Rust --branch --ignore-not-existing -o target/coverage/lcov.info
- name: Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
with:
file: ${{github.workspace}}/target/coverage/lcov.info
verbose: true
fail_ci_if_error: true
build:
strategy:
matrix:
os:
- value: ubuntu-latest
name: Ubuntu
- value: windows-latest
name: Windows
- value: macos-latest
name: MacOS
feature:
- value: --features default
name: default
- value: --no-default-features
name: no features
- value: --all-features
name: all features
- value: --features approx
name: approx
- value: --features simba
name: simba
- value: --features nalgebra
name: nalgebra
name: "Build & Test / ${{matrix.os.name}} / ${{matrix.feature.name}}"
env:
RUSTFLAGS: "--deny warnings"
runs-on: ${{matrix.os.value}}
steps:
- uses: actions/checkout@v5
- name: Build
run: cargo build --verbose --examples --tests --benches ${{matrix.feature.value}}
- name: Run tests
run: cargo test --verbose ${{matrix.feature.value}}