name: Rust
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
env:
CARGO_TERM_COLOR: always
jobs:
license-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: EmbarkStudios/cargo-deny-action@v2
with:
arguments: --exclude-unpublished --exclude-dev
typo-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: crate-ci/typos@master
with:
write_changes: false
run-formatter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
run-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: cargo clippy -- -D warnings
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: cargo doc --all-features
build:
name: Build
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install aarch64 toolchain (Linux only)
if: matrix.target == 'aarch64-unknown-linux-gnu'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Set linker env (Linux/macOS ARM)
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'aarch64-apple-darwin'
shell: bash
run: |
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
fi
- name: Set linker env (Windows ARM)
if: matrix.target == 'aarch64-pc-windows-msvc'
shell: pwsh
run: |
echo "CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER=cl.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build --default-features
run: cargo build --target ${{ matrix.target }}
- name: Build --no-default-features
run: cargo build --no-default-features --target ${{ matrix.target }}
- name: Build --features async
run: cargo build --features async --target ${{ matrix.target }}
- name: Build --features sync
run: cargo build --features sync --target ${{ matrix.target }}
test:
name: Test
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: Swatinem/rust-cache@v2
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Test --default-features
run: cargo test --target ${{ matrix.target }}
- name: Test --no-default-features
run: cargo test --no-default-features --target ${{ matrix.target }}
- name: Test --features async
run: cargo test --features async --target ${{ matrix.target }}
- name: Test --features sync
run: cargo test --features sync --target ${{ matrix.target }}