name: tests
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: tests-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
MSRV: "1.91"
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - uses: taiki-e/install-action@a4d3f3f761dcd95cce1b72cb61cb6d1963438177 with:
tool: cargo-make
- name: cargo clippy
run: cargo clippy --locked --workspace --all-targets --all-features
- name: cargo test --doc
run: cargo test --locked --workspace --all-features --doc
- run: cargo make format-check
- name: Assert lockfile unchanged
run: git diff --exit-code Cargo.lock
test:
runs-on: ${{ matrix.target.os }}
strategy:
fail-fast: false
matrix:
target:
- os: "ubuntu-latest"
toolchain: "x86_64-unknown-linux-gnu"
name: "Linux GNU"
- os: "macOS-latest"
toolchain: "x86_64-apple-darwin"
name: "macOS"
- os: "windows-latest"
toolchain: "x86_64-pc-windows-msvc"
name: "Windows MSVC"
- os: "windows-latest"
toolchain: "x86_64-pc-windows-gnu"
name: "Windows GNU"
channel:
- "stable"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: ${{ matrix.channel }}
targets: ${{ matrix.target.toolchain }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - name: cargo test (workspace, all features)
run: cargo test --locked --workspace --all-features --bins --tests --examples
- name: cargo test (workspace, default features)
run: cargo test --locked --workspace --bins --tests --examples
- name: cargo test (workspace, no default features)
run: cargo test --locked --workspace --no-default-features --bins --tests --examples
- name: cargo check (irpc, no default features)
run: cargo check --locked --no-default-features --bins --tests --examples
- name: cargo check (irpc, feature derive)
run: cargo check --locked --no-default-features --features derive --bins --tests --examples
- name: cargo check (irpc, feature rpc)
run: cargo check --locked --no-default-features --features rpc --bins --tests --examples
- name: cargo check (irpc, feature tracing-subscriber-03)
run: cargo check --locked --no-default-features --features tracing-subscriber-03 --bins --tests --examples
- name: cargo check (irpc-opentelemetry)
run: cargo check --locked -p irpc-opentelemetry --bins --tests --examples
test-release:
runs-on: ${{ matrix.target.os }}
strategy:
fail-fast: false
matrix:
target:
- os: "ubuntu-latest"
toolchain: "x86_64-unknown-linux-gnu"
name: "Linux GNU"
- os: "macOS-latest"
toolchain: "x86_64-apple-darwin"
name: "macOS"
- os: "windows-latest"
toolchain: "x86_64-pc-windows-msvc"
name: "Windows MSVC"
- os: "windows-latest"
toolchain: "x86_64-pc-windows-gnu"
name: "Windows GNU"
channel:
- "stable"
- "beta"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: ${{ matrix.channel }}
targets: ${{ matrix.target.toolchain }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - name: cargo test
run: cargo test --release --locked --workspace --all-features --bins --tests --examples
check_docs:
timeout-minutes: 30
name: Checking docs
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: nightly
- uses: dtolnay/install@982daea0f5d846abc3c83e01a6a1d73c040047c1 - name: Install sccache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba
- name: irpc
run: cargo docs-rs --locked -p irpc
- name: irpc-opentelemetry
run: cargo docs-rs --locked -p irpc-opentelemetry
wasm_build:
name: Build wasm32
runs-on: ubuntu-latest
env:
RUSTFLAGS: '--cfg getrandom_backend="wasm_js"'
steps:
- name: Checkout sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: stable
- name: Add wasm target
run: rustup target add wasm32-unknown-unknown
- name: Install wasm-tools
uses: bytecodealliance/actions/wasm-tools/setup@9152e710e9f7182e4c29ad218e4f335a7b203613 - name: wasm32 build
run: cargo build --locked --target wasm32-unknown-unknown --all
- name: Ensure no 'import "env"' in wasm
run: |
! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/irpc.wasm | grep 'import "env"'
check-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: stable
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - name: cargo check
run: cargo check --locked --workspace --all-features --lib --bins
minimal-crates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: nightly
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 - name: cargo check
run: |
rm -f Cargo.lock
cargo +nightly check -Z minimal-versions -Z min-publish-age \
--config 'registry.global-min-publish-age="3 days"' \
-p irpc -p irpc-derive --all-features --lib --bins
cargo-deny:
timeout-minutes: 30
name: cargo deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 with:
arguments: --workspace --all-features
command: check
command-arguments: "-Dwarnings"
check_semver:
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
fetch-depth: 0
- name: Install sccache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba
- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
shell: bash
run: |
echo "HEAD_COMMIT_SHA=$(git rev-parse "origin/$GITHUB_BASE_REF")" >> "$GITHUB_ENV"
- name: Setup Environment (Push)
if: ${{ github.event_name == 'push' || github.event_name == 'merge_group' }}
shell: bash
run: |
echo "HEAD_COMMIT_SHA=$(git rev-parse origin/main)" >> "$GITHUB_ENV"
- name: Check semver
uses: n0-computer/cargo-semver-checks-action@b49de9133f8849bb51cae32c6bdeb19a5c37e61f with:
package: irpc
baseline-rev: ${{ env.HEAD_COMMIT_SHA }}
use-cache: false
check_external_types:
timeout-minutes: 30
name: Check external types in public API
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
RUSTDOCFLAGS: ""
CARGO_CHECK_EXTERNAL_TYPES_VERSION: "0.5.0"
TOOLCHAIN: "nightly-2026-03-20"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 with:
toolchain: ${{ env.TOOLCHAIN }}
- name: Install sccache
uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba
- name: Install cargo-check-external-types
uses: taiki-e/install-action@a4d3f3f761dcd95cce1b72cb61cb6d1963438177 with:
tool: |
cargo-make
cargo-check-external-types@${{ env.CARGO_CHECK_EXTERNAL_TYPES_VERSION }}
- name: Check external types
run: cargo make check-external-types
- name: Lockfile must not have moved
run: git diff --exit-code Cargo.lock