name: Rust
on: ["push", "pull_request"]
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Check formatting
run: cargo fmt -- --check
- name: Clippy (default)
run: cargo clippy -- -D warnings
- name: Clippy (no default features)
run: cargo clippy --no-default-features -- -D warnings
- name: Clippy (all features)
run: cargo clippy --all-features -- -D warnings
build:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
rust:
- 1.85.0
- stable
- beta
- nightly
features:
- ''
- '--no-default-features'
- '--no-default-features --features alloc'
- '--no-default-features --features alloc,no_copy_impls'
- '--all-features'
steps:
- name: Install rust (${{ matrix.rust }})
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: actions/checkout@v6
- name: Build
run: cargo build --verbose ${{ matrix.features }}
- name: Test
run: cargo test --verbose ${{ matrix.features }}
coverage:
needs: build
name: coverage
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Generate code coverage
run: |
cargo +nightly tarpaulin --verbose --engine llvm --all-features --workspace --out Lcov
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "lcov.info"
build-i686:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install 32-bit support
run: sudo apt-get update && sudo apt-get install -y gcc-multilib
- name: Add i686 target
run: rustup target add i686-unknown-linux-gnu
- name: Build (32-bit)
run: cargo build --target i686-unknown-linux-gnu
- name: Test (32-bit)
run: cargo test --target i686-unknown-linux-gnu