name: CI
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUST_TEST_THREADS: 1
jobs:
test:
name: Test (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: i686-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
use-cross: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
use-cross: true
- target: i686-pc-windows-msvc
os: windows-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: x86_64-pc-windows-gnu
os: windows-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-apple-darwin
os: macos-15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install i686 Linux libraries
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib libc6-dev-i386
- name: Install cross
if: matrix.use-cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Run tests (cross)
if: matrix.use-cross
run: cross test --target ${{ matrix.target }}
- name: Run tests (cargo)
if: ${{ !matrix.use-cross }}
run: cargo test --target ${{ matrix.target }}
test-bsd:
name: Test (${{ matrix.target }})
runs-on: ubuntu-latest
defaults:
run:
shell: cpa.sh {0}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-freebsd
os: freebsd
os-version: '14.3'
- target: x86_64-unknown-openbsd
os: openbsd
os-version: '7.7'
install: sudo pkg_add rust
- target: x86_64-unknown-netbsd
os: netbsd
os-version: '10.1'
prepare: sudo pkgin -y install mozilla-rootcerts-openssl
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Start VM
uses: cross-platform-actions/action@v1.3.0
with:
operating_system: ${{ matrix.os }}
architecture: x86-64
version: ${{ matrix.os-version }}
- name: Prepare packages
if: matrix.prepare != ''
run: ${{ matrix.prepare }}
- name: Install Rust
run: |
${{ matrix.install || format('
curl https://sh.rustup.rs -sSf | sh -s -- -q -y --profile minimal --default-toolchain stable --target {0}
. "$HOME/.cargo/env"
', matrix.target) }}
- name: Run tests
run: |
if [ -f "$HOME/.cargo/env" ]; then
. "$HOME/.cargo/env"
fi
cargo test
check:
name: Check (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-illumos
toolchain: stable
- target: x86_64-unknown-redox
toolchain: stable
- target: aarch64-linux-android
toolchain: stable
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
- name: Check
run: cargo +${{ matrix.toolchain }} check --target ${{ matrix.target }}
check-hurd:
name: Check (x86_64-unknown-hurd-gnu)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install nightly + rust-src
uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- name: Check with build-std (no_std)
run: >
cargo +nightly check
-Z build-std=core,alloc
--target x86_64-unknown-hurd-gnu
--no-default-features
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust 1.85.0
uses: dtolnay/rust-toolchain@1.85.0
- name: Check MSRV
run: cargo check
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy
run: cargo clippy --all-targets -- -D warnings