Skip to content

Commit 1ca3a8e

Browse files
committed
Install missing rustup in windows-11-arm jobs
This works around the combination of these two conditions, which individually wouldn't be a problem but are a problem together: - The newly available `windows-11-arm` runner does not currently have `rustup` installed on it. - Although the `dtolnay/rust-toolchain` action will attempt to install `rustup` when it is absent on Unix-like systems, it does not attempt to do so on Windows. (If the latter condition is fixed, however, then depending on *how* it is fixed, it might still be necessary to install `rustup` ourselves. Specifically, it is easy to accidentally download a `rustup-init.exe` for x86-64 even when on ARM64/AArch64 Windows.) The new step here, added for both of the `windows-11-arm` jobs, is intended to be similar in its effect to these commands that `dtolnay/rustup-init` runs on Unix-like systems: https://github.com/actions-rust-lang/setup-rust-toolchain/blob/9399c7bb15d4c7d47b27263d024f0a4978346ba4/action.yml#L136-L139 Note that this is not quite equivalent. It is intentionally less versatile in two ways: - It hard-codes the AArch64 `rustup-init.exe` URL, to ensure that it is selected, rather than not finding anything or wrongly getting a URL for a Unix-like system or for x86-64 Windows. - No attempt is made to respect a preexisting `CARGO_HOME` environment variable (since we do not set one in these jobs). (This uses the style `$Env:varname` rather than `$env:varname` in PowerShell because the former seems to be much more common in the Microsoft documentation, and changes one preexisting occurrence of `$env` to `$Env` for stylistic consistency.)
1 parent 64f3af5 commit 1ca3a8e

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,19 @@ jobs:
217217

218218
steps:
219219
- uses: actions/checkout@v4
220+
- name: Install rustup
221+
if: matrix.os == 'windows-11-arm'
222+
run: |
223+
if (Get-Command rustup -ErrorAction SilentlyContinue) {
224+
Write-Output '::warning:: The runner has rustup. Consider removing this step.'
225+
} else {
226+
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL `
227+
--output rustup-init.exe `
228+
https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
229+
.\rustup-init.exe --default-toolchain none -y
230+
Remove-Item rustup-init.exe
231+
Add-Content -Value "PATH=$Env:USERPROFILE\.cargo\bin;$Env:PATH" -Path $Env:GITHUB_ENV
232+
}
220233
- uses: dtolnay/rust-toolchain@stable
221234
- uses: Swatinem/rust-cache@v2
222235
- name: cargo check default features
@@ -241,6 +254,19 @@ jobs:
241254

242255
steps:
243256
- uses: actions/checkout@v4
257+
- name: Install rustup
258+
if: matrix.os == 'windows-11-arm'
259+
run: |
260+
if (Get-Command rustup -ErrorAction SilentlyContinue) {
261+
Write-Output '::warning:: The runner has rustup. Consider removing this step.'
262+
} else {
263+
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL `
264+
--output rustup-init.exe `
265+
https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe
266+
.\rustup-init.exe --default-toolchain none -y
267+
Remove-Item rustup-init.exe
268+
Add-Content -Value "PATH=$Env:USERPROFILE\.cargo\bin;$Env:PATH" -Path $Env:GITHUB_ENV
269+
}
244270
- uses: dtolnay/rust-toolchain@stable
245271
- uses: Swatinem/rust-cache@v2
246272
- uses: taiki-e/install-action@v2
@@ -344,7 +370,7 @@ jobs:
344370
with:
345371
tool: nextest
346372
- name: Test data structure sizes (nextest)
347-
run: cargo nextest run --target $env:TARGET --workspace --no-fail-fast size
373+
run: cargo nextest run --target $Env:TARGET --workspace --no-fail-fast size
348374
- name: Doctest
349375
run: cargo test --workspace --doc --no-fail-fast
350376

0 commit comments

Comments
 (0)