name: "Setup MIRR"
description: "Standard setup for MIRR Rust projects with optimized sccache"
inputs:
  components:
    description: "Rust components to install"
    required: false
    default: ""
  targets:
    description: "Rust targets to install"
    required: false
    default: ""

runs:
  using: "composite"
  steps:
    - name: Install Rust toolchain
      uses: dtolnay/rust-toolchain@stable
      with:
        components: ${{ inputs.components }}
        targets: ${{ inputs.targets }}

    - name: Run sccache-cache
      uses: mozilla-actions/sccache-action@v0.0.7

    - name: Cache cargo registry
      uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
      with:
        path: |
          ~/.cargo/registry
          ~/.cargo/git
        key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
        restore-keys: |
          ${{ runner.os }}-cargo-registry-
