rsactor 0.14.1

A Simple and Efficient In-Process Actor Model Implementation for Rust.
Documentation
name: MSRV Check

# This workflow is dedicated to comprehensive MSRV (Minimum Supported Rust Version) testing
# It dynamically extracts the rust-version from workspace.package in Cargo.toml
# Runs on: push/PR to main, and monthly for MSRV compatibility validation

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
  schedule:
    # Monthly MSRV compatibility check to catch ecosystem changes
    - cron: '0 0 1 * *'

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  extract-msrv:
    name: Extract MSRV from Cargo.toml
    runs-on: ubuntu-latest
    outputs:
      msrv: ${{ steps.get-msrv.outputs.msrv }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v6

      - name: Extract MSRV from workspace
        id: get-msrv
        shell: bash
        run: |
          MSRV=$(awk '/^\[workspace\.package\]/{flag=1; next} /^\[/{flag=0} flag && /^rust-version/{print $3; exit}' Cargo.toml | tr -d '"')
          echo "msrv=$MSRV" >> $GITHUB_OUTPUT
          echo "Extracted MSRV: $MSRV"

  msrv-validation:
    name: Validate MSRV
    runs-on: ${{ matrix.os }}
    needs: extract-msrv
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]

    steps:
      - name: Checkout code
        uses: actions/checkout@v6

      - name: Install Rust ${{ needs.extract-msrv.outputs.msrv }}
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ needs.extract-msrv.outputs.msrv }}

      - name: Cache cargo dependencies
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-msrv-${{ needs.extract-msrv.outputs.msrv }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Verify Rust version
        shell: bash
        run: |
          echo "Expected MSRV: ${{ needs.extract-msrv.outputs.msrv }}"
          ACTUAL_VERSION=$(rustc --version | awk '{print $2}')
          echo "Actual Rust version: $ACTUAL_VERSION"
          if [ "$ACTUAL_VERSION" != "${{ needs.extract-msrv.outputs.msrv }}" ]; then
            echo "Error: Rust version mismatch!"
            exit 1
          fi

      - name: Verify Cargo.toml rust-version
        shell: bash
        run: |
          if [ -f "Cargo.toml" ]; then
            TOML_MSRV=$(awk '/^\[workspace\.package\]/{flag=1; next} /^\[/{flag=0} flag && /^rust-version/{print $3; exit}' Cargo.toml | tr -d '"')
            echo "Cargo.toml workspace rust-version: $TOML_MSRV"
            if [ "$TOML_MSRV" != "${{ needs.extract-msrv.outputs.msrv }}" ]; then
              echo "Error: Workspace rust-version ($TOML_MSRV) doesn't match extracted MSRV (${{ needs.extract-msrv.outputs.msrv }})"
              exit 1
            else
              echo "✓ Cargo.toml workspace rust-version matches MSRV"
            fi
          fi

      - name: Check compilation
        shell: bash
        run: |
          echo "Testing compilation with MSRV..."
          cargo check --verbose

      - name: Build with MSRV
        shell: bash
        run: |
          echo "Building with MSRV..."
          cargo build --verbose

      - name: Build all features with MSRV
        shell: bash
        run: |
          echo "Building all features with MSRV..."
          cargo build --verbose --all-features

      - name: Test with MSRV
        shell: bash
        run: |
          echo "Running tests with MSRV..."
          cargo test --verbose

      - name: Test all features with MSRV
        shell: bash
        run: |
          echo "Running tests with all features using MSRV..."
          cargo test --verbose --all-features

      - name: Build examples with MSRV
        shell: bash
        run: |
          echo "Building examples with MSRV..."
          for example in examples/*.rs; do
            if [ -f "$example" ]; then
              example_name=$(basename "$example" .rs)
              echo "Building example: $example_name"
              cargo build --example "$example_name" --verbose || {
                echo "Failed to build example: $example_name"
                exit 1
              }
            fi
          done

      - name: Check documentation build with MSRV
        shell: bash
        run: |
          echo "Building documentation with MSRV..."
          cargo doc --no-deps --verbose

  msrv-feature-matrix:
    name: MSRV Feature Matrix
    runs-on: ubuntu-latest
    needs: extract-msrv
    strategy:
      matrix:
        features:
          - ""  # No features
          - "--all-features"
          - "--no-default-features"

    steps:
      - name: Checkout code
        uses: actions/checkout@v6

      - name: Install Rust ${{ needs.extract-msrv.outputs.msrv }}
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ needs.extract-msrv.outputs.msrv }}

      - name: Cache cargo dependencies
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ubuntu-msrv-features-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }}

      - name: Test with feature configuration
        shell: bash
        run: |
          echo "Testing with features: ${{ matrix.features }}"
          cargo test --verbose ${{ matrix.features }}

  msrv-clippy:
    name: MSRV Clippy Check
    runs-on: ubuntu-latest
    needs: extract-msrv
    steps:
      - name: Checkout code
        uses: actions/checkout@v6

      - name: Install Rust ${{ needs.extract-msrv.outputs.msrv }}
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ needs.extract-msrv.outputs.msrv }}
          components: clippy

      - name: Cache cargo dependencies
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ubuntu-msrv-clippy-${{ hashFiles('**/Cargo.lock') }}

      - name: Run clippy with MSRV
        shell: bash
        run: |
          echo "Running clippy with MSRV..."
          cargo clippy --all-targets --all-features -- -D warnings