name: CI / Stable
on:
push:
branches:
- master
- v5.x.x
workflow_call:
workflow_dispatch:
concurrency:
group: ci-stable-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
LATEST_STABLE_RUST_VERSION: "TBD"
jobs:
lint-stable:
name: Lint (Stable)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
show-progress: false
- name: Get latest stable Rust version
run: |
echo "LATEST_STABLE_RUST_VERSION=$(gh api /repos/rust-lang/rust/releases --jq ".[0].tag_name")" >> "$GITHUB_ENV"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Toolchain
uses: actions/cache@v6
with:
path: ~/.rustup
key: toolchain-x86-64-${{ env.LATEST_STABLE_RUST_VERSION }}
- name: Install `stable` Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- name: Prepare example artifacts
run: bash .github/scripts/prepare-example-artifacts.sh
- name: Run Clippy
run: cargo clippy --features=serde,rkyv_08,test_utils --no-deps
- name: Install cpp_competitors system dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libboost-dev libarmadillo-dev libensmallen-dev
- name: Install cargo-hack
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-hack
version: "^0.6"
- name: Cargo Hack (check all stable targets and features)
run: cargo hack check --workspace --each-feature --all-targets --exclude-features simd
- name: Check minimal feature combinations
run: |
cargo check --lib --no-default-features
cargo check --lib --no-default-features --features=fixed
cargo check --lib --no-default-features --features=serde
normal_dependencies=$(cargo tree --edges=normal --no-default-features --features=serde --prefix=none)
if grep -Eq '^(fixed|test-log) v' <<< "$normal_dependencies"; then
echo "fixed and test-log must not be normal dependencies without the fixed feature" >&2
exit 1
fi
test-stable:
name: Test (Stable)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
show-progress: false
- name: Get latest stable Rust version
run: |
echo "LATEST_STABLE_RUST_VERSION=$(gh api /repos/rust-lang/rust/releases --jq ".[0].tag_name")" >> "$GITHUB_ENV"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Toolchain
uses: actions/cache@v6
with:
path: ~/.rustup
key: toolchain-x86-64-${{ env.LATEST_STABLE_RUST_VERSION }}
- name: Install `stable` Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- name: Prepare example artifacts
run: bash .github/scripts/prepare-example-artifacts.sh
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Cargo nextest
run: |
cargo nextest run --workspace --features=serde,rkyv_08,test_utils
- name: Cargo test (Doctests)
run: |
cargo test --workspace --doc --features=serde,rkyv_08,test_utils