on:
workflow_dispatch:
pull_request:
push:
branches:
- master
tags:
- '*'
name: Build
jobs:
check:
name: Check
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.85.0
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: "cargo check"
run: cargo check
test:
name: Test Suite
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.85.0
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: "cargo test"
run: cargo test
- name: "cargo test (no default features)"
run: cargo test --tests --no-default-features
- name: "cargo test (all features)"
run: cargo test --all-features
run:
name: Run examples
strategy:
fail-fast: false
matrix:
job:
- { os: ubuntu-24.04, target: x86_64-unknown-linux-gnu, use-cross: false }
- { os: ubuntu-24.04, target: x86_64-unknown-linux-musl, use-cross: true }
- { os: ubuntu-24.04, target: arm-unknown-linux-gnueabihf, use-cross: true }
- { os: ubuntu-24.04, target: aarch64-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-24.04, target: i586-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-24.04, target: i686-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-24.04, target: i686-unknown-linux-musl, use-cross: true }
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu, use-cross: false }
- { os: ubuntu-22.04, target: x86_64-unknown-linux-musl, use-cross: true }
- { os: ubuntu-22.04, target: arm-unknown-linux-gnueabihf, use-cross: true }
- { os: ubuntu-22.04, target: aarch64-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-22.04, target: i586-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-22.04, target: i686-unknown-linux-gnu, use-cross: true }
- { os: ubuntu-22.04, target: i686-unknown-linux-musl, use-cross: true }
- { os: macos-26, target: aarch64-apple-darwin, use-cross: false }
- { os: windows-2025, target: i686-pc-windows-msvc, use-cross: false }
- { os: windows-2025, target: x86_64-pc-windows-gnu, use-cross: false }
- { os: windows-2025, target: x86_64-pc-windows-msvc, use-cross: false }
- { os: windows-2022, target: i686-pc-windows-msvc, use-cross: false }
- { os: windows-2022, target: x86_64-pc-windows-gnu, use-cross: false }
- { os: windows-2022, target: x86_64-pc-windows-msvc, use-cross: false }
runs-on: ${{ matrix.job.os }}
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.job.target }}
- uses: taiki-e/install-action@cross
if: matrix.job.use-cross
- name: "example 'readme'"
if: matrix.job.use-cross
env:
SIMPLE_VAR_1: "'test value' in environment variable"
run: cross run --target ${{ matrix.job.target }} --example=readme -- "'test value' on command line" "two" "three"
- name: "example 'readme'"
if: ${{ !matrix.job.use-cross }}
env:
SIMPLE_VAR_1: "'test value' in environment variable"
run: cargo run --target ${{ matrix.job.target }} --example=readme -- "'test value' on command line" "two" "three"
- name: "example 'simple'"
if: matrix.job.use-cross
env:
SIMPLE_VAR_1: "'test value' in environment variable"
run: cross run --target ${{ matrix.job.target }} --example=simple -- "'test value' on command line" "two" "three"
- name: "example 'simple'"
if: ${{ !matrix.job.use-cross }}
env:
SIMPLE_VAR_1: "'test value' in environment variable"
run: cargo run --target ${{ matrix.job.target }} --example=simple -- "'test value' on command line" "two" "three"
- name: "example 'custom_collector'"
if: matrix.job.use-cross
run: cross run --target ${{ matrix.job.target }} --example=custom_collector -- "'test value' on command line" "two" "three"
- name: "example 'custom_collector'"
if: ${{ !matrix.job.use-cross }}
run: cargo run --target ${{ matrix.job.target }} --example=custom_collector -- "'test value' on command line" "two" "three"
- name: "test-crates tests"
run: ./test-crates/run-all-tests.sh
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.85.0
components: rustfmt
- name: "cargo fmt"
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.85.0
components: clippy
- name: "cargo clippy"
run: cargo clippy -- -D warnings