name: CI
on:
push:
branches: [master]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test & lint (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest - ubuntu-24.04-arm - macos-latest - macos-15-intel - windows-latest - windows-11-arm steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Format
if: matrix.os == 'ubuntu-latest' run: cargo fmt --all --check
- name: Clippy (all features, warnings denied)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Clippy (no_std, warnings denied)
run: cargo clippy --all-targets --no-default-features -- -D warnings
- name: Test (all features)
run: cargo test --all-features
- name: Test (no_std)
run: cargo test --no-default-features
cross:
name: Test (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, target: x86_64-unknown-linux-musl }
- { os: ubuntu-latest, target: i686-unknown-linux-musl }
- { os: windows-latest, target: i686-pc-windows-msvc }
- { os: ubuntu-24.04-arm, target: aarch64-unknown-linux-musl }
- { os: ubuntu-latest, target: armv7-unknown-linux-musleabihf, qemu: arm }
- { os: ubuntu-latest, target: riscv64gc-unknown-linux-musl, qemu: riscv64 }
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Set up qemu-user
if: matrix.qemu
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.qemu }}
- name: Link static musl binaries with rust-lld
if: runner.os == 'Linux'
run: |
target_env=$(tr 'a-z-' 'A-Z_' <<<"${{ matrix.target }}")
echo "CARGO_TARGET_${target_env}_LINKER=rust-lld" >> "$GITHUB_ENV"
# Not every musl target is static and self-contained by default.
echo "CARGO_TARGET_${target_env}_RUSTFLAGS=-C target-feature=+crt-static -C link-self-contained=yes" >> "$GITHUB_ENV"
- name: Test (all features)
run: cargo test --all-features --target ${{ matrix.target }}
- name: Test (no_std)
run: cargo test --no-default-features --target ${{ matrix.target }}
fullrust:
name: fullrust (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-fullrust
- aarch64-unknown-linux-fullrust
- i686-unknown-linux-fullrust
- armv7-unknown-linux-fullrusteabihf
steps:
- uses: actions/checkout@v7
- name: Test (all features)
uses: KarpelesLab/fullrust@master
with:
command: test
target: ${{ matrix.target }}
args: --lib --tests --all-features
- name: Test (no_std)
uses: KarpelesLab/fullrust@master
with:
command: test
target: ${{ matrix.target }}
args: --lib --tests --no-default-features
check:
name: Check (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- riscv64gc-unknown-linux-gnu
- armv7-unknown-linux-gnueabihf
- arm-unknown-linux-gnueabihf
- i686-unknown-linux-gnu
- x86_64-pc-windows-gnu
- aarch64-pc-windows-gnullvm
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
targets: ${{ matrix.target }}
- name: Clippy (all features, warnings denied)
run: cargo clippy --all-targets --all-features --target ${{ matrix.target }} -- -D warnings
msrv:
name: MSRV (1.95)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Rust 1.95
uses: dtolnay/rust-toolchain@1.95
- name: Check
run: cargo check --all-targets --all-features