oxc/.github/actions/rustup/action.yml
Boshen c35fb19f4f
ci: install minimal profile (#253)
rustup show always install the profiles set in rust-toolchain.toml,
I added an action to remove this line so we can install components selectively.

This should reduce Rust installation time, which can be significant on Windows.
2023-04-05 11:50:30 +08:00

50 lines
1.1 KiB
YAML

name: Rustup
description: Install Rust with minimal profile and additional components
inputs:
# See https://rust-lang.github.io/rustup/concepts/components.html
clippy:
default: false
required: false
type: boolean
fmt:
default: false
required: false
type: boolean
docs:
default: false
required: false
type: boolean
minimal:
default: true
required: false
type: boolean
runs:
using: composite
steps:
- name: Install Rust Toolchain
shell: bash
run: |
# Inherit the channel by removing `profile` line
sed '/profile/d' rust-toolchain.toml | tee rust-toolchain
mv rust-toolchain rust-toolchain.toml
if [ ${{ inputs.minimal }} ]; then
rustup set profile minimal
fi
if [ ${{ inputs.clippy }} ]; then
rustup component add clippy
fi
if [ ${{ inputs.fmt }} ]; then
rustup component add rustfmt
fi
if [ ${{ inputs.docs }} ]; then
rustup component add rust-docs
fi
rustup show