diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 39e27cb..a2eaa52 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -43,3 +43,19 @@ jobs:
if: matrix.rust == 'nightly' || matrix.rust == 'beta' || matrix.rust == 'stable'
- run: cargo check
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
diff --git a/README.md b/README.md
index 296681d..7ac5260 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,10 @@ All inputs are optional.
components |
Comma-separated string of additional components to install e.g. clippy, rustfmt |
+
+ force-non-host |
+ Pass --force-non-host to rustup when installing and selecting the default toolchain. Defaults to false. Set to true when intentionally using a non-host toolchain that the host can run. |
+
diff --git a/action.yml b/action.yml
index 744b29c..b667487 100644
--- a/action.yml
+++ b/action.yml
@@ -18,6 +18,10 @@ inputs:
components:
description: Comma-separated list of components to be additionally installed
required: false
+ force-non-host:
+ description: Allow installing and selecting a toolchain that does not match the host platform
+ required: false
+ default: "false"
outputs:
cachekey:
@@ -60,6 +64,7 @@ runs:
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 "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:
targets: ${{inputs.targets || inputs.target || ''}}
components: ${{inputs.components}}
@@ -89,13 +94,13 @@ runs:
shell: bash
- 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:
RUSTUP_PERMIT_COPY_RENAME: 1
shell: bash
- 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
continue-on-error: true # https://github.com/dtolnay/rust-toolchain/issues/127