name: cargo test

on:
  workflow_call:

jobs:
  test:
    name: ${{ matrix.os }} / ${{ matrix.features || 'default' }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        features: ["", "serde", "parallel", "parallel,serde"]
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: ${{ matrix.os }}-stable
          save-if: false
      - run: cargo test --features "${{ matrix.features }}"
