diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee814f7..c225a67 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ on: - main jobs: - tests: + test-linux: runs-on: ubuntu-latest strategy: @@ -39,3 +39,34 @@ jobs: - run: cargo fmt --check - run: cargo check - run: cargo build --release + + test-windows: + runs-on: windows-latest + + strategy: + matrix: + toolchain: + - stable-x86_64-pc-windows-msvc + - stable-i686-pc-windows-msvc + use-cache: + - true + - false + + defaults: + run: + working-directory: tests + + steps: + - uses: actions/checkout@v6 + + - uses: ./ + with: + toolchain: ${{ matrix.toolchain }} + force-non-host: true + use-cache: ${{ matrix.use-cache }} + components: rustfmt + workspaces: tests + + - run: cargo fmt --check + - run: cargo check + - run: cargo build --release diff --git a/action.yml b/action.yml index 079a0d0..ab76fc8 100644 --- a/action.yml +++ b/action.yml @@ -13,6 +13,10 @@ inputs: components: description: Comma separated list of additional components. required: false + force-non-host: + description: Allow non-host toolchain to be installed. + default: false + required: false use-cache: description: Use rust-cache. default: true @@ -33,13 +37,24 @@ runs: if [[ -n "$COMPONENTS" ]]; then set -- "$@" --component "$COMPONENTS" fi + if "$FORCE_NON_HOST"; then + set -- "$@" --force-non-host + fi set -x rustup toolchain install "$@" --no-self-update - rustup default "$TOOLCHAIN" + + set +x + set -- "$TOOLCHAIN" + if "$FORCE_NON_HOST"; then + set -- "$@" --force-non-host + fi + set -x + rustup default "$@" env: TOOLCHAIN: ${{ inputs.toolchain }} PROFILE: ${{ inputs.profile }} COMPONENTS: ${{ inputs.components }} + FORCE_NON_HOST: ${{ case(inputs.force-non-host == 'true', 'true', 'false') }} shell: bash - uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1