name: Setup environment
description: Install cargo binstall and mise environment
runs:
  using: composite
  steps:
    - name: Cache
      uses: actions/cache@v4
      with:
        path: |
          ~/.cargo/bin/
          ~/.cargo/registry/index/
          ~/.cargo/registry/cache/
          ~/.cargo/git/db/
          ~/.rustup/toolchains/
        key: cargo-${{ hashFiles('Cargo.toml') }}
        restore-keys: |
          cargo-

    - name: Install cargo-binstall
      uses: cargo-bins/cargo-binstall@v1.15.6

    - name: Setup mise
      uses: jdx/mise-action@v2

    - name: Install nightly
      shell: bash
      run: mise run install-nightly
