toolchain
toolchain copied to clipboard
Supply specific list of components to install
Motivation
I’m trying to make a CI that tests x86_64-unknown-openbsd
target. There is no rust-std component for this target so I thought I’d just get actions to build libstd in the first place (via e.g. -Zbuild-std
).
Alas, I’m not seeing how to disable rust-std
component with this workflow, so I’ll probably have to write one myself...
Workflow example
- name: Install Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: x86_64-unknown-openbsd
profile: minimal
default: true
components: rust-src
Notably, there is no profile that’s less than minimal AFAICT?
Hey, @nagisa!
Is it possible to achieve what you want with the rustup
directly? This Action just delegates all work to the rustup
and so far I'm not sure if it can install rust-src
component only, so it would be really helpful to understand if and how it could be done at all.
And profiles are just the rustup
profles, you can check them out.
I managed to do it by just doing:
# install rustup (with rustc and cargo for the host)
rustup component add rust-src --toolchain nightly --target ${{ matrix.rust_target }}
# at this stage you only have 1 component – rust-src for the target. and a host toolchain.
I see, thanks for the clarification.
In a current state components:
input values are passed into the rustup toolchain install
and not tied to target:
input at all; for example, components: rustfmt, clippy
will result in rustup toolchain install stable --component rustfmt --component clippy
call.
As a quick workaround you can use this Action to install host toolchain first (it will also guarantee that your environment will have latest rustup
installed and available from $PATH
) and then use steps.run
with your rustup component add rust-src …
line.
Yet, this case looks important and should be supported and it should be investigated further on how this Action should be modified in order to support it (ideally without introducing breaking changes). Let's leave this issue opened and I'll see what should be done with it.