lean_string 0.7.0

Compact, clone-on-write string.
Documentation
name: CI

on:
  push:
    branches:
      - main
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: "always"
  RUSTFLAGS: "-D warnings"
  PROPTEST_CASES: 10000
  MIRIFLAGS: "-Zmiri-strict-provenance"

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - name: Format check
        run: cargo fmt --all --check

      - name: Lint check
        run: |
          cargo check --all-features
          cargo clippy --all-features

  msrv:
    name: MSRV
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - uses: taiki-e/install-action@a6b2e2dcd845ddd7f509ce4f3ed3d922b80cc5d9 # v2.84.0
        with:
          tool: cargo-hack

      - name: Verify MSRV
        run: cargo hack check --rust-version --all-features

  test:
    name: Test
    runs-on: ubuntu-latest
    strategy:
      matrix:
        opt: ["", "--release"]
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - name: Test (default)
        run: cargo test ${{ matrix.opt }}

      - name: Test (no-default-features)
        run: cargo test ${{ matrix.opt }} --no-default-features

      - name: Test (all-features)
        run: cargo test ${{ matrix.opt }} --all-features

      - name: Test (Loom)
        run: RUSTFLAGS="--cfg loom" cargo test --test loom ${{ matrix.opt }} --features loom -- --test-threads=1

  miri:
    name: Miri (${{ matrix.name }})
    runs-on: ubuntu-latest
    strategy:
      matrix:
        include:
          - name: 64-bit LE
            target: x86_64-unknown-linux-gnu
          - name: 64-bit BE
            target: powerpc64-unknown-linux-gnu
          - name: 32-bit LE
            target: i686-unknown-linux-gnu
          - name: 32-bit BE
            target: powerpc-unknown-linux-gnu
      fail-fast: false
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

      - name: Install Miri
        run: |
          rustup toolchain install nightly --profile minimal
          rustup +nightly component add miri

      - name: Rust Cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
        with:
          prefix-key: rust
          shared-key: miri-${{ matrix.target }}

      - name: Test (default)
        run: cargo +nightly miri test --target ${{ matrix.target }}

      - name: Test (no-default-features)
        run: cargo +nightly miri test --target ${{ matrix.target }} --no-default-features

      - name: Test (all-features)
        run: cargo +nightly miri test --target ${{ matrix.target }} --all-features

      - name: Test (race condition)
        env:
          MIRIFLAGS: "-Zmiri-strict-provenance -Zmiri-preemption-rate=1"
        run: cargo +nightly miri test --target ${{ matrix.target }} --test race_condition