name: Setup toolchain
description: Rust toolchain (from rust-toolchain.toml) + protoc + rust-cache, plus optional Python/uv.
inputs:
rust-target:
description: Optional rustup target triple to install (e.g. aarch64-unknown-linux-gnu).
required: false
default: ""
cache-key:
description: Swatinem/rust-cache shared-key.
required: false
default: ""
python:
description: Set to "true" to also install Python and uv.
required: false
default: "false"
python-version:
description: Python version (only used when python=true).
required: false
default: "3.12"
runs:
using: composite
steps:
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ inputs.rust-target }}
cache: false
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ github.token }}
- name: Export PROTOC_INCLUDE
shell: bash
run: echo "PROTOC_INCLUDE=$(dirname "$(command -v protoc)")/../include" >> "$GITHUB_ENV"
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ inputs.cache-key }}
- if: ${{ inputs.python == 'true' }}
uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
- if: ${{ inputs.python == 'true' }}
uses: astral-sh/setup-uv@v7
with:
enable-cache: true