name: CI
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all --check
- run: cargo clippy --all-targets --all-features
- run: cargo test --all-features
no-c-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: No C-compiling build dependencies
run: |
if cargo tree --all-features -e build | grep -E '\b(cc|cmake|bindgen|nasm) v'; then
echo "::error::a C-compiling build dependency was introduced"; exit 1
fi
- name: No C crypto/TLS backends
run: |
if cargo tree --all-features | grep -E '\b(ring|aws-lc-sys|openssl-sys) v'; then
echo "::error::a C crypto backend was introduced"; exit 1
fi
features:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-hack
- run: cargo hack --feature-powerset --no-dev-deps check
build:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, target: x86_64-unknown-linux-musl, static: true }
- { os: ubuntu-24.04-arm, target: aarch64-unknown-linux-musl, static: true }
- { os: windows-latest, target: x86_64-pc-windows-msvc, static: false }
- { os: macos-latest, target: aarch64-apple-darwin, static: false }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Build
shell: bash
run: |
if [ "${{ matrix.target }}" = "x86_64-pc-windows-msvc" ]; then
export RUSTFLAGS="$RUSTFLAGS -C target-feature=+crt-static"
fi
cargo build --release --all-features --target ${{ matrix.target }}
- name: Assert static (Linux musl)
if: matrix.static
run: file target/${{ matrix.target }}/release/interlink-bus | grep -qi static