mirror of
https://github.com/dtolnay/rust-toolchain
synced 2026-09-14 20:13:54 +00:00
Support force-non-host toolchains
This commit is contained in:
@@ -43,3 +43,19 @@ jobs:
|
|||||||
if: matrix.rust == 'nightly' || matrix.rust == 'beta' || matrix.rust == 'stable'
|
if: matrix.rust == 'nightly' || matrix.rust == 'beta' || matrix.rust == 'stable'
|
||||||
- run: cargo check
|
- run: cargo check
|
||||||
if: matrix.rust == 'nightly' || matrix.rust == 'beta' || matrix.rust == 'stable'
|
if: matrix.rust == 'nightly' || matrix.rust == 'beta' || matrix.rust == 'stable'
|
||||||
|
|
||||||
|
non-host:
|
||||||
|
name: Non-host toolchain on Windows
|
||||||
|
runs-on: windows-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
toolchain: stable-i686-pc-windows-msvc
|
||||||
|
force-non-host: true
|
||||||
|
- name: Check the active toolchain and compiler host
|
||||||
|
run: |
|
||||||
|
test "$(rustup show active-toolchain)" = "stable-i686-pc-windows-msvc (default)"
|
||||||
|
rustc --version --verbose | grep -Fx 'host: i686-pc-windows-msvc'
|
||||||
|
shell: bash
|
||||||
|
|||||||
@@ -53,6 +53,10 @@ All inputs are optional.
|
|||||||
<td><code>components</code></td>
|
<td><code>components</code></td>
|
||||||
<td>Comma-separated string of additional components to install e.g. <code>clippy, rustfmt</code></td>
|
<td>Comma-separated string of additional components to install e.g. <code>clippy, rustfmt</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>force-non-host</code></td>
|
||||||
|
<td>Pass <code>--force-non-host</code> to rustup when installing and selecting the default toolchain. Defaults to <code>false</code>. Set to <code>true</code> when intentionally using a non-host toolchain that the host can run.</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
+7
-2
@@ -18,6 +18,10 @@ inputs:
|
|||||||
components:
|
components:
|
||||||
description: Comma-separated list of components to be additionally installed
|
description: Comma-separated list of components to be additionally installed
|
||||||
required: false
|
required: false
|
||||||
|
force-non-host:
|
||||||
|
description: Allow installing and selecting a toolchain that does not match the host platform
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
cachekey:
|
cachekey:
|
||||||
@@ -60,6 +64,7 @@ runs:
|
|||||||
echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT
|
echo "targets=$(for t in ${targets//,/ }; do echo -n ' --target' $t; done)" >> $GITHUB_OUTPUT
|
||||||
echo "components=$(for c in ${components//,/ }; do echo -n ' --component' $c; done)" >> $GITHUB_OUTPUT
|
echo "components=$(for c in ${components//,/ }; do echo -n ' --component' $c; done)" >> $GITHUB_OUTPUT
|
||||||
echo "downgrade=${{steps.parse.outputs.toolchain == 'nightly' && inputs.components && ' --allow-downgrade' || ''}}" >> $GITHUB_OUTPUT
|
echo "downgrade=${{steps.parse.outputs.toolchain == 'nightly' && inputs.components && ' --allow-downgrade' || ''}}" >> $GITHUB_OUTPUT
|
||||||
|
echo "force-non-host=${{inputs.force-non-host == 'true' && ' --force-non-host' || ''}}" >> $GITHUB_OUTPUT
|
||||||
env:
|
env:
|
||||||
targets: ${{inputs.targets || inputs.target || ''}}
|
targets: ${{inputs.targets || inputs.target || ''}}
|
||||||
components: ${{inputs.components}}
|
components: ${{inputs.components}}
|
||||||
@@ -89,13 +94,13 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: rustup toolchain install ${{steps.parse.outputs.toolchain}}
|
- name: rustup toolchain install ${{steps.parse.outputs.toolchain}}
|
||||||
run: rustup toolchain install ${{steps.parse.outputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update
|
run: rustup toolchain install ${{steps.parse.outputs.toolchain}}${{steps.flags.outputs.targets}}${{steps.flags.outputs.components}} --profile minimal${{steps.flags.outputs.downgrade}} --no-self-update${{steps.flags.outputs.force-non-host}}
|
||||||
env:
|
env:
|
||||||
RUSTUP_PERMIT_COPY_RENAME: 1
|
RUSTUP_PERMIT_COPY_RENAME: 1
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: rustup default ${{steps.parse.outputs.toolchain}}
|
- name: rustup default ${{steps.parse.outputs.toolchain}}
|
||||||
run: rustup default ${{steps.parse.outputs.toolchain}}
|
run: rustup default ${{steps.parse.outputs.toolchain}}${{steps.flags.outputs.force-non-host}}
|
||||||
shell: bash
|
shell: bash
|
||||||
continue-on-error: true # https://github.com/dtolnay/rust-toolchain/issues/127
|
continue-on-error: true # https://github.com/dtolnay/rust-toolchain/issues/127
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user