name: test-rust
on:
pull_request:
branches: [ "*" ]
workflow_call:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
resolve-msrv:
runs-on: ubuntu-latest
outputs:
MSRV: ${{ steps.resolve-msrv.outputs.MSRV }}
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with:
persist-credentials: false
- uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 with:
python-version: '3.14'
enable-cache: false
- name: resolve MSRV
id: resolve-msrv
run: |
echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT
check-msrv:
needs: [resolve-msrv]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 with:
persist-credentials: false
- run: echo MSRV=${NEEDS_RESOLVE_MSRV_OUTPUTS_MSRV}
env:
NEEDS_RESOLVE_MSRV_OUTPUTS_MSRV: ${{ needs.resolve-msrv.outputs.MSRV }}
- run: rustup default ${NEEDS_RESOLVE_MSRV_OUTPUTS_MSRV} && rustup default ${NEEDS_RESOLVE_MSRV_OUTPUTS_MSRV}
env:
NEEDS_RESOLVE_MSRV_OUTPUTS_MSRV: ${{ needs.resolve-msrv.outputs.MSRV }}
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 - run: cargo build --verbose
- run: cargo test --verbose
test_rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Format
run: cargo fmt --check
- name: Lint
run: cargo clippy
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
- name: Run tests
run: cargo test
- name: Run tests with FMA
run: cargo test --features=fma
- name: Test no-std
run: |
rustup target add thumbv7em-none-eabihf
cargo build --target thumbv7em-none-eabihf --no-default-features
- name: Publish dry-run
if: github.ref != 'refs/heads/main'
run: cargo publish --dry-run